6.3 The envelope theorem
Consider, for example, a firm that can produce output with a single input using the production function f. The standard theory is that the firm chooses the amount x of the input to maximize its profit pf(x) − wx, where p is the price of output and w is the price of the input. Denote by x*(w, p) the optimal amount of the input when the prices are w and p. An economically interesting question is: how does the firm's maximal profit pf(x*(w, p)) − wx*(w, p) depend upon p?
We have already answered this question in an earlier example. To do so, we used the chain rule to differentiate pf(x*(w, p)) − wx*(w, p) with respect to p, yielding
That is, the fact that the value of the variable satisfies the firstorder condition allows us to dramatically simplify the expression for the derivative of the firm's maximal profit. On this page I describe results that generalize this observation to an arbitrary maximization problem.
Unconstrained problems
Consider the unconstrained maximization problem Example

Let n = 1, k = 2, and f(x, r) = x^{r1} − r_{2}x, where 0 < r_{1} < 1. This function is concave (look at its second derivative), and any solution of
max_{x} f(x, r) is positive, so a solution satisfies the firstorder condition r_{1}x^{r1−1} − r_{2} = 0. Thus x*(r) = (r_{1}/r_{2})^{1/(1 − r1)} is
the solution of the problem, so that the value function of f is
f*(r) = (x*(r))^{r1} − r_{2}x*(r) = (r_{1}/r_{2})^{r1/(1 − r1)} − r_{2}(r_{1}/r_{2})^{1/(1 − r1)}.
=  i=1 f'_{i}(x*(r), r)·(∂x_{i}*/∂r_{h})(r) 
Given the firstorder conditions, this expression simplifies to
f*_{h}'(r)  =  f'_{n+h}(x*(r), r) for h = 1, ..., k. 
 Proposition (Envelope theorem for an unconstrained maximization problem)

Let f be a function of n + k variables, let r be a kvector, and let the nvector x* be a maximizer of f(x, r). Assume that the partial derivative
f'_{n+h}(x*, r) (i.e. the partial derivative of f with respect to r_{h} at (x*, r)) exists. Define the function f* of k variables by
f*(r) = max_{x} f(x, r) for all r.If the partial derivative f*_{h}'(r) exists then
f*_{h}'(r) = f'_{n+h}(x*, r).
 Proof
 We have f(x*, r) = f*(r) and f(x*, s) ≤ f*(s) for all s. Put differently, f(x*, s) − f*(s) ≤ 0 for all s and f(x*, r) − f*(r) = 0. Thus r maximizes f(x*, s) − f*(s). Because the partial derivatives f'_{n+h}(x*, r) and f*_{h}'(r) exist, the partial derivative of f(x*, s) − f*(s) with respect to s_{h} at r exists, so that by a previous result we have f'_{n+h}(x*, r) − f*_{h}'(r) = 0.
The next two examples illustrate how the result simplifies the calculation of the derivatives of the value function.
 Example

