Duality graphic showing Roy's Identity formula and Shephard's Lemma formula with the dual relationship highlighted.

Roy’s Identity and Shephard’s Lemma: Recovering Demand from Utility and Cost

In 1947, René Roy published a paper in Econometrica showing that consumer demand could be recovered by differentiating an indirect utility function. Six years later, Ronald Shephard’s monograph Cost and Production Functions established the parallel result for the production side. The two identities solved the central problem of applied microeconomics: how to estimate behaviour without observing utility.

Roy’s Identity and Shephard’s Lemma are the two duality results that turned utility maximisation and cost minimisation into operational empirical tools. Roy’s Identity recovers Marshallian demand from the indirect utility function. Shephard’s Lemma recovers Hicksian demand from the expenditure function and conditional input demand from the cost function. The envelope theorem provides the unified logic; applications range from the Almost Ideal Demand System and the translog cost function to Berry‑Levinsohn‑Pakes discrete‑choice estimation, with policy uses in CPI weighting, productivity accounting, and CGE climate models.

What Roy’s Identity and Shephard’s Lemma Mean

Applied microeconomics faced a fundamental obstacle throughout the first half of the twentieth century. Economic theory models consumer choices as the result of utility maximisation. Utility, however, is unobservable. Researchers could not measure a household’s satisfaction with consuming bread and housing. They could observe market prices, total expenditure, and the quantities purchased. The gap between theoretical objects and observable data made empirical demand estimation theoretically incoherent unless strong, arbitrary functional forms were imposed.

Rene Roy provided the bridge. He demonstrated that if the researcher specifies the indirect utility function, which is the maximum utility achievable given observable prices and income, then the observable demand functions can be recovered simply by taking partial derivatives. No cardinal measurement of utility is required. The indirect utility function contains all the observable consequences of the underlying preferences.

Ronald Shephard extended this logic to production and to the dual of the consumer problem. On the consumer side, the expenditure function specifies the minimum spending needed to reach a given utility level at given prices. Shephard proved that differentiating this expenditure function with respect to prices yields the compensated demand functions directly. On the production side, differentiating the cost function with respect to input prices yields the conditional input demand functions. These results transformed applied economics. Researchers could specify flexible, theoretically consistent functional forms for the indirect utility or cost functions, estimate the parameters using observable data, and then derive the complete system of demand equations by differentiation. This framework is the foundation of modern applied demand analysis and productivity measurement.

Roy’s Identity and Shephard’s Lemma in Equations

The mathematical logic underlying both results relies on the envelope theorem. Consider the consumer’s utility maximisation problem. The direct utility function \( u(x) \) maps a consumption bundle \( x \in \mathbb{R}^L_+ \) to a real number. The consumer maximises utility subject to the budget constraint \( p \cdot x \leq w \), where \( p \) is the price vector and \( w \) is wealth.

The value function for this problem is the indirect utility function \( v(p, w) \).

$$ v(p, w) = \max_{x \geq 0} u(x) \quad \text{subject to} \quad p \cdot x \leq w $$

The dual problem is expenditure minimisation. The consumer seeks the minimum spending needed to achieve a target utility level \( u \).

$$ e(p, u) = \min_{x \geq 0} p \cdot x \quad \text{subject to} \quad u(x) \geq u $$

Deriving Roy’s Identity

Roy’s Identity states that the Marshallian demand for good \( \ell \) equals the negative ratio of the partial derivative of indirect utility with respect to the good’s price, divided by the partial derivative of indirect utility with respect to wealth. Under standard regularity conditions, which include continuous, locally non-satiated, and strictly increasing preferences, and a differentiable indirect utility function, the identity holds as follows.

$$ x_\ell(p, w) = -\frac{\partial v(p, w)/\partial p_\ell}{\partial v(p, w)/\partial w} $$

