• Why Consumer Surplus is Negative the Integral of the Demand Function

    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 Q0 and P0, respectively.

    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:

    1. 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.
    2. 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.

    Comments closed
    • 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 – 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.

    • Found the Sumner piece. Comments are good also.



    • 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)!