43
Lesson 23 (Sections 16.1–2) The Chain Rule Math 20 November 14, 2007 Announcements I Problem Set 9 assigned today. Due November 21. I There will be class November 21. I next OH: Today 1-3pm I Midterm II: 12/6, 7-8:30pm in Hall A.

Lesson 23: The Chain Rule

Embed Size (px)

DESCRIPTION

The Chain Rule allows us to take derivatives of compositions of functions of several variables

Citation preview

Page 1: Lesson 23: The Chain Rule

Lesson 23 (Sections 16.1–2)The Chain Rule

Math 20

November 14, 2007

Announcements

I Problem Set 9 assigned today. Due November 21.

I There will be class November 21.

I next OH: Today 1-3pm

I Midterm II: 12/6, 7-8:30pm in Hall A.

Page 2: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 3: Lesson 23: The Chain Rule

HW problem 15.7.2

Recall that a discriminating monopolist can choose theprice/quantity sold in two markets.

P1 = a1 − b1Q1 P2 = a2 − b2Q2

Suppose cost increases constantly with quantity: C = α(Q1 + Q2).The profit is therefore

π = P1Q1 + P2Q2 − α(Q1 + Q2)

= (a1 − b1Q1)Q1 + (a2 − b2Q2)Q2 − α(Q1 + Q2)

= (a1 − α)Q1 − b1Q21 + (a2 − α)Q2 − b2Q2

2

Page 4: Lesson 23: The Chain Rule

Solution

Completing the square gives

π = (a1 − α)Q1 − b1Q21 + (a2 − α)Q2 − b2Q2

2

= −b1

(Q1 −

(a1 − α)

2b1

)2

+(a1 − α)2

4b1

− b2

(Q2 −

(a2 − α)

2b2

)2

+(a2 − α)2

4b2

The optimal quantities are

Q∗1 =a1 − α

2b1Q∗2 =

a2 − α

2b2

Page 5: Lesson 23: The Chain Rule

The corresponding prices are

P∗1,d =a1 + α

2P∗2,d =

a2 + α

2

The maximum profit is

π∗d =(a1 − α)2

4b1+

(a2 − α)2

4b2

Page 6: Lesson 23: The Chain Rule

The Indiscriminating Monopolist

An indiscriminating monopolist can only set one price each each“area”: So

P = a1 − b1 = a2 − b2Q2.

This means we can get Q1 and Q2, and therefore π, all in terms ofP:

Q1 =a1 − P

b1Q2 =

a2 − P

b2

π(P) = P(Q1 + Q2) − α(Q1 + Q2)

= P

(a1 − P

b1+

a2 − P

b2

)− α

(a1 − P

b1+

a2 − P

b2

)=

(a1 + α

b1+

a2 + α

b2

)P −

(1

b1+

1

b2

)P2 − αa1

b1− αa2

b2

Page 7: Lesson 23: The Chain Rule

Complete the square in P now and we get

P∗i =a1+α

b1+ a2+α

b2

2(

1b1

+ 1b2

) =b2

b1 + b2P∗1,d +

b1

b1 + b2P∗2,d

π∗i =

(a1+α

b1+ a2+α

b2

)2

4(

1b1

+ 1b2

) − αa1

b1− αa2

b2

Subtract and do some algebra:

π∗d − π∗i =(a1 − a2) 2

4 (b1 + b2)> 0

Page 8: Lesson 23: The Chain Rule

Complete the square in P now and we get

P∗i =a1+α

b1+ a2+α

b2

2(

1b1

+ 1b2

) =b2

b1 + b2P∗1,d +

b1

b1 + b2P∗2,d

π∗i =

(a1+α

b1+ a2+α

b2

)2

4(

1b1

+ 1b2

) − αa1

b1− αa2

b2

Subtract and do some algebra:

π∗d − π∗i =(a1 − a2) 2

4 (b1 + b2)> 0

Page 9: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 10: Lesson 23: The Chain Rule

Optimization of functions of several variables

I Last week: algebraic optimizationI Critical values of quadratic forms

I This week: more differentiationI Chain RuleI Implicit differentiation

I Next week: unconstrained optimizationI Approximate functions “to second order” and use rules for

quadratic forms

I Following week: constrained optimization

Page 11: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 12: Lesson 23: The Chain Rule

The Chain Rule in one variableSee Section 5.2 for more

(f ◦ g)′(x) = f ′(g(x)) · g ′(x)

Or, if y = f (u) and u = f (x), then

dy

dx=

dy

du

du

dx

A goal for today is the chain rule in several variables.