Consider the problem studied at the start of this section, in which a firm can produce output, with price p, using a single input, with price w, according to the production function f. The firm's profit when it uses the amount x of the input is π(x, (w, p)) =
pf(x) − wx, and its maximal profit is
π*(w, p) = pf(x*(w, p)) − wx*(w, p) ,f(x*(w, p)).In particular, the derivative is positive: if the price of output increases, then the firm's maximal profit increases.Also by the envelope theorem the derivative of the firm's maximal profit with respect to w is
−x*(p, w).(This result is known as Hotelling's Lemma, after Harold Hotelling, 1895–1973.) In particular, this derivative is negative: if the price of the input increases, then the firm's maximal profit decreases.A consequence of Hotelling's Lemma is that we can easily find the firm's input demand function x* if we know the firm's profit function, even if we do not know the firm's production function: we have x*(p, w) = −π*_{w}'(p, w) for all (p, w), so we may obtain the input demand function by simply differentiating the profit function.
 Example

Consider the earlier example, in which f(x, r) = x^{r1} − r_{2}x, where 0 < r_{1} < 1. We found that the solution of the problem
max_{x} f(x, r)is given byx*(r) = (r_{1}/r_{2})^{1/(1 − r1)}.Thus by the envelope theorem, the derivative of the maximal value of f with respect to r_{1} is the derivative of f with respect to r_{1} evaluated at x*(r), namely(x*(r))^{r1}ln x*(r),or(r_{1}/r_{2})^{r1/(1 − r1)}ln (r_{1}/r_{2})^{1/(1 − r1)}.(If you have forgotten how to differentiate x^{r1} with respect to r_{1} (not with respect to x!), remind yourself of the rules.)
If you approach this problem directly, by calculating the value function explicitly and then differentiating it, rather than using the envelope theorem, you are faced with the task of differentiating
(x*(r))^{r1} − r_{2}x*(r) = (r_{1}/r_{2})^{r1/(1 − r1)} − r_{2}(r_{1}/r_{2})^{1/(1 − r1)}
Here is an example in which f has a unique maximizer, but this maximizer is not a differentiable function of r.
 Example

Define the function f of two variables by
f(x, r) = −(x − r)^{2} if r ≥ 0 −(x + r)^{2} if r < 0 . x*(r) = r. Thus the maximizer is not differentiable at r = 0. However, the partial derivative f'_{r}(x*(0), 0) exists (f(0, r) = −r^{2} for all r) andf*(r) = 0 for all r, so that the assumptions of the result are satisfied. The conclusion holds for r = 0, the point at which x* is not differentiable: f*'(0) = 0 and f'_{r}(0, 0) = 0.
Constrained problems
We may apply the same arguments to maximization problems with constraints. Consider the problemWe want to calculate the derivatives f*_{h}'(r) for h = 1, ..., k of the function f*. If x* is differentiable, then using the chain rule we have
=  i=1 f'_{i}(x*(r),r)·(∂x*_{i}/∂r_{h})(r) 
j=1λ_{j}(r)(∂g_{j}/∂x_{i})(x*(r), r)
= 
i=1[∑m j=1λ_{j}(r)(∂g_{j}/∂x_{i})(x*(r), r)] 
= 
j=1λ_{j}(r)[∑n i=1 (∂g_{j}/∂x_{i})(x*(r),r) 
i=1(∂g_{j}/∂x_{i})(x*(r), r)
=  j=1 λ_{j}(r)(∂g_{j}/∂r_{h})(x*(r), r) + 
L(x, λ, r)  =  f(x, r) −
∑m j=1λ_{j}g_{j}(x, r), 
 Proposition (Envelope theorem for constrained maximization problems)

Let f and g_{1}, ..., g_{m} be continuously differentiable functions of n + k variables, with m ≤ n. Suppose that for all values of the kvector r the problem
max_{x} f(x, r) subject to g_{j}(x, r) = 0 for j = 1, ..., m,where x is an nvector, has a unique solution, which is differentiable in r. Denote this solution
x*(r) and define the function f* of k variables byf*(r) = max_{x} f(x, r) subject to g_{j}(x, r) = 0 for j = 1, ..., m. (∂g_{j}/∂x_{i})(x*(r), r) is m. Define the function L byL(x, λ, r) = f(x, r) − ∑m for every (x, λ, r),
j=1λ_{j}g_{j}(x, r)f*_{h}'(r) = L'_{n+m+h}(x*(r), λ(r), r) for h = 1, ..., k,
 Example

Consider a utility maximization problem:
max_{x} u(x) subject to p·x = w.where x is a vector (a bundle of goods), p is the price vector, and w is the consumer's wealth (a number). Denote the solution of the problem by x*(p, w), and denote the value function by v, so thatv(p, w) = u(x*(p, w)) for every (p, w).The function v is known as the indirect utility function.
By the envelope theorem for constrained maximization problems we have
(∂v/∂p_{i})(p, w) = −λ*(p, w)x_{i}*(p, w)(since u does not depend independently on p or w) and(∂v/∂w)(p, w) = λ*(p, w).Thus(∂v/∂p_{i})(p, w) (∂v/∂w)(p, w) = −x_{i}*(p, w).