The proof follows from the envelope theorem. The Lagrangian for the utility maximisation problem is \( \mathcal{L} = u(x) + \lambda(w – p \cdot x) \). By the envelope theorem, the derivative of the value function \( v(p, w) \) with respect to wealth \( w \) is simply the Lagrange multiplier on the budget constraint, \( \lambda \). The derivative of \( v(p, w) \) with respect to price \( p_\ell \) is \( -\lambda x_\ell \). Dividing the price derivative by the wealth derivative yields \( -x_\ell \). Rearranging gives Roy’s Identity. This provides a mechanical procedure: estimate \( v(p, w) \), differentiate, and recover all Marshallian demand functions.

Deriving Shephard’s Lemma

Shephard’s Lemma operates on the expenditure function. It states that the Hicksian, or compensated, demand for good \( \ell \) is the partial derivative of the expenditure function with respect to its own price.

$$ h_\ell(p, u) = \frac{\partial e(p, u)}{\partial p_\ell} $$

The proof also uses the envelope theorem. The Lagrangian for the expenditure minimisation problem is \( \mathcal{L} = p \cdot x + \mu(u – u(x)) \). The derivative of the value function \( e(p, u) \) with respect to price \( p_\ell \) is the quantity of good \( \ell \) chosen at the optimum, \( x_\ell^* \). Since this optimum is the Hicksian demand, \( h_\ell(p, u) \), the result follows immediately. Differentiating the expenditure function with respect to any price yields the compensated demand for that good.

The Production-Side Analogue

On the production side, the firm minimises the cost of producing output \( y \) given input prices \( w \) and a production function \( f(z) \). The cost function is defined as:

$$ c(w, y) = \min_{z \geq 0} w \cdot z \quad \text{subject to} \quad f(z) \geq y $$

Applying the same envelope theorem logic, Shephard’s Lemma on the production side states that the conditional input demand for factor \( \ell \) is the partial derivative of the cost function with respect to the input price.

$$ z_\ell(w, y) = \frac{\partial c(w, y)}{\partial w_\ell} $$

This result is the workhorse of empirical production analysis. A researcher specifies a functional form for the cost function, estimates it using data on total costs, input prices, and output, and then differentiates to obtain the entire system of input demand equations.

The Slutsky Connection

Roy’s Identity and Shephard’s Lemma are dual partners connected by the Slutsky decomposition. The Slutsky equation breaks the total effect of a price change into a substitution effect and an income effect.

$$ \frac{\partial x_\ell(p, w)}{\partial p_k} = \frac{\partial h_\ell(p, u)}{\partial p_k} – x_k(p, w) \frac{\partial x_\ell(p, w)}{\partial w} $$

The left side is the Marshallian price response, recoverable via Roy’s Identity. The first term on the right is the Hicksian substitution effect, recoverable via Shephard’s Lemma. The second term is the income effect. Duality ensures that both approaches describe the same underlying behaviour.

A Cobb-Douglas Walkthrough

A standard Cobb-Douglas utility function illustrates the mechanics. Suppose \( u(x_1, x_2) = x_1^\alpha x_2^{1-\alpha} \) with \( \alpha \in (0, 1) \). Solving the utility maximisation problem yields the indirect utility function.

$$ v(p_1, p_2, w) = \frac{w}{p_1^\alpha p_2^{1-\alpha}} \cdot \alpha^\alpha (1-\alpha)^{1-\alpha} $$

Applying Roy’s Identity requires the partial derivatives. The derivative with respect to \( p_1 \) is \( -\alpha w p_1^{-\alpha-1} p_2^{-(1-\alpha)} \cdot \alpha^\alpha (1-\alpha)^{1-\alpha} \). The derivative with respect to \( w \) is \( p_1^{-\alpha} p_2^{-(1-\alpha)} \cdot \alpha^\alpha (1-\alpha)^{1-\alpha} \). Dividing the negative of the price derivative by the wealth derivative yields the Marshallian demand.

$$ x_1(p, w) = \frac{\alpha w}{p_1} $$

This matches the standard textbook Cobb-Douglas demand. The expenditure function is found by inverting the indirect utility function.

$$ e(p_1, p_2, u) = u \cdot \frac{p_1^\alpha p_2^{1-\alpha}}{\alpha^\alpha (1-\alpha)^{1-\alpha}} $$