Page 13: Lesson 23: The Chain Rule

The Chain Rule in one variableSee Section 5.2 for more

(f ◦ g)′(x) = f ′(g(x)) · g ′(x)

Or, if y = f (u) and u = f (x), then

dy

dx=

dy

du

du

dx

A goal for today is the chain rule in several variables.

Page 14: Lesson 23: The Chain Rule

The Chain Rule in one variableSee Section 5.2 for more

(f ◦ g)′(x) = f ′(g(x)) · g ′(x)

Or, if y = f (u) and u = f (x), then

dy

dx=

dy

du

du

dx

A goal for today is the chain rule in several variables.

Page 15: Lesson 23: The Chain Rule

Example

Let z = xy2, and suppose x and y are given as functions of t:

x = t3 y = sin t

Find dzdt .

Solutionz = t3 sin2 t, so

dz

dt= 3t2︸︷︷︸

dxdt

sin2 t︸ ︷︷ ︸y2

+ t3︸︷︷︸x

2 sin t cos t︸ ︷︷ ︸dydt

Page 16: Lesson 23: The Chain Rule

Example

Let z = xy2, and suppose x and y are given as functions of t:

x = t3 y = sin t

Find dzdt .

Solutionz = t3 sin2 t, so

dz

dt= 3t2︸︷︷︸

dxdt

sin2 t︸ ︷︷ ︸y2

+ t3︸︷︷︸x

2 sin t cos t︸ ︷︷ ︸dydt

Page 17: Lesson 23: The Chain Rule

Fact (The Chain Rule, version I)

When z = F (x , y) with x = f (t) and y = g(t), then

z ′(t) = F ′1(f (t), g(t))f ′(t) + F ′2(f (t), g(t))g ′(t)

or

dz

dt=∂F

∂x

dx

dt+∂F

∂y

dy

dt

We can generalize to more variables, too. If F is a function ofx1, x2, . . . , xn, and each xi is a function of t, then

dz

dt=∂F

∂x1

dx1

dt+∂F

∂x2

dx2

dt+ · · · +

∂F

∂xn

dxn

dt

Page 18: Lesson 23: The Chain Rule

Fact (The Chain Rule, version I)

When z = F (x , y) with x = f (t) and y = g(t), then

z ′(t) = F ′1(f (t), g(t))f ′(t) + F ′2(f (t), g(t))g ′(t)

or

dz

dt=∂F

∂x

dx

dt+∂F

∂y

dy

dt

We can generalize to more variables, too. If F is a function ofx1, x2, . . . , xn, and each xi is a function of t, then

dz

dt=∂F

∂x1

dx1

dt+∂F

∂x2

dx2

dt+ · · · +

∂F

∂xn

dxn

dt

Page 19: Lesson 23: The Chain Rule

Tree Diagrams for the Chain Rule

F

x

t

dxdt

∂F∂x

y

t

dydt

∂F∂y

To differentiate with respect to t, find all “leaves” marked t.Going down each branch, chain (multiply) all the derivativestogether. Then add up the result from each branch.

dz

dt=

dF

dt=∂F

∂x

dx

dt+∂F

∂y

dy

dt

Page 20: Lesson 23: The Chain Rule

Example

Consider a Cobb-Douglas production function defined by

P(A, x , y) = AK aLb

where K is capital, L is labor, and A is the “technology” to convertthese quantities to production. Suppose that all of these arechanging over time. Show that

1

P

dP

dt=

1

A

dA

dt+ a

1

K

dK

dt+ b

1

L

dL

dt

That is

relative rateof growth in

output=

relative rateof growth oftechnology

+ a ×relative rateof growth of

capital+ b ×

relative rateof growth of

labor

Page 21: Lesson 23: The Chain Rule

Solution

dP

dt=∂P

∂A

dA

dt+∂P

∂K

dK

dt+∂P

∂L

dL

dt

= K aLb dA

dt+ AaK a−1Lb dK

dt+ AK abLb−1 dL

dt

So

1

P

dP

dt=

K aLb dAdt + AaK a−1Lb dK

dt + AK abLb−1 dLdt

AK aLb

=1

A

dA

dt+ a

1

K

dK

dt+ b

1

L

dL

dt

Page 22: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 23: Lesson 23: The Chain Rule

Fact (The Chain Rule, Version II)

When z = F (x , y) with x = f (t, s) and y = g(t, s), then

∂z

∂t=∂F

∂x

∂x

∂t+∂F

∂y

∂y

∂t∂z

∂s=∂F

∂x

∂x

∂s+∂F

∂y

∂y

∂s

F

x

t s

y

