Sub topic 7
Deriving the rule with a first-order condition
The earlier chapters introduced marginal revenue (MR) and marginal cost (MC) and stated the rule MR = MC. This chapter derives the rule with calculus. It assumes you can differentiate polynomials and know that a smooth function has a zero slope at an interior maximum. It also assumes you know the definitions of total revenue, total cost and profit from the first chapters. The derivation shows exactly where the rule comes from and what it does not guarantee.
Setting up the optimisation problem
The firm chooses one variable, output Q. Everything else, including the demand curve and the cost function, is given.
- Total revenue is R(Q), the money received from selling Q units.
- Total cost is C(Q), the cost of producing Q units, including fixed cost.
- Profit is π(Q) = R(Q) − C(Q).
The firm's problem is to pick the Q that makes π(Q) as large as possible. The problem has a constraint, Q ≥ 0, because a firm cannot produce a negative quantity. For now, assume the best output is strictly positive. The edge case Q = 0 is covered near the end.
The first-order condition
If π is smooth and the best output Q is strictly positive, the slope of π at Q must be zero. If the slope were positive, a slightly larger Q would raise profit. If it were negative, a slightly smaller Q would raise profit. In either case Q* would not be the best output.
Differentiate profit term by term:
π′(Q) = R′(Q) − C′(Q)
By definition, R′(Q) is marginal revenue and C′(Q) is marginal cost. Setting π′(Q*) = 0 gives:
R′(Q) = C′(Q), that is, MR = MC
This is the first-order condition (FOC). It is a necessary condition for an interior maximum. The word "necessary" matters, and the section on edge cases returns to it.
Applying the condition to a concrete model
Use the same model as the chapter code. Inverse demand is P = a − bQ and cost is C = f + cQ + dQ². The parameters are a = 100, b = 2, f = 50, c = 20 and d = 1.
Revenue is price times quantity:
R(Q) = (a − bQ)Q = aQ − bQ²
Differentiate revenue and cost:
- MR = R′(Q) = a − 2bQ
- MC = C′(Q) = c + 2dQ
Set them equal and solve for Q:
a − 2bQ = c + 2dQ
a − c = (2b + 2d)Q
Q* = (a − c) / (2b + 2d)
With the numbers, Q = 80 / 6 = 13.33. The price comes from the demand curve, not from MR or MC: P = 100 − 2(13.33) = 73.33. At Q*, MR = 100 − 4(13.33) = 46.67 and MC = 20 + 2(13.33) = 46.67, so the two agree. Profit is 483.33.
You can reach the same answer by expanding profit first:
π(Q) = aQ − bQ² − f − cQ − dQ² = −(b + d)Q² + (a − c)Q − f
Then π′(Q) = −2(b + d)Q + (a − c). Setting this to zero gives the same Q*.
Checking the algebra numerically
A finite-difference slope should be near zero at Q* and have the right sign on each side.
a, b = 100, 2
f, c, d = 50, 20, 1
def profit(q):
return (a - b * q) * q - (f + c * q + d * q**2)
def slope(q, h=1e-3):
# central difference approximation of the derivative of profit
return (profit(q + h) - profit(q - h)) / (2 * h)
q_star = (a - c) / (2 * b + 2 * d)
print(round(q_star, 2))
# 13.33
print(abs(slope(q_star)) < 1e-6)
# True
print(slope(10) > 0, slope(16) < 0)
# True TrueBelow Q the slope is positive, so profit is still rising. Above Q it is negative, so profit is falling. That sign pattern is what makes Q* a peak and not just a flat point.
Fixed cost drops out of the condition
The constant f disappears when you differentiate. Fixed cost therefore does not change the profit-maximising output, because it does not change MC. It does change the level of profit, which is why the shutdown decision, covered in a later chapter, depends on it.
You can test this by changing f in the code above. Q* stays at 13.33, and profit moves one-for-one with f.
Where the price comes from
The FOC fixes quantity. The price is a second step, and the step depends on the market structure.
| Firm type | Revenue R(Q) | Marginal revenue | Price step |
|---|---|---|---|
| Price taker | P·Q with P fixed | MR = P | P is given, so MR = MC becomes P = MC |
| Firm with market power | P(Q)·Q | MR = P(Q) + Q·P′(Q) | Solve MR = MC for Q*, then P* = P(Q*) |
For the firm with market power, the product rule applies to R(Q) = P(Q)·Q. Because P′(Q) is negative on a downward-sloping demand curve, MR lies below P. In the linear case P′(Q) = −b, so MR = a − bQ − bQ = a − 2bQ. The slope of MR is twice the slope of demand, which is why the model above uses 2b.
For a price taker, P′(Q) = 0 from the firm's point of view, so MR = P. With P = 40, c = 20 and d = 1, the condition P = MC gives 40 = 20 + 2Q, so Q* = 10. The profit and shutdown check for that case appears in the later chapters.
A general solver, and what it does at the boundary
The formula for Q* can return a negative number. If a < c, the demand curve starts below the marginal cost of the first unit. The FOC then has no valid interior solution, and the constraint Q ≥ 0 binds.
def optimum(a, b, c, d, f):
# Interior solution of MR = MC, clipped at the Q >= 0 boundary
q = max(0.0, (a - c) / (2 * b + 2 * d))
p = a - b * q
profit = p * q - (f + c * q + d * q**2)
return q, p, profit
print([round(x, 2) for x in optimum(100, 2, 20, 1, 50)])
# [13.33, 73.33, 483.33]
print([round(x, 2) for x in optimum(15, 2, 20, 1, 50)])
# [0.0, 15.0, -50.0]In the second case the firm produces nothing and loses its fixed cost of 50. Whether it should stay in business at all is a different question, covered by the shutdown rule.
Edge cases and common errors
The FOC is a tool with limits. Keep these points in mind when you use it.
- It is necessary, not sufficient. A zero slope also occurs at a minimum or at a flat inflection point. A U-shaped profit function has a zero slope at its bottom. The second-order condition, in the next chapter, separates a peak from a trough.
- Several solutions can exist. With a non-convex cost function, MR = MC can hold at more than one output. Compare the profit at each candidate, and also at Q = 0.
- Corner solutions. If π′(0) < 0, profit falls from the first unit and the best choice is Q = 0, even though no point satisfies MR = MC.
- Non-smooth functions. If MR or MC has a kink or a jump, such as a step in marginal cost when a second machine is needed, the derivative does not exist at that point. The optimum can sit at the kink, where MR is just above MC on one side and just below on the other.
- The wrong derivative. The most frequent mistake is to use the demand curve as MR. With linear demand P = a − bQ, MR is a − 2bQ, not a − bQ. Differentiate revenue P·Q, not price.
- Average cost in place of marginal cost. Setting MR equal to average cost, or marginal revenue equal to average cost, gives a break-even point, not the profit maximum.
- Price from the wrong curve. After solving for Q*, substitute it into the demand curve. Substituting it into MR gives 46.67 in the example, which is not the price.
Summary of the derivation
- Profit is π(Q) = R(Q) − C(Q), and an interior maximum needs π′(Q*) = 0.
- Because π′ = R′ − C′, this is the same statement as MR = MC.
- Fixed cost has a zero derivative, so it does not affect Q*.
- Price is read from demand after Q* is found.
- The FOC needs a second-order check, and the boundary Q = 0 needs separate handling.
Exercise
A firm faces inverse demand P = 60 − Q and has cost C = 10 + 10Q + 0.5Q². (a) Find MR and MC. (b) Solve MR = MC for Q. (c) Find the price. (d) Explain why the fixed cost of 10 does not affect Q.
Show answer
(a) Revenue is (60 − Q)Q = 60Q − Q², so MR = 60 − 2Q. Cost has derivative MC = 10 + Q. (b) Set 60 − 2Q = 10 + Q, so 3Q = 50 and Q = 16.67. (c) P = 60 − 16.67 = 43.33 from the demand curve. (d) The derivative of a constant is zero, so the 10 does not appear in MC and does not change the solution of MR = MC. It only lowers the level of profit.
Exercise
A student says that for the demand curve P = 100 − 2Q, marginal revenue is 100 − 2Q, so the firm should set 100 − 2Q = MC. Find the error and give the correct MR.
Show answer
The student used the demand curve (price) as marginal revenue. Revenue is R(Q) = (100 − 2Q)Q = 100Q − 2Q², so MR = R′(Q) = 100 − 4Q. The slope of MR is twice the slope of demand because selling one more unit also lowers the price on all earlier units.
Exercise
Using the model P = a − bQ and C = f + cQ + dQ², with a = 15, b = 2, c = 20, d = 1 and f = 50, what does the formula Q* = (a − c)/(2b + 2d) give, and what output should the firm actually choose under the constraint Q ≥ 0?
Show answer
The formula gives (15 − 20)/6 = −0.83, which is negative and therefore not a feasible output. The slope of profit at Q = 0 is a − c = −5, which is negative, so profit falls from the first unit. The best choice under the constraint is the corner Q = 0, where profit is −50 (the fixed cost).