BETA
Note: These explanations are in the process of being adapted from my textbook.
I'm trying to make them each a "standalone" treatment of a concept, but there may still
be references to the narrative flow of the book that I have yet to remove.
This work is under development and has not yet been professionally edited.
If you catch a typo or error, or just have a suggestion, please submit a note here. Thanks!

# Demand Functions and Demand Curves

The process of consumer optimization subject to a (linear) budget constraint tells us what the utility-maximizing bundle is given specific prices and income (i.e., values of $p_1$, $p_2$, and $m$). For example, suppose you had to maximize the Cobb-Douglas utility function $$u(x_1,x_2) = x_1^{1 \over 2}x_2^{1 \over 2}$$ subject to a budget constraint with the equation $$2x_1 + x_2 = 12$$ Since the MRS for this utility function is $x_2/x_1$ and the price ratio is 2, you asserted that the optimum would be characterized by the tangency condition \begin{aligned} MRS &= {p_1 \over p_2}\\ {x_2 \over x_1} &= 2\\ x_2 &= 2x_1 \end{aligned} And you plugged that into the budget constraint to find the optimal choice: \begin{aligned} 2x_1 + 2x_1 &= 12\\ 4x_1 &= 12\\ x_1^\star &= 3\\ x_2^\star &= 2x_1^\star = 6 \end{aligned} This bundle is comprised of numbers: $$X^\star = (x_1^\star, x_2^\star) = (3,6)$$ A consumer’s demand function expresses their optimal choice as a function of prices and income. Therefore we’ll be interested in solving this problem, keeping $p_1$, $p_2$, and $m$ as variables. Therefore our tangency condition will set the MRS equal to the generic slope of the budget line, $p_1/p_2$: \begin{aligned} MRS &= {p_1 \over p_2}\\ {x_2 \over x_1} &= {p_1 \over p_2}\\ x_2 &= {p_1 \over p_2}x_1 \end{aligned} We’ll then plug this into the generic budget line, $p_1x_1 + p_2x_2 = m$: \begin{aligned} p_1x_1 + p_2\left[{p_1 \over p_2}x_1\right] &= m\\ p_1x_1 + p_1x_1 &= m\\ 2p_1x_1 &= m\\ x_1^\star(p_1,p_2,m) &= {m \over 2p_1}\\ x_2^\star(p_1,p_2,m) &= {p_1 \over p_2}x_1^\star(p_1,p_2,m) = {m \over 2p_2} \end{aligned} Note that if you then plug in $p_1 = 2$, $p_2 = 1$, and $m = 12$, you get the same bundle as before; but now we have a more general demand function expressing our optimal bundle $(x_1,x_2)$ as a function of the parameters of the model ($p_1$, $p_2$, and $m$): $$X^\star(p_1,p_2,m) = \left({m \over 2p_1}, {m \over 2p_2}\right)$$ In the diagram below you can see how this works. The left-hand graph shows a 3D rendering of the utility function; the “hill” represents the amount of utility at every bundle $(x_1,x_2)$. The budget line, in green, shows a path over the hill. The blue dot shows the highest point along the path.

The diagram on the right shows the projection of this onto plane: that is, the budget line and the indifference curve through the optimal bundle.

Try changing the prices and income. You can see that the hill does not change but the path over the hill does change, and therefore the highest point along the path changes:

This is one of the hardest concepts to grasp, especially because it seems like indifference curves “shift” as you change the budget line (and therefore the optimal point). Key to understanding this is that prices do not affect utility: changes in the prices do not affect the curvature of the hill, but only the location of the path over the hill. In economic terms, changes in prices or income don’t change your preferences; they change your feasible set.

## Demand Functions

In the above analysis, we solve for the optimal bundle as a function of prices and income: $$X^\star = (x_1^\star(p_1,p_2,m),x_2^\star(p_1,p_2,m))$$ When we’re discussing an individual consumer’s demand for a particular good, we generally write that demand function as something like $$d(p)$$ (Notation varies by textbook; this can also be written as $q^D(p)$, for example.)

When writing a demand function, we impose the ceteris paribus (Latin for “all else equal”) assumption: we are expressing the quantity demanded for a good as a function of its price, holding all other prices and the consumer’s income constant. Thus, in the context of a consumer splitting their income $m$ between goods 1 and 2, we can write the demand for good 1 as $$d_1(p_1\ |\ p_2, m)$$ which we may read as “the demand for good 1 $d_1$, as a function of its own price $p_1$, given the price of good 2 $p_2$ and consumer’s income $m$.”

Thus, in the above example, we have $$d_1(p_1\ |\ p_2,m) = {m \over 2p_1}$$ Note that we can also just as easily express the demand for good 2: $$d_2(p_2\ |\ p_1,m) = {m \over 2p_2}$$ In this text we will use both $x_1^\star(p_1,p_2,m)$ and $d_1(p_1\ |\ p_2,m)$ to describe the “demand for good 1.”

## Demand Curves

Having derived the demand functions, we can visualize them in different ways. The most important visualization of a demand function is a demand curve, which is fundamentally a way to understand how the quantity of one good — without loss of generality, good 1 — varies as its own price changes.

For historical reasons, economists plot demand curves with the quantity of the good on the horizontal axis, and its price on the vertical axis. This is a little counterintuitive, because most students are used to seeing the exogenous (independent) variable on the horizontal axis; so remember to follow the right convention in this course!

If we consider the demand functions above, we can see that the demand for good 1 when $p_2 = 2$ and $m = 12$ is given by $$d_1^\star(p_1\ |\ p_2 = 2,m = 12) = {m \over 2p_1} = {6 \over p_1}$$ We can write out a table for how much a consumer with this utility function would buy, as a function of the price of good 1:

$p_1$ $x_1^\star$
1 6
2 3
3 2
4 1.5
5 1.2
6 1

We can then plot each of these pairs in a graph with $x_1$ on the horizontal axis, and $p_1$ on the vertical axis. One helpful thing is to plot this below the corresponding indifference curve/budget line diagram, to see that each $x_1$ value is the same in each case:

When plotting a demand curve, the easiest way is often to choose a few prices and plot the quantity demanded at those prices. If you check the “Show $p_1 = 2, 4, 6$” box in the diagram above, it will add the three budget lines corresponding to those prices in the top diagram, and grid lines for those prices in the bottom graph. You can see that the horizontal coordinates of the optimal points subject to each of those budget lines correspond to the horizontal coordinates of the demand curve.

Copyright (c) Christopher Makler / econgraphs.org