Applying Shephard’s Lemma by differentiating with respect to \( p_1 \) yields the Hicksian demand.

$$ h_1(p, u) = \frac{\partial e}{\partial p_1} = \frac{\alpha u}{\alpha^\alpha (1-\alpha)^{1-\alpha}} \cdot \left(\frac{p_2}{p_1}\right)^{1-\alpha} $$

The Cobb-Douglas function verifies the duality cleanly. Both paths lead to consistent demand systems derived entirely from observable price and expenditure data.

Side-by-side diagrams of consumer utility maximisation leading to Roy's Identity and producer cost minimisation leading to Shephard's Lemma.
Utility maximisation and cost minimisation recover the same demand functions from different starting points via Roy’s Identity and Shephard’s Lemma.

Table 1. Roy’s Identity and Shephard’s Lemma: Symbols and Functions
Symbol Name Definition
\( u(x) \) Direct utility Utility from consumption bundle x
\( v(p, w) \) Indirect utility Max utility at prices p, wealth w
\( e(p, u) \) Expenditure function Min spending to reach utility u
\( x_\ell(p, w) \) Marshallian demand Demand at prices and wealth
\( h_\ell(p, u) \) Hicksian demand Compensated demand at fixed utility
\( c(w, y) \) Cost function Min cost to produce y at input prices w
\( z_\ell(w, y) \) Conditional input demand Cost-minimising input use
\( \varepsilon_{\ell k} \) Price elasticity \((\partial x_\ell / \partial p_k)(p_k / x_\ell)\)

When the Duality Breaks Down

Both duality results require specific mathematical and economic conditions to hold. Violating these conditions invalidates the simple derivative relationships.

The first assumption is that preferences are locally non-satiated and continuous. Local non-satiation ensures the budget constraint binds. Continuity guarantees that the maximised utility and minimised expenditure vary smoothly with parameters. The second assumption requires the indirect utility function to be differentiable in prices and wealth. Kinks in indifference curves, which occur with perfect complements or Leontief preferences, violate this differentiability. The third assumption demands a differentiable expenditure function in prices. The fourth condition requires interior solutions. When Hicksian demand sits at a corner, meaning consumption of a good is zero, Shephard’s Lemma yields a subdifferential, a set of subgradients, rather than a single unique demand value. The fifth assumption, specific to the production side, requires the cost function to be concave in input prices and continuous.

Aggregation poses a further limitation. Applying Roy’s Identity to a representative consumer is theoretically justified only under Gorman polar form preferences. This restriction means all individuals must have parallel Engel curves, a condition that allows exact aggregation of individual demands into a single aggregate demand function. If income effects vary non-linearly across households, the aggregate data will not satisfy the exact restrictions implied by the duality. Behavioural failures also complicate the application. Loss aversion, reference dependence, and other deviations from rational utility maximisation documented in behavioural economics violate the underlying optimisation assumption. If consumers do not maximise utility in the standard sense, the functions derived from Roy’s Identity will not reflect true structural preferences, making welfare analysis based on compensating variation invalid.

From Blackboard to Estimation: Three Workhorses

Three landmark empirical frameworks have operationalised these duality results, transforming them from theoretical curiosities into the standard tools of applied microeconomics.

The Almost Ideal Demand System, developed by Angus Deaton and John Muellbauer in their 1980 American Economic Review paper, is the most influential application of Shephard’s Lemma in consumer economics. They specified a flexible functional form for the expenditure function using PIGLOG preferences. The cost function takes the form \( \ln e(p, u) = \alpha_0 + \sum \alpha_i \ln p_i + \frac{1}{2} \sum \sum \gamma_{ij} \ln p_i \ln p_j + u \beta_0 \prod p_i^{\beta_i} \). Applying Shephard’s Lemma by differentiating the logarithm of this expenditure function with respect to the logarithm of prices yields the budget-share equations directly. \( w_i = \alpha_i + \sum \gamma_{ij} \ln p_j + \beta_i \ln(x/P) \). This system is linear in parameters, making it straightforward to estimate using household survey data. Deaton and Muellbauer estimated the system on UK and US data, and it became the workhorse of applied demand analysis because it satisfies the axioms of demand exactly while remaining flexible enough to approximate any arbitrary demand system.

