The division of output between two factories is a case in which you have two factories; an older plant with a higher Marginal Cost and a newer factory with a lower Marginal Cost.
To determine how much each factory should produce, you have to draw a horizontal Price/Demand line across the two graphs (of the old and new factory). Where this price line intersects with the Marginal Cost curve, you will get the quantity produced by each factory. The factory with the lower Marginal Cost curve will produce more. The factories should produce up to the point where marginal revenue is equal to marginal cost.
We choose this point because when marginal revenue is higher than marginal cost, the firm benefits from producing one more unit. Similarly, when marginal cost is higher than marginal revenue, the firm loses money from producing one more unit.
Division of Output in the Old Factory
If the marginal cost of production is higher in one plant than another and the firm is producing a positive output in the plant with the higher marginal cost, then the firm can reduce its cost by transferring one unit of output from the plant with the higher marginal cost to the plant with the lower marginal cost.
Only when the marginal costs in both plants are the same or the output at the factory with the higher Marginal Cost is zero, can the firm not reduce its cost any further.
Division of Output in the New Factory
In the above diagram of the cost curve of the old factory, we have drawn a price line that intersects both diagrams. This lines determines how much production we should allocate to each factory. Where Price (Marginal Revenue) intersects with Marginal Cost (MC), that will decide the quantity produced by the old factory. The older factory has higher marginal costs than the newer one (in the diagram below), therefore it will produce less.