2.2 The chain rule
Single variable
You should know the very important chain rule for functions of a single variable: if f and g are differentiable functions of a single variable and the function F is defined by F(x) = f(g(x)) for all x, thenF'(x) = f'(g(x))g'(x).
This rule may be used to find the derivative of any “function of a function”, as the following examples illustrate.
- Example 2.2.1
- What is the derivative of the function F defined by F(x) = ex1/2? If we define the functions f and g by f(z) = ez and g(x) = x1/2, then we have F(x) = f(g(x)) for all x. Thus using the chain rule, we have F'(x) = f'(g(x))g'(x) = eg(x)(1/2)x−1/2 = (1/2)ex1/2x−1/2.
- Example 2.2.2
- What is the derivative of the function F defined by F(x) = log x2? If we define the functions f and g by f(z) = log z and g(x) = x2, then we have F(x) = f(g(x)), so that by the chain rule we have F'(x) = f'(g(x))g'(x) = (1/x2)2x = 2/x.
More importantly for economic theory, the chain rule allows us to find the derivatives of expressions involving arbitrary functions of functions. Most situations in economics involve more than one variable, so we need to extend the rule to many variables.
Two variables
First consider the case of two variables. Suppose that g and h are differentiable functions of a single variable, f is a differentiable function of two variables, and the function F of a single variable is defined byF'(x) | = | f'1(g(x), h(x))g'(x) + f'2(g(x), h(x))h'(x), |
An extension
We can extend this rule. If f, g, and h are differentiable functions of two variables and the function F of two variables is defined byF(x, y) | = | f(g(x, y), h(x, y)) for all x and y |
F'x(x, y) | = | f'1(g(x, y), h(x, y))g'x(x, y) + f'2(g(x, y), h(x, y))h'x(x, y), |
More generally, we have the following result.
- Proposition 2.2.1 (Chain rule)
-
If gj is a differentiable function of m variables for j = 1, ..., n, f is a differentiable function of n variables, and the function F of m variables is defined by
F(x1, ..., xm) = f(g1(x1, ..., xm), ..., gn(x1, ..., xm)) for all (x1, ..., xm) F'k(x1, ..., xm) = ∑n
i=1f'i(g1(x1, ..., xm), ..., gn(x1, ..., xm))gi
k'(x1, ..., xm),
k' is the partial derivative of gi with respect to its kth argument.
- Source
- For a proof, see Rudin (1976), Theorem 9.15 (p. 214).
- Example 2.2.3
-
Consider a profit-maximizing firm that produces a single output with a single input. Denote its (differentiable) production function by f, the price of the input by w, and the price of the output by p. Suppose that its profit-maximizing input when the prices are w and p is z(w, p). Then its maximized
profit is
Π(w, p) = pf(z(w, p)) − wz(w, p).How does this profit change if p increases?
Using the chain rule we have
Π'p(w, p) = f(z(w, p)) + pf'(z(w, p))z'p(w, p) − wz'p(w, p) Π'p(w, p) = f(z(w, p)) + z'p(w, p)[pf'(z(w, p)) − w]. Π'p(w, p) = f(z(w, p)).In words, the rate of increase in the firm's maximized profit as the price of output increases is exactly equal to its optimal output.
- Example 2.2.4
-
A consumer trades in an economy in which there are n goods. She is endowed with the vector e of the goods, and faces the price vector p. Her demand for any good i depends on p and the value of her endowment given p, namely p·e (the inner product of p and e, which we may alternatively write as ∑n
j=1pjej). Suppose we specify her demand for good i by the function f of n + 1 variables with values of the form f(p, p·e). What is the rate of change of her demand for good i with respect to pi?The function f has n + 1 arguments—the n elements p1, ..., pn of the vector p and the number p·e. The derivative of pj with respect to pi is 0 for j ≠ i and 1 for j = i, and the derivative of p·e with respect to pi is ei. Thus by the chain rule, the rate of change of the consumer's demand with respect to pi is
f'i(p, p·e) + f'n+1(p, p·e)ei.
Leibniz's formula
We sometimes need to differentiate a definite integral with respect to a parameter that appears in the integrand and in the limits of the integral. Suppose that f is a differentiable function of two variables, a and b are differentiable functions of a single variable, and the function F is defined bya(t)f(t, x) dx for all t.
What is F'(t)? By the logic of the chain rule, it is the sum of three components:
- the partial derivative of the integral with respect to its top limit, times b'(t)
- the partial derivative of the integral with respect to its bottom limit, times a'(t)
- the partial derivative of the integral with respect to t, holding the limits fixed.
a(t)f'1(t, x) dx,
- Proposition 2.2.2 (Leibniz's formula)
-
Let f be a function of two variables, with values f(t, x). Assume that f is continuous, has a partial derivative with respect to t for all (t, x), and this partial derivative is
continuous. Let a and b be differentiable functions of a single variable, and define the function F of one variable by
F(t) = ∫b(t)Then F is differentiable and
a(t)f(t, x) dx for all t.F'(t) = f(t, b(t))b'(t) − f(t, a(t))a'(t) + ∫b(t)
a(t)f'1(t, x) dx.
- Proof
-
Define the function G of three variables by
G(u, v, t) = ∫vBy 8.11.2 (p. 177) of Dieudonné (1969), G has a partial derivative with respect to t and that derivative is continuous in t and equal to
uf(t, x) dx for all u, v, and t.This derivative is also continuous in u and v.∫v
uf'1(t, x) dx.Now, by the fundamental theorem of calculus, G has a partial derivative with respect to u and that derivative is equal to −f(t, u), and also G has a partial derivative with respect to v and that derivative is equal to f(t, v). Given that f is continuous, both of these partial derivatives are continuous, so by a previous result G is differentiable. Thus the chain rule implies the expression for F'(t) in the result. If the derivatives a' and b' are continuous, then F' is continuous, given the continuity of f and f'1.
- the part due to the change in b(t), namely f(t, b(t))b'(t)
- the part due to the change in a(t), namely −f(t, a(t))a'(t) (if a(t) increases then the integral decreases)
- the part due to the change in the values of f(t, x), namely ∫b(t)
a(t)f'1(t, x) dx.
- Example 2.2.5
-
The profit of a firm is h(τ) at each time τ from 0 to T. At time t the discounted value of future profit is
V(t) = ∫Twhere r is the discount rate. Find V'(t).
th(τ)e−r(τ−t)dτ,Use Leibniz's rule. Define a(t) = t, b(t) = T, and f(t, τ) = h(τ)e−r(τ−t). Then a'(t) = 1, b'(t) = 0, and f'1(t, τ) = h(τ)re−r(τ−t). Thus
V'(t) = −h(t)e−r(t−t) + ∫T
th(τ)re−r(τ−t)dτ= −h(t) + rV(t).