t s

Page 24: Lesson 23: The Chain Rule

Example

Suppose z = xy2, x = t + s and y = t − s. Find ∂z∂t and ∂z

∂s at(t, z) = (1/2, 1) in two ways:

(i) By expressing z directly in terms of t and s beforedifferentiating.

(ii) By using the chain rule.

Page 25: Lesson 23: The Chain Rule

Theorem (The Chain Rule, General Version)

Suppose that u is a differentiable function of the n variablesx1, x2, . . . , xn, and each xi is a differentiable function of the mvariables t1, t2, . . . , tm. Then u is a function of t1, t2, . . . , tm and

∂u

∂ti=

∂u

∂x1

∂x1

∂ti+∂u

∂x2

∂x2

∂ti+ · · · +

∂u

∂xn

∂xn

∂ti

In summation notation

∂u

∂ti=

n∑j=1

∂u

∂xj

∂xj

∂ti

Page 26: Lesson 23: The Chain Rule

Theorem (The Chain Rule, General Version)

Suppose that u is a differentiable function of the n variablesx1, x2, . . . , xn, and each xi is a differentiable function of the mvariables t1, t2, . . . , tm. Then u is a function of t1, t2, . . . , tm and

∂u

∂ti=

∂u

∂x1

∂x1

∂ti+∂u

∂x2

∂x2

∂ti+ · · · +

∂u

∂xn

∂xn

∂ti

In summation notation

∂u

∂ti=

n∑j=1

∂u

∂xj

∂xj

∂ti

Page 27: Lesson 23: The Chain Rule

Example

Write out the Chain Rule for the case where w = f (x , y , z , t) andx = x(u, v), y = y(u, v), z = z(u, v), and t = t(u, v).

w

x

u v

y

u v

z

u v

t

u v

Solution

∂w

∂u=∂w

∂x

∂x

∂u+∂w

∂y

∂y

∂u+∂w

∂z

∂z

∂u+∂w

∂t

∂t

∂u∂w

∂v=∂w

∂x

∂x

∂v+∂w

∂y

∂y

∂v+∂w

∂z

∂z

∂v+∂w

∂t

∂t

∂v

Page 28: Lesson 23: The Chain Rule

Example

Write out the Chain Rule for the case where w = f (x , y , z , t) andx = x(u, v), y = y(u, v), z = z(u, v), and t = t(u, v).

w

x

u v

y

u v

z

u v

t

u v

Solution

∂w

∂u=∂w

∂x

∂x

∂u+∂w

∂y

∂y

∂u+∂w

∂z

∂z

∂u+∂w

∂t

∂t

∂u∂w

∂v=∂w

∂x

∂x

∂v+∂w

∂y

∂y

∂v+∂w

∂z

∂z

∂v+∂w

∂t

∂t

∂v

Page 29: Lesson 23: The Chain Rule

Example

Write out the Chain Rule for the case where w = f (x , y , z , t) andx = x(u, v), y = y(u, v), z = z(u, v), and t = t(u, v).

w

x

u v

y

u v

z

u v

t

u v

Solution

∂w

∂u=∂w

∂x

∂x

∂u+∂w

∂y

∂y

∂u+∂w

∂z

∂z

∂u+∂w

∂t

∂t

∂u∂w

∂v=∂w

∂x

∂x

∂v+∂w

∂y

∂y

∂v+∂w

∂z

∂z

∂v+∂w

∂t

∂t

∂v

Page 30: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 31: Lesson 23: The Chain Rule

Matrix Perspective

∂w

∂u=∂w

∂x

∂x

∂u+∂w

∂y

∂y

∂u+∂w

∂z

∂z

∂u+∂w

∂t

∂t

∂u∂w

∂v=∂w

∂x

∂x

∂v+∂w

∂y

∂y

∂v+∂w

∂z

∂z

∂v+∂w

∂t

∂t

∂v

Or,

(∂w

∂u

∂w

∂v

)=

(∂w

∂x

∂w

∂y

∂w

∂z

∂w

∂t

)

∂x

∂u

∂x

∂v∂y

∂u

∂y

∂v∂z

∂u

∂z

∂v∂t

∂u

∂t

∂v

Page 32: Lesson 23: The Chain Rule

Outline

HW problem 15.7.2

Where we’re going

Chain Rule I

Chain Rule II

Matrix expressions for the Chain Rule

Leibniz’s Formula for Integrals

Page 33: Lesson 23: The Chain Rule

Leibniz’s Formula for Integrals

FactSuppose that f (, t, x), a(t), and b(t) are differentiable functions,and let

F (t) =

