· Sangyong · Economics · 10 min read
Shephard’s Lemma and Roy’s Identity
Two ways to understand consumer demand: utility maximization and expenditure minimization, and how Shephard’s Lemma and Roy’s Identity connect them.
1. The big picture: Two ways to understand consumer demand
Imagine a student deciding how much coffee and how many sandwiches to buy on campus. An economist wants to predict how the student responds when coffee becomes more expensive.
There are two complementary approaches.
Approach A: Utility maximization
The student has a fixed budget and chooses the best affordable combination of coffee and sandwiches.
Result: the Marshallian (ordinary) demand function.
Approach B: Expenditure minimization
The student wants to reach a particular satisfaction level and chooses the least expensive combination of coffee and sandwiches that achieves it.
Result: the Hicksian (compensated) demand function.
The two identities recover demand from two different functions:
- Shephard’s lemma: Differentiate the expenditure function to obtain Hicksian demand.
- Roy’s identity: Differentiate the indirect utility function to obtain Marshallian demand.
This is useful because economists can often derive or estimate these aggregate functions more easily than solving for every individual demand function directly.
2. The essential concepts students need to know
Before introducing the two identities, define four functions clearly.
| Function | Definition | Economic question |
|---|---|---|
| Marshallian demand | Quantity chosen to maximize utility at prices and income | What will I buy with my budget? |
| Hicksian demand | Quantity chosen to minimize spending while achieving target utility | What is the cheapest way to maintain my satisfaction? |
| Indirect utility | Maximum utility attainable at prices and income | How well off can I be with my budget? |
| Expenditure function | Minimum spending required to achieve utility at prices | How much money do I need to reach my target satisfaction? |
These functions are dual representations of the same underlying consumer preferences.
A useful classroom analogy is planning a vacation:
- Marshallian demand asks what vacation you choose given your budget.
- Indirect utility measures the best vacation experience attainable with that budget.
- Hicksian demand asks how to obtain a specified level of vacation enjoyment at minimum cost.
- The expenditure function tells you the minimum budget needed to achieve that experience.
With these concepts in place, we can introduce each identity.
3. Shephard’s lemma: How much does a price increase raise the cost of living?
3.1 Formal definition
Shephard’s lemma states that, under appropriate regularity conditions, the partial derivative of the expenditure function with respect to the price of good equals the Hicksian demand for that good:
Here:
- is the minimum expenditure needed to reach target utility .
- is the price of good .
- is the compensated quantity demanded of good .
The key intuition is that the marginal increase in the minimum cost of achieving a given standard of living equals the amount of the good consumed in the cost-minimizing bundle.
3.2 A real-life example: A student’s cost of living
Suppose a student consumes two goods:
- Coffee,
- Sandwiches,
The student’s preferences are represented by the utility function
Suppose the student wants to maintain a target utility level . The student can change the consumption mix when prices change, but must remain on the same indifference curve.
For this utility function, the expenditure function is
Applying Shephard’s lemma gives the compensated demand for coffee:
Notice that we have obtained a demand function by differentiating the expenditure function. We did not need to solve the cost-minimization problem again.
3.3 Numerical example for the classroom
Suppose:
- Coffee costs p_x=\4$ per unit.
- A sandwich costs p_y=\8$ per unit.
- The student initially buys 5 units of coffee and 2.5 units of sandwiches.
The initial utility level is
The student’s initial expenditure is
Now suppose the price of coffee rises from 8. What happens if the student wants to maintain the original utility level?
Using Shephard’s lemma, the new compensated coffee demand is
What students should notice
Before price increase 5 units Coffee consumption
After price increase 3.54 units Compensated coffee demand
The student buys less coffee and adjusts the consumption mix to maintain the same utility level. The minimum expenditure needed to maintain that utility rises from $40 to approximately $56.57.
Interpretation: The student needs an additional $16.57 to maintain the original standard of living after the coffee price increase.
The expenditure function at the new prices is
This is a useful illustration of how economists measure the cost of a price increase while holding the consumer’s welfare constant.
3.4 Why does the derivative give demand?
The intuition comes from a small price change. If the price of coffee rises by a small amount , the approximate increase in the minimum expenditure needed to maintain utility is
If the student needs 5 units of coffee in the cost-minimizing bundle, then a $0.10 increase in the coffee price raises the minimum cost by approximately
The derivative measures this marginal cost, holding the target utility fixed.
3.5 Real-world applications
Measuring inflation and cost-of-living changes
An economist can ask how much additional income a household needs to preserve its standard of living when food, housing, or transportation prices rise.
Evaluating a public transportation fare increase
If bus fares rise, Hicksian demand helps analyze how riders would adjust their travel choices while keeping their welfare at a specified level.
Evaluating energy-price shocks
Economists can calculate the extra expenditure households would require to maintain a given welfare level when electricity or heating prices rise.
4. Roy’s identity: Recovering consumer demand from indirect utility
4.1 Formal definition
Roy’s identity states that Marshallian demand for good can be recovered from the indirect utility function:
where:
- is the maximum attainable utility at prices and income .
- measures how maximum utility changes with the price of good , holding income fixed.
- measures how maximum utility changes with income, holding prices fixed.
- is Marshallian demand.
The negative sign appears because an increase in a good’s price generally reduces attainable utility, whereas an increase in income generally raises it.
4.2 A real-life example: A student with a fixed food budget
Return to the same student who consumes coffee and sandwiches:
Now suppose the student has a fixed food budget of dollars and chooses the bundle that maximizes utility.
The utility-maximization problem is
Solving this standard Cobb–Douglas problem gives the indirect utility function
This function tells us the highest utility the student can attain for any combination of prices and income.
Differentiate with respect to the coffee price:
Differentiate with respect to income:
Apply Roy’s identity:
\begin{aligned} x(p_x,p_y,m) &=-\frac{\partial v/\partial p_x} {\partial v/\partial m}\5pt] &=\boxed{\frac{m}{2p_x}}. \end{aligned} $$
We have recovered the ordinary demand function for coffee directly from indirect utility.
4.3 Numerical example: What happens when coffee becomes more expensive?
Assume the student has 4.
Roy’s identity implies that the student buys
units of coffee.
Now the coffee price doubles to 40.
Ordinary demand response
Coffee at $4 5 units Budget: $40
Coffee at $8 2.5 units Budget: $40
The student cannot afford to maintain the original utility level. Coffee consumption falls by half because its price doubles while income stays fixed.
4.4 The economic meaning of Roy’s identity
Roy’s identity compares two marginal effects measured in utility units:
- The utility loss associated with a higher coffee price.
- The utility gain associated with an additional dollar of income.
Their ratio tells us how many units of coffee the consumer would demand at the optimum.
For the student, the price of coffee changes the utility attainable with the budget. Roy’s identity translates that utility effect back into a quantity demanded.
4.5 Real-world applications
Predicting shopping behavior
If an economist has an estimated indirect utility function, Roy’s identity can recover predicted demand for groceries or other consumer goods.
Studying gasoline taxes
An economist can use a model of attainable utility to derive demand responses to fuel prices while accounting for consumers’ income.
Evaluating income-support policies
Indirect utility models help economists study how cash transfers or price changes affect household welfare and consumption choices.
5. The key difference: Shephard’s lemma versus Roy’s identity
This comparison is probably the most important slide in the lecture.
| Feature | Shephard’s lemma | Roy’s identity |
|---|---|---|
| Starting function | Expenditure | Indirect utility |
| Consumer’s problem | Minimize expenditure | Maximize utility |
| Demand recovered | Hicksian demand | Marshallian demand |
| Mathematical operation | One partial derivative | Ratio of two partial derivatives, with a minus sign |
| What is held fixed? | Utility | Income |
| Main economic question | What is the marginal cost of maintaining welfare? | What quantity does the consumer choose with a given budget? |
Why are the two demands different?
Return to the coffee example. Coffee doubles in price, from 8.
Compare the two predictions
Roy’s identity — fixed income 2.50 units The student still has only $40 and accepts a lower utility level.
Shephard’s lemma — fixed utility 3.54 units The student adjusts consumption to preserve the original utility level and receives whatever additional budget is needed.
The difference is not a contradiction. The two identities answer different economic questions.
- Marshallian demand includes both substitution and income effects of the price change.
- Hicksian demand isolates the substitution response by compensating the consumer to keep utility constant.
For this example, Hicksian demand is higher than Marshallian demand at the new coffee price because the compensated student has enough additional money to maintain the original utility level.
6. A deeper connection: The envelope theorem
For students who have studied constrained optimization, you can explain why these identities work without requiring them to memorize the formulas.
Shephard’s lemma
Consider the expenditure-minimization problem:
Let be the optimal consumption bundle. By the envelope theorem, when the price changes, the derivative of the minimized expenditure with respect to that price is the optimal quantity of good :
The envelope theorem lets us differentiate the optimized value function without differentiating the entire optimal choice function.
Roy’s identity
For utility maximization, the indirect utility function is
Let be the marginal utility of income at the optimum. The envelope theorem gives
Dividing these derivatives eliminates the marginal utility of income:
This is Roy’s identity. The teaching insight is that both identities are applications of the envelope theorem to different optimization problems.
7. A short classroom exercise
Use this as a five-minute discussion or an exit ticket.
Question 1
An economist wants to calculate how much additional money a household needs to maintain its current standard of living after rent increases. Which identity is most directly relevant?
Roy’s identity
Shephard’s lemma
The law of demand alone
Question 2
An economist has estimated an indirect utility function and wants to recover the consumer’s ordinary demand for gasoline. Which identity should be used?
Shephard’s lemma
Roy’s identity
The expenditure function alone
Check answers
8. Suggested lecture structure
For a 50–60 minute undergraduate class, I recommend this sequence:
- 5 minutes — Motivation: Start with the coffee-and-sandwich example and ask how a price increase changes consumer behavior.
- 10 minutes — Core definitions: Introduce Marshallian demand, Hicksian demand, indirect utility, and the expenditure function.
- 15 minutes — Shephard’s lemma: Derive the result and discuss cost-of-living measurement.
- 15 minutes — Roy’s identity: Derive the result and show how ordinary demand is recovered.
- 10 minutes — Comparison and applications: Discuss compensated versus uncompensated demand, followed by the classroom exercise.
9. Final takeaway for students
The two identities reveal a powerful principle in consumer theory:
- Shephard’s lemma tells us how minimum expenditure responds to prices, revealing compensated demand.
- Roy’s identity tells us how maximum attainable utility responds to prices and income, revealing ordinary demand.
Both allow economists to recover behavioral information from optimized value functions rather than having to solve the original choice problem repeatedly.
The broader lesson is that optimization, duality, and the envelope theorem provide tools for translating economic theory into practical measures of consumer behavior and welfare.