The translog cost function, introduced by Laurits Christensen, Dale Jorgenson, and Lawrence Lau in their 1973 Review of Economics and Statistics paper, applied Shephard’s Lemma to the production side. They specified a second-order approximation to the log cost function. \( \ln c = \alpha_0 + \sum \alpha_i \ln w_i + \frac{1}{2} \sum \sum \beta_{ij} \ln w_i \ln w_j \). Differentiating with respect to input prices yields the cost-share equations. \( s_i = \alpha_i + \sum \beta_{ij} \ln w_j \). This framework allowed economists to estimate elasticities of substitution between capital, labour, energy, and materials in US manufacturing without imposing the restrictive unitary elasticity implied by the Cobb-Douglas function. Jorgenson and his co-authors estimated these systems using time-series data on US industries, revealing wide variation in substitution elasticities across sectors.

The Berry, Levinsohn, and Pakes, or BLP, framework, published in Econometrica in 1995, extended the duality logic to discrete-choice demand in differentiated-product markets. The core idea is that consumers choose the product yielding the highest indirect utility. The specification models the indirect utility that consumer \( i \) derives from product \( j \) as \( u_{ij} = x_j \beta_i – \alpha_i p_j + \xi_j + \epsilon_{ij} \). Aggregating individual choices yields market shares. Inverting this market-share relationship recovers the structural parameters and the unobserved product qualities \( \xi_j \). This is a Roy-style aggregation. The BLP method solved the long-standing problem of estimating own- and cross-price elasticities in markets with many differentiated products, applying it to the US automobile market from 1971 to 1990.

Three empirical applications (AIDS, translog cost, BLP) each derived from duality through Shephard's Lemma or Roy's Identity.
Duality results in three empirical workhorses: the Almost Ideal Demand System uses Shephard’s Lemma for budget shares, the translog cost function derives cost shares, and BLP demand applies Roy-style aggregation.

Estimated Own-Price Elasticities Across Demand Systems
Source: Deaton & Muellbauer (1980) AER; Jorgenson, Lau, Stoker (1980). Chart: MASEconomics.

How Roy’s Identity and Shephard’s Lemma Matter

The theoretical elegance of Roy’s Identity and Shephard’s Lemma would matter little if they remained confined to blackboard derivations. Their true significance lies in how they underpin the empirical models used by statistical agencies and governments worldwide.

In empirical demand estimation, the Almost Ideal Demand System is the standard workhorse for consumer-demand analysis at the US Bureau of Labor Statistics, the UK Office for National Statistics, and the OECD. CPI weights and household-spending elasticities used in welfare analysis come directly from Roy’s Identity applied to flexible indirect-utility specifications. When statistical agencies calculate the price elasticities needed to adjust consumption baskets for inflation measurement, they rely on demand systems derived via Shephard’s Lemma. Without these duality results, constructing theoretically consistent estimates of how households reallocate spending after price changes would be computationally infeasible. The AIDS model ensures that estimated demand functions respect adding-up, homogeneity, and symmetry restrictions, properties that are automatically satisfied when deriving demand from a consistent expenditure function.

In production and productivity studies, total-factor-productivity decompositions published in OECD productivity reports rely on Shephard’s Lemma applied to translog cost functions. The OECD STAN database and the EU KLEMS database use cost-share equations derived from Shephard’s Lemma to estimate sectoral substitution between capital, labour, and intermediate inputs. The World Input-Output Database incorporates these estimates to model global production networks. Shephard’s Lemma guarantees that the estimated input demands are consistent with cost minimisation. When researchers compute the Divisia index of total factor productivity growth, they use the cost shares as weights. These cost shares are precisely the output of Shephard’s Lemma applied to the translog. The entire edifice of empirical growth accounting, from Solow’s residual to modern multi-factor productivity measures, depends on this duality result to maintain theoretical coherence.

