*Monday, February 14, 2022*

## Overview

Today we cover the third effect in the individual demand function: the (own) price effect, aka the **law of demand**: how changes in a good’s (own) price affect quantity demanded for that good.

We introduce the idea of (simplified, own-price) demand functions, inverse demand functions, and a demand curve. I will also show you examples of how we derive demand functions and curves.

The other major concept today is breaking apart the law of demand into two effects: the **(real) income effect**, and the **substitution effect**. We considering them conceptually and graphically. These can be a difficult concept for students to grasp.

## Readings

- Ch. 2.2, 5.3, in Goolsbee, Levitt, and Syverson, 2019

## Slides

Below, you can find the slides in two formats. Clicking the image will bring you to the html version of the slides in a new tab. Note while in going through the slides, you can type `h` to see a special list of viewing options, and type `o` for an outline view of all the slides.

The lower button will allow you to download a PDF version of the slides. I suggest printing the slides beforehand and using them to take additional notes in class (*not everything* is in the slides)!

## Assignments

## Problem Set 1 Due Wednesday February 16

Problem set 1 (on 1.1-1.4) is due by class time Wednesday February 16.

## Problem Set 2 Due Monday February 21

Problem set 2 (on classes 1.5-1.7) is due by class time on Monday, February 21.

## Interactive Examples

- Visualizing the Consumer’s Problem
- Visualizing Changes in the Consumer’s Problem
- Visualizing Demand Shifters

These are examples that I wrote in R/Shiny in the past, to visualize what it is we are looking at. As I find more time, I will update these and integrate them into our slides, but until then, I will just post links.

The first is a visual example of the static (one-time) Consumer’s problem. You can adjust things about the (Cobb-Douglas) utility function, income, and prices, and see how it would affect the graph and the optimum.

The second is a visual example of dynamic changes in the Consumer’s problem. The consumer starts at a pre-defined optimum. You can adjust any of the budget constraint parameters \((m, p_x, p_y)\), and see how it would affect a new optimum, which you can *compare* the the original optimum.

The third is a visual example of a hypothetical demand function for beer, with preference intensity, income, price of nachos (a complement), and price of wine (a substitute) as inputs to the function. Based on some pre-defined functions (in the background), you can change any of the inputs and see how it would affect the (inverse) demand function, expressed as a simple demand curve.

I hope some time to clean these up and make a few more, such as “Visualizing the Income and Substitution Effects” and “Estimating a Demand Function from Real World Data.”

# Appendix

## Example Demand Functions

The examples below show how we can take a utility function and derive a demand function.

### Perfect Substitutes

Recall that perfect substitutes have indifference curves that are straight lines (constant MRS), and have a utility function of: \[u(x,y)=w_1x+w_2y\]

Since both the budget constraint and the indifference curves are straight lines, we will not have a point of **tangency** between them, but a point(s) where the lines **intersect**.

There are three possible cases,

- if \(p_x>p_y\), the slope of the budget constraint is flatter than the slope of the indifference “curves.” The optimal bundle is spending
*all*income on good \(x\). - if \(p_x<p_y\), the slope of the budget constraint is steeper than the slope of the indifference “curves.” The optimal bundle is spending
*all*income on good \(y\). - if \(p_x=p_y\), the budget constraint and indifference “curves” are
*the same line*, so*any point*on the lines is optimal!

The first two cases are known as “**corner solutions**,” where a consumer chooses all of one good, and none of another. Note perfect substitutes are *not convex*, and violate the assumption that “averages are preferred to extremes.”

We can therefore write the **demand function for good x** (and similarly for y):

\[q_d^x = \begin{cases} \frac{m}{p_x} & \text{When } p_x < p_y\\ \text{any number between 0 and } \frac{m}{p_x} & \text{When } p_x=p_y\\ 0 & \text{When } p_x > p_y\\ \end{cases}\]

On the graph above, since \(p_x < p_y\), the optimal consumption bundle is to spend all income on \(x\) at (8,0), point A.

### Perfect Complements

Recall that perfect complements have indifference curves that are right angles, and have a utility function of: \[u(x,y)=\min \{w_1x,w_2y\}\]

