Sub topic 11
Consumer Surplus, Producer Surplus, and Deadweight Loss
Earlier chapters showed how demand and supply set an equilibrium price and quantity, and how price controls stop the market from clearing. This chapter attaches dollar values to those outcomes. You will measure who gains from trade, how much, and what a price control destroys.
It assumes you can read a price-quantity graph, find the area of a triangle or trapezoid, and solve linear equations. It reuses the running example Qd = 100 - 2P and Qs = -20 + 4P, with equilibrium at price 20 and quantity 60.
Willingness to pay and cost
A demand curve can be read in two directions. Reading quantity as a function of price tells you how much buyers purchase at a given price. Reading price as a function of quantity tells you what the marginal buyer is willing to pay for that unit. Solving Qd = 100 - 2P for P gives the inverse demand curve:
P = 50 - Q/2
The first unit is worth 50 to the most eager buyer. The 60th unit is worth 20. A buyer's willingness to pay is the most they would pay for a unit.
Supply works the same way. Solving Qs = -20 + 4P for P gives the inverse supply curve:
P = 5 + Q/4
The first unit costs a seller 5 to supply. The 60th costs 20. This marginal cost is the least a seller would accept for that unit.
At a single market price, every buyer whose willingness to pay is above the price buys, and every seller whose cost is below the price sells. Most of them get a better deal than their limit. The size of that better deal is the surplus.
Consumer and producer surplus
- Consumer surplus (CS) is willingness to pay minus the price paid, summed over all units bought. On the graph it is the area under the demand curve and above the price.
- Producer surplus (PS) is the price received minus marginal cost, summed over all units sold. It is the area above the supply curve and below the price.
Both curves are straight lines, so each surplus is a triangle. The demand curve starts at a price of 50 and the supply curve at 5.
- CS = 1/2 × 60 × (50 - 20) = 900
- PS = 1/2 × 60 × (20 - 5) = 450
- Total surplus = 900 + 450 = 1350
Total surplus and efficiency
Total surplus is CS plus PS. It measures the gain from trade, which is the value buyers get minus the cost of producing the goods.
The equilibrium quantity maximizes total surplus. Below 60 units, every unit not produced has a willingness to pay above its cost, so a mutually beneficial trade is missed. Above 60 units, every extra unit costs more to make than it is worth to the buyer, so surplus falls. Equilibrium is efficient in this sense: no reallocation of the same resources can raise the total.
Surplus is not profit. Producer surplus is revenue minus variable (marginal) cost and ignores fixed costs. Consumer surplus is a measure of benefit that never shows up as money in anyone's account.
Computing surplus in code
This function computes both surpluses and the deadweight loss for any price, using the linear forms Qd = a - bP and Qs = c + dP. It assumes the traded quantity is the smaller of Qd and Qs, which is the short side of the market. It also assumes the units are allocated to the buyers with the highest willingness to pay. The edge cases section returns to that assumption.
def welfare(a, b, c, d, price=None):
# Demand: Qd = a - b*P Supply: Qs = c + d*P
p_eq = (a - c) / (b + d)
q_eq = a - b * p_eq
if price is None:
price = p_eq
q = min(a - b * price, c + d * price) # short side trades
p_max = a / b # demand price at Q = 0
p_min = -c / d # supply price at Q = 0
wtp = (a - q) / b # willingness to pay of the last unit traded
cost = (q - c) / d # marginal cost of the last unit traded
cs = (p_max + wtp) / 2 * q - price * q
ps = price * q - (p_min + cost) / 2 * q
best = 0.5 * q_eq * (p_max - p_min) # total surplus at equilibrium
return q, cs, ps, best - (cs + ps)
for label, p in (("equilibrium", None), ("ceiling", 10), ("floor", 30)):
q, cs, ps, dwl = welfare(100, 2, -20, 4, p)
print(f"{label:12} Q={q:.0f} CS={cs:.0f} PS={ps:.0f} DWL={dwl:.0f}")It prints:
equilibrium Q=60 CS=900 PS=450 DWL=0
ceiling Q=20 CS=700 PS=50 DWL=600
floor Q=40 CS=400 PS=800 DWL=150Each surplus is a trapezoid, not a triangle, once the price is away from equilibrium. That is why the code averages the curve's starting price and the price at the last unit traded.
Deadweight loss from a price ceiling
A price ceiling of 10 is below the equilibrium price of 20, so it binds. At a price of 10, Qd = 80 and Qs = 20. The market is short by 60 units, but only 20 units are produced, so the quantity traded is 20.
At Q = 20, the inverse curves give a willingness to pay of 40 and a marginal cost of 10. Those 20 units are worth far more to buyers than they cost to make, and so are the next 40 units up to Q = 60. Those trades do not happen.
- CS (best case) = (50 + 40)/2 × 20 - 10 × 20 = 700
- PS = 1/2 × 20 × (10 - 5) = 50
- Total surplus = 750, compared with 1350 at equilibrium
The difference is the deadweight loss (DWL), the total surplus lost because mutually beneficial trades do not happen. It is a triangle with its base on the lost quantity (60 - 20 = 40) and its height equal to the gap between willingness to pay and cost at the traded quantity (40 - 10 = 30):
DWL = 1/2 × 40 × 30 = 600
Consumers who still get the good gain 200 (a lower price on 20 units), but they lose 400 of surplus on the units that are no longer traded, for a net change of -200. Producers lose 200 to the lower price and 200 on lost sales, for a net change of -400. The 200 that moves from producers to consumers is a transfer. The 400 + 200 = 600 that disappears is the deadweight loss.
Deadweight loss from a price floor
A price floor of 30 is above equilibrium, so it also binds. Qd = 40 and Qs = 100, so there is a surplus of 60 units. Buyers limit the trade, so Q = 40.
At Q = 40 the willingness to pay is 30 and the marginal cost is 15.
- CS = 1/2 × 40 × (50 - 30) = 400
- PS = (30 - 5 + 30 - 15)/2 × 40 = 800
- Total surplus = 1200
- DWL = 1/2 × (30 - 15) × (60 - 40) = 150
Producers gain from the higher price, so PS rises from 450 to 800. The loss falls on consumers, and the net effect is still negative. The floor's DWL is smaller than the ceiling's here because the supply curve is flatter near the traded quantity, so the quantity restriction (20 units) is smaller than the ceiling's (40 units).
| Scenario | Price | Quantity | CS | PS | Total | DWL |
|---|---|---|---|---|---|---|
| Equilibrium | 20 | 60 | 900 | 450 | 1350 | 0 |
| Ceiling at 10 | 10 | 20 | 700 | 50 | 750 | 600 |
| Floor at 30 | 30 | 40 | 400 | 800 | 1200 | 150 |
Edge cases and common errors
- Non-binding controls. A ceiling at or above 20 or a floor at or below 20 changes nothing. The code above gives the wrong answer there, because it treats any price you pass in as the actual price. Check that the control binds before using it.
- The rationing assumption. The ceiling result of CS = 700 is the best case. It assumes the 20 available units go to the 20 buyers who value them most. If rationing is by queueing or luck, some units go to buyers whose willingness to pay is below 40. In the worst case the units go to buyers with willingness to pay between 10 and 20, so CS falls to 100 and the total loss grows beyond 600. The DWL of 600 is therefore a lower bound for a ceiling.
- Wasted resources. Time spent in queues or searching for a scarce good is a real cost not counted above. It can push the true loss higher.
- Transfers are not losses. A rectangle of surplus that moves from one side to the other is a redistribution. Only the triangle of trades that no longer happen is deadweight loss.
- The triangle formula only works for straight lines. For curved demand or supply, integrate, or approximate with the trapezoid rule.
- Equal weights. Adding CS and PS treats a dollar of surplus to a buyer and a seller as equal. That is why efficiency and fairness are separate questions. A price control can be defended on fairness grounds even though it reduces total surplus.
Exercise
A market has Qd = 100 - 2P and Qs = -20 + 4P. A ceiling at P = 15 is imposed. Find the quantity traded, the best-case consumer surplus, the producer surplus, and the deadweight loss.
Show answer
At P = 15, Qd = 70 and Qs = 40, so Q = 40 (the supply side limits trade). The willingness to pay of the 40th unit is 50 - 40/2 = 30, and its marginal cost is 5 + 40/4 = 15. Best-case CS = (50 + 30)/2 × 40 - 15 × 40 = 1600 - 600 = 1000. PS = 1/2 × 40 × (15 - 5) = 200. Total surplus = 1200, so DWL = 1350 - 1200 = 150. Check with the triangle: 1/2 × (30 - 15) × (60 - 40) = 150.
Exercise
Why is the deadweight loss of the ceiling at 10 (600) larger than that of the floor at 30 (150), even though both are 10 away from the equilibrium price of 20?
Show answer
The two curves have different slopes. Supply rises at 1/4 per unit and demand falls at 1/2 per unit, so the same price distance removes more quantity on the supply side. Quantity drops from 60 to 20 under the ceiling, but only from 60 to 40 under the floor. DWL equals 1/2 × lost quantity × the gap between willingness to pay and cost at the traded quantity. Both the lost quantity (40 vs. 20) and the gap (30 vs. 15) are larger for the ceiling.