Amara's bakery, in The Costs of Production, had exactly one dial to turn. The oven was fixed — she leased one, and baking more bread meant calling in more bakers to share it, which is why her marginal product diminished and her costs curved the way they did. That was a deliberate restriction, not an oversight: it is what "the short run" means, one input frozen while another moves. But it leaves an obvious question hanging. What if a firm has two dials?
Picture a bottling plant on the Harbor Falls waterfront, filling juice bottles for the region's orchards. Unlike Amara's oven, its capital is not stuck at one unit — it can rent bottling-machine time by the hour from a shared industrial kitchen, just as it hires labor by the hour. To fill a thousand bottles a day, the plant could run two machines hard with a skeleton crew, or run one machine gently with a much larger crew standing at the conveyor. Both are technically capable of producing exactly the same thousand bottles. They are not equally expensive.
That is the whole subject of this topic in one sentence: there are many technically valid ways to make a given quantity of output, and exactly one of them costs the least. Costs of Production built an entire apparatus — , , the U-shaped average cost curve — on top of a function that was simply handed over, already optimized, without ever showing the optimizing. This topic goes underneath it and does that optimization in the open. And the tool for doing it is not new. Two topics ago, Consumer Choice and Utility Maximization solved a person's problem — maximize subject to a budget — with a budget line, an indifference map, and a Lagrangian. Watch closely, because the firm's problem is that exact structure with the labels swapped: an isocost line in place of the budget line, an isoquant map in place of the indifference map, and the identical multiplier trick underneath. The mathematics does not know which problem it is solving.
Two inputs, one output: the production function and its isoquants
Write for machine-hours rented per day and for labor-hours hired per day. The production function describes every combination of the two that yields a given output, and for the bottling plant, take
Fix a target, say . What pairs produce exactly 40 bottling-batches a day? Solving gives , a hyperbola in the plane: works, so does , so does , so does . This level set — every input combination yielding the same output — is called an isoquant, and it is the exact production-side counterpart of an indifference curve. Just as every bundle on one of Nadia's indifference curves delivered the same utility, every point on the isoquant delivers the same forty batches. Higher isoquants (larger ) sit further from the origin, the same way higher indifference curves represented more utility.
The slope of an isoquant deserves to be derived, not assumed, using exactly the technique Consumer Choice used on indifference curves. Take the defining equation of one isoquant,
and totally differentiate both sides. The right side is a constant, so its differential is zero:
Solve for the slope:
The marginal rate of technical substitution is the magnitude of that slope:
Read it exactly the way was read for a consumer, with "technology" in place of "taste": is how many units of capital the firm could give up for one more unit of labor while producing exactly the same output. It is not a preference — nobody at the bottling plant likes labor more than capital — it is a fact about the machinery, and it is every bit as real a number as was.
For , the partials are and , so
Evaluate it along the isoquant, where , so :
falls steadily moving right — diminishing , the production-side twin of diminishing . With ten labor-hours and a hundred sixty machine-hours, one more hour of labor is worth sixteen hours of machine time; with a hundred sixty labor-hours and only ten machine-hours, one more labor-hour is worth barely a sixteenth of a machine-hour. Whichever input is scarce is the one that matters at the margin, on the technology side exactly as on the preference side. And the same second-derivative argument applies: has , so the isoquant is convex, bowed toward the origin, for the identical reason an indifference curve was — a curve lying above its own chords, meaning any combination of two equally productive input mixes is at least as productive as either extreme.
The isocost line and cost minimization
Input prices are per labor-hour and per machine-hour. The set of input bundles the firm can buy for a given total outlay is bounded by the isocost line,
with slope — the market's rate of exchange between labor and capital, exactly as was the market's rate of exchange between two goods. This is the budget line's mirror image: same algebra, an outlay in place of income, input prices in place of goods prices.
Cost minimization is the constrained-optimization problem run in reverse. A consumer maximized subject to a fixed budget; a firm minimizes cost subject to a fixed output:
Geometrically the logic is identical to the consumer's tangency argument, just with the roles of objective and constraint swapped: the cheapest point on a given isoquant is the one where no cheaper isocost line still touches it, which happens exactly where the isocost line is tangent to the isoquant rather than crossing it. Formally, form the Lagrangian
and set the partials to zero:
The first two give and . Divide them:
which is the geometric tangency condition, recovered by algebra. Rearrange instead by dividing each marginal product by its own price:
Say this one in words, because it is the entire idea: the last dollar spent on each input must buy the same extra output. If a dollar of labor bought more output than a dollar of capital, the firm could shift a dollar from capital to labor, hold output fixed, and spend less overall — exactly the arbitrage argument Consumer Choice ran on versus . Utility became output, prices of goods became prices of inputs, and not one step of the logic needed to change.
Solve it for the bottling plant. With and , tangency requires , so at every cost-minimizing point regardless of the target output — a fact worth pausing on, since it means the ratio of inputs the firm buys does not depend on how much it is making, only on the price ratio. Substitute into the production function:
At : , . Check the tangency directly: . ✓ And check the constraint: . ✓
Conditional factor demands and the cost function, in full
and — input demand as a function of prices and the output target, holding cost minimization fixed — are called conditional factor demands, "conditional" because they answer "cheapest way to hit this output" rather than "how much should the firm produce." Do the general Cobb-Douglas case, , because the specific bottling-plant numbers above are the case , and the general result is what actually explains where comes from.
Take logs of the constraint — legitimate because is strictly increasing, so it does not change which bundles satisfy , only how the equation is written:
(This is the identical trick Consumer Choice used, just applied to the other half of the problem. There, the objective was Cobb-Douglas and the constraint was linear, so logging the objective simplified things. Here the cost objective is already linear and the constraint is Cobb-Douglas, so logging the constraint is the move — same trick, mirrored across the problem.) The Lagrangian is
with first-order conditions
Substitute both into the logged constraint:
and solving for :
with the conditional factor demands falling out immediately as and , and total cost as
This is the payoff the whole topic has been aiming at: a cost function derived, not assumed, built entirely out of the production technology and the two input prices. Verify it reduces to the bottling-plant numbers found geometrically above. With , so :
At , , : . Then , , . All three match the direct calculation exactly. ✓ And since here, is linear in : cost per unit is the constant dollars regardless of scale — so for every output. That flat marginal-equals-average cost is not a coincidence of arithmetic; the next section shows exactly which feature of the technology produces it.
One more structural fact is worth isolating before moving on, because it is the input-side twin of a result Consumer Choice found on the demand side. From and : and , so
constant expenditure shares on inputs, fixed by the exponents alone and independent of , , and — exactly the constant-expenditure-share result Cobb-Douglas utility produced for a consumer's spending on goods, now showing up on a firm's spending on inputs. It is the same functional form doing the same thing on both sides of the same market.
Returns to scale and the shape of long-run average cost
The bottling plant's technology, , has . Scale both inputs by a factor : . So is exactly the answer to "if I double every input, what happens to output?" — increasing returns to scale if (output more than doubles), constant returns if (output exactly doubles), decreasing returns if (output less than doubles).
And shows up again, immediately, in the cost function: from the boxed formula, , so long-run average cost is
The exponent's sign is entirely controlled by versus . Constant returns () give exponent zero — a flat , exactly what the bottling plant showed above. Increasing returns () give a negative exponent — falls as grows, without bound. Decreasing returns give a positive exponent and a rising .
That falling case is worth seeing in numbers, because it is the textbook condition for a natural monopoly: if bigger is always cheaper per unit, the single firm that gets there first can underprice any rival forever, and splitting the market between two producers is strictly wasteful. Take a technology with (so , increasing returns) and, to keep the arithmetic clean, equal input prices . Tangency gives , so , and the constraint becomes , so . Choosing makes this an exact integer, , with cost and
Average cost keeps falling as the operation grows, with no floor — precisely because doubling both inputs more than doubles output, so the same proportional increase in spending buys a disproportionately larger increase in output.
Now connect this back to where the whole track's cost apparatus started. Costs of Production found long-run average cost for Amara's bakery by an entirely different route — no isoquants, no Lagrangian, just replicating identical fixed-size ovens and counting — and landed on a perfectly flat $10-per-loaf curve. That flatness was not a coincidence of the bakery's particular numbers; it was constant returns to scale, arrived at by a replication argument instead of the condition derived here. Two completely different techniques — one counting physical ovens, one differentiating a Cobb-Douglas Lagrangian — landing on the identical shape of curve, because they are describing the identical economic fact from two directions.
Shephard's lemma: differentiating cost to get quantity
Here is a genuinely strange-looking claim, worth stating before it is proven so the proof has something to surprise you: differentiate the cost function with respect to an input's price, and what falls out is not a cost at all — it is a quantity, the conditional demand for that very input.
This is Shephard's lemma, and it deserves the envelope-theorem argument rather than a citation. Write cost at the optimum as , and differentiate the whole right side with respect to , product rule and all — remembering that and are themselves functions of :
The claim is that the last two terms cancel each other exactly. Here is why. The optimal bundle sits on the target isoquant for every value of , so holds identically — differentiate both sides with respect to :
Now bring in the first-order conditions from cost minimization, and (where is the multiplier on the original, non-logged constraint — it is the shadow price of relaxing that constraint, which is exactly marginal cost, ). Substitute:
which is precisely the pair of terms that needed to vanish. What makes them vanish is not an accident of algebra — it is that at a cost-minimizing point, a first-order change in how the firm buys costs nothing at the margin, because the firm was already choosing that mix optimally. Only the direct effect of on the wage bill survives, leaving .
Check it on the bottling plant. , so
At , , : — and computed directly, earlier, was also . ✓ Differentiating a dollar figure with respect to another dollar figure produced a headcount, and it was the right headcount.
Short run versus long run: the envelope
Every conditional factor demand above assumed both and are free to adjust. In the short run, capital is stuck — leased, installed, not renegotiable before next quarter — at whatever level the firm committed to. Producing then means finding whatever makes , with no freedom to also move , so short-run cost is cost minimization with one fewer degree of freedom:
with equality only at the one output for which happens to equal the true optimum . Off that output, the firm is stuck paying for either too much or too little capital relative to what it would freely choose, so it can only be worse off — it is minimizing over a smaller choice set than the long run allows, and a constrained minimum can never beat an unconstrained one over the same objective.
Suppose the bottling plant commits to machine-hours a day — the capital level that was exactly optimal for . For any other output, solve for , giving
At : , matching the long-run exactly — equality, as it must be, since is . At , off that output: , while the long-run minimum is . The plant pays 100 dollars a day more than it would if it could also resize its machine fleet — the cost of being stuck at yesterday's capital plan.
The relationship is not just equal levels at ; it is a genuine tangency. Differentiate: , so , and the long-run at every output (constant returns, flat curve). Same slope, same level, at exactly — the short-run curve touches the long-run curve there and lies strictly above it everywhere else. Run this same construction for every possible — one short-run curve per capital commitment, each one minimized at the output for which that particular happens to be optimal — and the long-run average cost curve is the lower envelope of all of them, not a curve drawn separately and asserted to sit underneath, but the literal boundary traced by the best available short-run plan at every output. When the technology has constant returns, as here, that envelope degenerates to a flat line, and every short-run -shaped curve dips down to kiss it and rises away again — which is exactly the shape Costs of Production drew, from the ovens-and-replication side, when its own long-run curve sat flat at $10 while each individual oven's short-run was a proper .
Worked example
Ridgeline Furniture Co. builds chairs with , where is machine-hours and is carpenter-hours. Machine time rents for dollars an hour and carpenters earn dollars an hour. (a) Derive the conditional factor demands from the Lagrangian for a target output of chairs. (b) Find the cost function and the cost of producing 32 chairs. (c) Verify Shephard's lemma directly: hold and fixed, treat as a function of alone, and check that equals . (d) The shop's machine capacity is fixed at this quarter — a lease it cannot unwind. Find the short-run cost of building 40 chairs, compare it to the long-run cost of 40 chairs, and confirm the short-run cost curve is tangent to the long-run curve at . (click to reveal the solution)
Setting up (a) — the Lagrangian. Here (the exponent on ) and (the exponent on ). Tangency requires
Substitute into the production function:
using . So and . At : and . Check: . ✓
Step (b) — the cost function. . At : dollars. Confirm against the general cost-share result: since , labor's share of cost should be and capital's should be . Check: , and . ✓ , and . ✓ Note also : constant returns to scale, so is exactly linear in and dollars a chair at every output — the same flat shape the bottling plant produced, now from asymmetric exponents.
Step (c) — Shephard's lemma. Hold , fixed and write cost purely as a function of . Redo the tangency ratio symbolically: , so . Substituting into , so . Then
Check at : . ✓ matches (b). Now differentiate:
At : . And from part (a) was exactly . ✓ Differentiating the cost function with respect to the wage handed back the exact headcount of carpenters, precisely as Shephard's lemma claims.
Step (d) — short run versus long run. With fixed (the level optimal for , from part (a)), solve for at : , so , giving . Short-run cost:
Long-run cost at , from the flat found in (b): dollars. So — the shop pays 13 dollars a day more than it would if it could also resize its machine fleet for 40 chairs, because is more capital than 40 chairs actually needs at the tangent ratio, forcing carpenters to work around underused machines.
Now confirm the tangency at , both level and slope. In general, with fixed, , so
At : , matching exactly — equality, as it must be. ✓ Differentiate: , so , exactly the constant long-run found in (b). ✓ Same level, same slope, at precisely the output the fixed capital was sized for — the defining signature of tangency between a short-run curve and the long-run envelope.
Where this leads
Start from a two-input production function, apply the same Lagrangian that solved a consumer's problem two topics ago, and everything Costs of Production took as given falls out with a derivation behind it: the tangency condition , conditional factor demands built in full on Cobb-Douglas, a cost function that explains where actually comes from, returns to scale mapping directly onto whether long-run average cost falls, sits flat, or rises, Shephard's lemma turning a cost derivative into a headcount, and a short-run cost curve proven — not drawn and asserted — to sit tangent to the long-run envelope at exactly one output. The bakery's flat $10 curve and the natural-monopoly case of ever-falling average cost are now the same equation, , evaluated at two different values of .
But notice everything this topic held fixed. and sat on the page as data throughout — numbers the firm reacts to, never numbers it explains. What happens to a firm's whole cost structure, and therefore to its position in Firms in Competitive Markets, when the wage it faces actually changes — a citywide raise, a new machine-rental market opening up two counties over? Shephard's lemma already contains half the answer, since it says exactly how conditional demand for each input responds to its own price, but nothing here has asked where and themselves settle.
That question turns out to be the same one left standing at the end of Consumer Choice. Both halves of every market in this track have now been solved — Nadia optimizing against prices she cannot move, this bottling plant optimizing against prices it cannot move — and both solutions treated their prices as arriving from outside, on a sign, unexplained. But every one of those prices is itself the outcome of some other market clearing: the labor market that sets is made of firms like this one demanding labor and people like Nadia supplying it, simultaneously. Solve every market at once, consumers and firms and all, and the prices stop being data and become unknowns to be found — along with two theorems about whether what comes out the other end is any good. That is General Equilibrium and the Welfare Theorems.