The optimal choice must always be at the **corner** of the indifference “curves.”

The consumer is purchasing equal amounts of \(x\) and \(y\) in this example, no matter what the prices are of either, so \(x=y\). We must satisfy the budget constraint, that \(p_xx+p_yx=m\) (recall \(y=x\)). Solving this for \(x\) gives us the **demand function for good x**:

\[q_D^x=q_D^y=\frac{m}{p_x+p_y}\]

This should be intuitive: the consumer must always purchase equal amounts of \(x\) and \(y\), so it’s as if the consumer was spending all of their income on a single good \((x+y)\) that has a price of \((p_x+p_y)\).

## Cobb-Douglas

Now we come to a more realistic demand function. If a consumer has a Cobb-Douglas utility function^{1}
\[u(x,y)= a \ln x+ b \ln y\]

Then we are solving the following constrained optimization problem:

\[\max_{x,y} a \ln x + b \ln y\] \[\text{subject to } p_xx+p_yy=m\]

I will solve this using the Lagrangian method.^{2}

\[\mathbb{L}=a \: ln \: x + b \: ln \: y - \lambda(p_x x + p_y y - m)\]

The First Order Conditions are:

\[\begin{align*} \frac{\partial \mathbb{L}}{\partial x} = \frac{a}{x}-\lambda p_x &= 0\\ \frac{\partial \mathbb{L}}{\partial y} = \frac{b}{y}-\lambda p_y &= 0\\ \frac{\partial \mathbb{L}}{\partial \lambda} = p_xx+p_yy-m &= 0\\ \end{align*}\]

Rearranging the first two FOCs:

\[\begin{align*} a&=\lambda p_x x\\ b&=\lambda p_y y\\ \end{align*}\]

Adding them together:

\[\begin{align*} a+b&=\lambda(p_xx+p_yy)\\ a+b&=\lambda m\\ \end{align*}\]

Solving for \(\lambda\):

\[\lambda=\frac{a+b}{m}\]

Substitute this back into each of the first two FOCs and solve for \(x\) and \(y\), respectively, to get:

\[\begin{align*} x&=\frac{a}{a+b}\frac{m}{p_x}\\ y&=\frac{b}{a+b} \frac{m}{p_y}\\ \end{align*}\]

These are the **demand functions** for goods \(x\) and \(y\). One of the **convenient properties** of Cobb-Douglas preferences is that a consumer *spends a constant fraction of income* \((\frac{a}{a+b})\) *on good \(x\)*, and *the complement fraction* \((\frac{b}{a+b})\) *on good \(y\)*!^This becomes especially simple when the exponents \(a+b=1\), as in:

\[u(x,y)=x^ay^{(1-a)} \quad \quad \text{where 0 < a < 1}\]

So \(a\) and \(1-a\) are proportions of \(m\)!

For a constant value of \(p_x\), this is a linear function of \(m\). So doubling, tripling, etc. \(m\) will double, triple, etc. quantity demanded for \(x\). So the income expansion path is a straight line through the origin with a slope \(\frac{a}{p_x}\).

### EXAMPLE

Suppose a consumer has a utility function

\[u(x,y)=x^{0.5}y^{0.5}\]

and faces constraints of \(m=50\), \(p_a=10\), \(p_b=5\).

\[\max_{x,y} x^{0.5}y^{0.5}\] \[\text{subject to } 10x+5y=50\]

Write the Lagrangian (and taking logs of the objective function, for simplicity):

\[\mathbb{L} = 0.5 \: ln \: x+0.5 \: ln \: y-\lambda(10x+5y-50)\]

FOCs are:

\[\begin{align*} \frac{\partial \mathbb{L}}{\partial x} = \frac{0.5}{x}-10\lambda &= 0 \\ \frac{\partial \mathbb{L}}{\partial y} = \frac{0.5}{y}-5\lambda &= 0 \\ \frac{\partial \mathbb{L}}{\partial \lambda} = 10x+5y-50 &= 0\\ \end{align*}\]

Rearrange the first two FOCs:

\[\begin{align*} 0.5&=10 \lambda x\\ 0.5&=5 \lambda y\\ \end{align*}\]

