Having just spent too many hours on this, I’m posting it so I won’t forget it. Maybe it’ll save some other folks some time too.

I’ve learned that, up to a constant, consumer surplus is the integral of the demand function. That’s wrong. It’s negative the integral of the demand function. The reason has to do with the fact that what we call the demand function–that which translates price into quantity–is not what we draw on a graph. Thanks to Alfred Marshall, the custom is to draw the *inverse* demand function, with price on the vertical axis and quantity on the horizontal axis.

To show formally that consumer surplus is the negative of the integral of demand (or that demand is negative the derivative of consumer surplus), one can use the rule for integrating inverses. To do so, let

*Q*denote quantity and*P*denote price,*Q = D(P)*be the demand function,- and the equilibrium quantity and price be
*Q*and_{0}*P*, respectively._{0}

Then, consumer surplus (*CS*) is

where the first line is the definition of consumer surplus, the second follows from the rule of integrating inverses and the facts that *Q=D(P) *and* P=D ^{-1}(Q)*, and the third holds if

*PD(P)*is zero when

*P*is infinity.

This is important for the very reason I spent hours trying to find or work out the above explanation. If one is working with discrete choice models (logit, nested logit, conditional logit, etc.) and wishes to derive the expression for consumer surplus, one might do so by recalling two things:

- The functional form of consumer surplus is the log of the denominator of the discrete choice probability model, which is also the demand function. That is, consumer surplus has a log-sum of exponentials form.
- The derivative of consumer surplus is negative the demand function, i.e. the discrete choice model.

Recalling point 1 and not 2, which is what I did, one is tempted to put the wrong sign on consumer surplus. That leads to very incorrect (exactly backwards) results. One is tempted to scrutinize one’s code for bugs. But the problem isn’t the code, it’s Alfred Marshall’s graphing convention.

by steve on May 18th, 2010 at 19:28

Scott Sumner wrote an interesting bit on supply and demand issues a while back. He contended that it is one of the most misunderstood and incorrectly taught ideas in economics. IIRC, he suggested that it be taught only at the graduate level.

OT- Have you looked at or written on the issue of primary care docs vs specialist ratios? The ACA seems to recognize this as an issue, but makes a relatively small, IMO, effort to address it.

Steve

by Austin Frakt on May 18th, 2010 at 19:35

@steve – I vaguely recall reading some paper or another on the subtle aspects of supply and demand. I don’t think it was Sumner’s though.

No, I haven’t written about primary vs. specialist docs. I’m not likely to either. I wonder if it is something Aaron Carroll would tackle. I’ll ask him.

by steve on May 19th, 2010 at 11:58

Found the Sumner piece. Comments are good also.

http://www.themoneyillusion.com/?p=1993

Steve

by Joko on August 13th, 2010 at 04:16

Great simple article, thanks!!

In general, literature on discrete choice modeling does not derive their consumer surplus functions directly from the demand functions but from the utility maximization which gives a log-sum form but most often they omit the negative sign! The same log-sum form but with the correct sign (negative) is obtained actually by derivation from the demand function (using the inverse integrating as you’ve shown above)!