In modern policy applications, computable general equilibrium models used for climate-policy modelling rely on Shephard’s Lemma to compute input-substitution responses to carbon prices. Models like the OECD ENV-Linkages and the Stanford EPPA model specify nested CES or translog cost functions for energy-intensive sectors. When a carbon tax raises the effective price of fossil fuels, Shephard’s Lemma dictates how firms substitute toward renewable energy and capital. The magnitude of the economic damage from climate policy, and the design of optimal carbon prices, depends entirely on these substitution elasticities. Tax-incidence analysis, as formalised by Altig, Auerbach, Kotlikoff, Smetters, and Walliser (2001) in the American Economic Review, relies on Roy-style indirect-utility specifications to compute compensating variations from tax reforms. Welfare measurement of trade liberalisation in GTAP models follows the same logic. Input-output analysis provides the accounting framework; duality provides the behavioural response. Revealed preference theory provides the non-parametric bounds; the parametric models built on Roy and Shephard provide the point estimates needed for policy simulation.

MASEconomics Explains

4 economic concepts behind the demand duality

Indirect Utility
The maximum utility a consumer can achieve given market prices and their wealth. It is the value function of the utility maximisation problem and is observable through price and income data.
Expenditure Function
The minimum amount of money a consumer must spend at given prices to achieve a specific utility level. It is the dual of the indirect utility function.
Marshallian Demand
The quantity of a good a consumer purchases as a function of prices and wealth, holding utility flexible. It is derived from the indirect utility function via Roy’s Identity.
Hicksian Demand
The quantity of a good a consumer purchases as a function of prices and a fixed utility level, holding utility constant. It is derived from the expenditure function via Shephard’s Lemma.

These concepts are explored in depth across our educational articles library.

Explore the MASEconomics Blog

Conclusion

Roy’s Identity and Shephard’s Lemma are the two duality results that bridge unobservable utility and observable expenditure data. Roy’s Identity recovers Marshallian demand from the indirect utility function. Shephard’s Lemma recovers Hicksian demand from the expenditure function and conditional input demand from the cost function. The envelope theorem provides the unified mathematical logic behind both results. The Almost Ideal Demand System applied Shephard’s Lemma to PIGLOG preferences, creating the standard workhorse for consumer demand estimation at statistical agencies worldwide. The translog cost function applied Shephard’s Lemma to production, enabling flexible estimation of substitution elasticities in multi-factor productivity accounts. The BLP framework extended Roy-style aggregation to discrete-choice markets. Climate-policy modelling in CGE frameworks, tax-incidence analysis, and trade-welfare measurement all depend on these duality results to simulate behavioural responses to policy shocks.

Frequently Asked Questions

What is the difference between Roy’s Identity and Shephard’s Lemma?

Roy’s Identity recovers uncompensated (Marshallian) demand by differentiating the indirect utility function. Shephard’s Lemma recovers compensated (Hicksian) demand by differentiating the expenditure function. Roy operates on the primal utility maximisation problem; Shephard operates on the dual expenditure minimisation problem.

What is the mathematical intuition behind Roy’s Identity?

The intuition comes from the envelope theorem. A small increase in a good’s price lowers maximum utility proportionally to the quantity consumed, while a small increase in wealth raises maximum utility proportionally to the marginal utility of wealth. The ratio of these two effects isolates the quantity demanded.

Is Shephard’s Lemma used for consumers or producers?

Both. On the consumer side, it derives Hicksian demand from the expenditure function. On the producer side, the identical mathematical logic derives conditional input demand from the firm’s cost function.

What is the Almost Ideal Demand System (AIDS)?

AIDS is an empirical demand model introduced by Deaton and Muellbauer (1980). It specifies a flexible expenditure function and uses Shephard’s Lemma to derive budget-share equations that can be estimated linearly using observable price and expenditure data.

Thanks for reading! If you found this helpful, share it with friends and spread the knowledge. Happy learning with MASEconomics

Majid Ali Sanghro

Majid Ali Sanghro

Founder of MASEconomics. An economist specializing in monetary policy, inflation, and global economic trends – providing accessible analysis grounded in academic research.

More from MASEconomics →