Add then together, and solve for \(\lambda\):

\[\begin{align*} 1&=\lambda(10x+5y)\\ 1&=\lambda(50)\\ \frac{1}{50}&=\lambda\\ \end{align*}\]

Now substitute lambda into each of the first two FOCs, solving for \(x\) and \(y\), respectively:

\[\begin{align*} \frac{0.5}{x}&=10(\frac{1}{50})\\ 10x&=0.5(50)\\ x&=2.5\\ \end{align*}\]

\[\begin{align*} \frac{0.5}{y}&=5(\frac{1}{50})\\ 10x&=0.5(50)\\ y&=5\\ \end{align*}\]

This consumer buys 2.5 units of \(x\) at $10/each ($25) and 5 units of \(y\) at $5/each ($25), spending all $50.

Recall the utility function is

\[u(x, y)=\sqrt{xy}=x^{0.5}y^{0.5}\]

Note the Cobb-Douglas exponents on \(x\) and \(y\) are equal and sum to 1: \((a\) and \(1-a=0.5)\). So the consumer spends \(a=50\%\) of her income on \(x\), and \(1-a=50\%\) on \(y\).

To get the **demand functions** for \(x\) and \(y\), go back to the FOCs, and keep all budget constraint terms as variables \((p_x, p_y, m)\).

\[\begin{align*} \frac{\partial \mathbb{L}}{\partial x} = \frac{0.5}{x}-p_x\lambda &= 0 \\ \frac{\partial \mathbb{L}}{\partial y} = \frac{0.5}{y}-p_y\lambda &= 0 \\ \frac{\partial \mathbb{L}}{\partial \lambda} = p_xx+p_yy-m &= 0\\ \end{align*}\]

Rearrange the first two FOCs:

\[\begin{align*} 0.5&=p_x \lambda a\\ 0.5&=p_y \lambda y\\ \end{align*}\]

Add then together, and solve for \(\lambda\):

\[\begin{align*} 1&=\lambda(p_xx+p_yy)\\ 1&=\lambda(m)\\ \frac{1}{m}&=\lambda\\ \end{align*}\]

Substitute this back into each of the first two FOCs and solve for \(x\), and \(y\), respectively, to get:

\[\begin{align*} \frac{0.5}{x}-p_x\lambda&=0\\ \frac{0.5}{x}-p_x \left(\frac{1}{m}\right)&=0\\ \frac{0.5}{x}&=\frac{p_x}{m}\\ p_xx&=0.5m\\ x&=0.5\frac{m}{p_x}\\ \end{align*}\]

\[\begin{align*} \frac{0.5}{y}-p_y\lambda&=0\\ \frac{0.5}{y}-p_y \left(\frac{1}{m}\right)&=0\\ \frac{0.5}{y}&=\frac{p_y}{m}\\ p_yy&=0.5m\\ y&=0.5\frac{m}{p_y}\\ \end{align*}\]

These are the **demand functions** for \(x\) and for \(y\).^{3}

Note if we want to *graph* this, we need to find the **inverse demand function** by solving for \(p_x\):

\[\begin{align*} x&=0.5\frac{m}{p_x} \\ p_xx&=0.5m\\ p_x&=0.5\frac{m}{x} \\ \end{align*}\]

Now we can graph a demand function for a given amount of income. As income changes, the demand curve shifts. Here are two examples, one where \(m=20\) and another where \(m=40\):

## Marshallian Demand vs. Hicksian Demand

Graduate programs in economics focus on

A long story short: Hicksian demand isolates only substitution effect of a relative price change, whereas Marshallian demand contains both the substitution effect and real income effect.

Note: Natural logs are easier to work with, this function is equivalent to \(u(x,y)=x^ay^b\).↩︎

Note you could solve this by substitution. Use the definition of the optimum, that \(\frac{MU_x}{MU_y}=\frac{p_x}{p_y}\), plug in, and solving carefully for \(x\).↩︎

Note you can just take the rule learned above, that \(x=a\frac{m}{p_x}\) and \(y=b\frac{m}{p_y}\) and plug in \(a\) and \(b\).↩︎