The real wordsTheory
The three inventory rows
This is where the marks go missing, so learn it as three separate lines.
Beginning inventory (period t) = Ending inventory (period t-1)
Ending inventory = Beginning + Output - Forecast
Average inventory = (Beginning + Ending) / 2
The carrying charge is applied to average inventory, not to ending inventory. Using ending inventory is the single commonest error in this topic.
If ending inventory would go negative, set it to zero and put the shortfall in the backlog row instead.