Mathematical methods for economic theory

Martin J. Osborne

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, then
F'(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
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
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 by
F(x) = f(g(x), h(x)) for all x.
What is F'(x) in terms of the derivatives of f, g, and h? The chain rule says that
F'(x)  =  f'1(g(x), h(x))g'(x) + f'2(g(x), h(x))h'(x),
where f'i is the partial derivative of f with respect to its ith argument. (This expression is sometimes referred to as the total derivative of F with respect to 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 by
F(x, y)  =  f(g(x, y), h(x, y)) for all x and y
then
F'x(xy)  =  f'1(g(xy), h(xy))g'x(xy) + f'2(g(xy), h(xy))h'x(xy),
and similarly for F'y(x, y).

More generally, we have the following result.

Proposition (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)
then F is differentiable and for k = 1, ..., m we have
F'k(x1, ..., xm)  =  n
i=1
f'i(g1(x1, ..., xm), ..., gn(x1, ..., xm))gi
k
'(x1, ..., xm),
where gi
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
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(wp). Then its maximized profit is
Π(wp) = pf(z(wp)) − wz(wp).
How does this profit change if p increases?

Using the chain rule we have

Π'p(wp)  =  f(z(wp)) + pf'(z(wp))z'p(wp) − wz'p(wp)
or
Π'p(wp)  =  f(z(wp)) + z'p(wp)[pf'(z(wp)) − w].
But we know that if z(wp) > 0 then pf'(z(wp)) − w = 0, which is the “first-order condition” for maximal profit. Thus if z(wp) > 0 then we have
Π'p(wp) = f(z(wp)).
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
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=1
pjej). Suppose we specify her demand for good i by the function f of n + 1 variables with values of the form f(pp·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(pp·e) + f'n+1(pp·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 by
F(t) = ∫b(t)
a(t)
f(txdx 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.
By the Fundamental Theorem of Calculus, the partial derivative of the integral with respect to its top limit is f(tb(t)), and the partial derivative of the integral with respect to its bottom limit is −f(ta(t)). As for the last term, you might correctly guess that under some assumptions about the differentiability of f it is
b(t)
a(t)
f't(txdx,
the integral of the partial derivative of the function. Here is a precise result, discovered by Gottfried Wilhelm von Leibniz (1646–1716).
Proposition (Leibniz's formula)  
Let f be a function of two variables, with values f(tx). Assume that f is continuous, has a partial derivative with respect to t for all (tx), 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)
a(t)
f(txdx for all t.
Then F is differentiable and
F'(t)  =  f(tb(t))b'(t) − f(ta(t))a'(t) + b(t)
a(t)
f'1(txdx.
If a and b are continuously differentiable then F' is continuous.
Proof  
Define the function G of three variables by
G(uvt) = ∫v
u
f(txdx for all u, v, and t.
By 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
v
u
f'1(txdx.
This derivative is also continuous in u and v.

Now, by the fundamental theorem of calculus, G has a partial derivative with respect to u and that derivative is equal to −f(tu), and also G has a partial derivative with respect to v and that derivative is equal to f(tv). 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.

As with other expressions obtained by the chain rule, we can interpret each of its parts. If t changes then the limits of the integral change, and the value of the function f changes at each point x. The change in the integral can thus be decomposed into three parts:
  • the part due to the change in b(t), namely f(tb(t))b'(t)
  • the part due to the change in a(t), namely −f(ta(t))a'(t) (if a(t) increases then the integral decreases)
  • the part due to the change in the values of f(tx), namely ∫b(t)
    a(t)
    f't(txdx.
Example
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) = ∫T
t
h(τ)er(τ−t)dτ,
where r is the discount rate. Find V'(t).

Use Leibniz's rule. Define a(t) = t, b(t) = T, and f(t, τ) = h(τ)er(τ−t). Then a'(t) = 1, b'(t) = 0, and f'1(t, τ) = h(τ)rer(τ−t). Thus

V'(t)  =  h(t)er(tt) + T
t
h(τ)rer(τ−t)dτ
 =  h(t) + rV(t).
The first term reflects the fact that the future is shortened when t increases and the second term reflects the fact that as time advances future profit at any given time is obtained sooner, and is thus worth more.