∫ b(t)

a(t)f (t, x) dx

Then

F ′(t) = f (t, b(t))b′(t) − f (t, a(t))a′(t) +

∫ b(t)

a(t)

∂f (t, x)

∂tdx

Proof.Apply the chain rule to the function

H(t, u, v) =

∫ v

uf (t, x) dx

with u = a(t) and v = b(t).

Page 34: Lesson 23: The Chain Rule

Leibniz’s Formula for Integrals

FactSuppose that f (, t, x), a(t), and b(t) are differentiable functions,and let

F (t) =

∫ b(t)

a(t)f (t, x) dx

Then

F ′(t) = f (t, b(t))b′(t) − f (t, a(t))a′(t) +

∫ b(t)

a(t)

∂f (t, x)

∂tdx

Proof.Apply the chain rule to the function

H(t, u, v) =

∫ v

uf (t, x) dx

with u = a(t) and v = b(t).

Page 35: Lesson 23: The Chain Rule

Leibniz’s Formula for Integrals

FactSuppose that f (, t, x), a(t), and b(t) are differentiable functions,and let

F (t) =

∫ b(t)

a(t)f (t, x) dx

Then

F ′(t) = f (t, b(t))b′(t) − f (t, a(t))a′(t) +

∫ b(t)

a(t)

∂f (t, x)

∂tdx

Proof.Apply the chain rule to the function

H(t, u, v) =

∫ v

uf (t, x) dx

with u = a(t) and v = b(t).

Page 36: Lesson 23: The Chain Rule

Tree Diagram

H

t u

t

v

t

Page 37: Lesson 23: The Chain Rule

More about the proof

H(t, u, v) =

∫ v

uf (t, x) dx

Then by the Fundamental Theorem of Calculus (see Section 10.1)

∂H

∂v= f (t, v)

∂H

∂u= −f (t, u)

Also,∂H

∂t=

∫ v

u

∂f

∂x(t, x) dx

since t and x are independent variables.

Page 38: Lesson 23: The Chain Rule

More about the proof

H(t, u, v) =

∫ v

uf (t, x) dx

Then by the Fundamental Theorem of Calculus (see Section 10.1)

∂H

∂v= f (t, v)

∂H

∂u= −f (t, u)

Also,∂H

∂t=

∫ v

u

∂f

∂x(t, x) dx

since t and x are independent variables.

Page 39: Lesson 23: The Chain Rule

More about the proof

H(t, u, v) =

∫ v

uf (t, x) dx

Then by the Fundamental Theorem of Calculus (see Section 10.1)

∂H

∂v= f (t, v)

∂H

∂u= −f (t, u)

Also,∂H

∂t=

∫ v

u

∂f

∂x(t, x) dx

since t and x are independent variables.

Page 40: Lesson 23: The Chain Rule

Since F (t) = H(t, a(t), b(t)),

dF

dt=∂H

∂t+∂H

∂u

du

dt+∂H

∂v

dv

dt

=

∫ b(t)

a(t)

∂f

∂x(t, x) + f (t, b(t))b′(t) − f (t, a(t))a′(t)

Page 41: Lesson 23: The Chain Rule

Application

Example (Example 16.8 with better notation)

Let the profit of a firm be π(t). The present value of the futureprofit π(τ) where τ > t is

π(τ)e−r(τ−t),

where r is the discount rate. On a time interval [0,T ], the presentvalue of all future profit is

V (t) =

∫ T

tπ(τ)e−r(τ−t) dt.

Find V ′(t).

Answer.

V ′(t) = rV (t) − π(t)

Page 42: Lesson 23: The Chain Rule

Application

Example (Example 16.8 with better notation)

Let the profit of a firm be π(t). The present value of the futureprofit π(τ) where τ > t is

π(τ)e−r(τ−t),

where r is the discount rate. On a time interval [0,T ], the presentvalue of all future profit is

V (t) =

∫ T

tπ(τ)e−r(τ−t) dt.

Find V ′(t).

Answer.

V ′(t) = rV (t) − π(t)

Page 43: Lesson 23: The Chain Rule

SolutionSince the upper limit is a constant, the only boundary term comesfrom the lower limit:

V ′(t) = −π(t)e−r(t−t) +

∫ T

t

∂tπ(τ)e−rτert dτ

= −π(t) + r

∫ T

tπ(τ)e−rτert dτ

= rV (t) − π(t).

This means that

r =π(t) + V ′(t)

V (t)

So if the fraction on the right is less than the rate of return foranother, “safer” investment like bonds, it would be worth more tosell the business and buy the bonds.