Chapter 4

Partial Differentiation

4.1Introduction

Video Lecture 13, Part 1: Partial Derivatives (0:00)

In many physical problems, we encounter functions that depend on more than one variable, e.g.,

f = f ( x , y , z , … ) . (4.1)

The partial derivative of f with respect to x means differentiating f with respect to x while treating all the other variables as constants. We denote this as

∂ f ∂ x . (4.2)
DefinitionPartial Derivative

Let f ( x 1 , x 2 , … , x n ) be a function of several variables. The partial derivative of f with respect to the variable x i is defined by

∂ f ∂ x i = lim Δ x i → 0 f ( x 1 , … , x i + Δ x i , … , x n ) − f ( x 1 , … , x i , … , x n ) Δ x i . (4.3)

All other variables are held constant during the differentiation.

Geometrically, the graph of f ( x , y ) is a surface z = f ( x , y ) . Holding y = y 0 fixed cuts the surface with the vertical plane y = y 0 : the cut is a curve, a function of x alone, and ∂ f ∂ x at ( x 0 , y 0 ) is the slope of its tangent line. Holding x = x 0 fixed instead gives a slice in the y direction, whose slope is ∂ f ∂ y .

The partial derivative as the slope of a slice. The plane y = y0 cuts the surface z = f(x,y) along a curve (orange), and f x is the slope of the tangent line to this curve (red). As the plane moves, each value of y0 gives a different slice with its own slope.
Figure 4.1. The partial derivative as the slope of a slice. The plane y = y 0 cuts the surface z = f ( x , y ) along a curve (orange), and ∂ f ∂ x is the slope of the tangent line to this curve (red). As the plane moves, each value of y 0 gives a different slice with its own slope.

Notation

There are multiple notations for partial derivatives. For first-order:

∂ f ∂ x = f x . (4.4)

Video Lecture 13, Part 2: Higher-Order Partial Derivatives (5:32)

For higher-order derivatives:

∂ 2 f ∂ x 2 = f x x , ∂ 2 f ∂ y ∂ x = f x y , ∂ 2 f ∂ y 2 = f y y . (4.5)

In the mixed derivative ∂ 2 f ∂ y ∂ x = ∂ ∂ y ( ∂ f ∂ x ) we differentiate first with respect to x , then y : read the denominator from right to left, and the subscripts of f x y from left to right.

Several notations for partial derivatives are in common use, and all of the following denote the same derivative:

∂ f ∂ x = f x = ∂ x f . (4.6)

The three notations agree on the order of second derivatives: ∂ 2 f ∂ y ∂ x , f x y and ∂ y ∂ x f all mean that we differentiate first with respect to x and then with respect to y . Two further conventions are useful. When it matters which variables are held fixed, they are written as a subscript outside parentheses; for example, ( ∂ f ∂ x ) y is the derivative with respect to x at constant y . This notation is used throughout Section 4.2. The value of a derivative at a point is written either as f x ( 1 , 2 ) or as ∂ f ∂ x | ( 1 , 2 ) . Finally, the straight d , as in d f d x , is reserved for functions of a single variable and for total derivatives along a path; it is never used for a partial derivative.

ExamplePartial Derivatives of a Multivariable Function

Let

f ( x , y ) = x 3 y − e x y . (4.7)

First-order partial derivatives:

∂ f ∂ x = 3 x 2 y − y e x y , ∂ f ∂ y = x 3 − x e x y . (4.8)

Second-order partial derivatives:

∂ 2 f ∂ x 2 = 6 x y − y 2 e x y , ∂ 2 f ∂ y 2 = − x 2 e x y . (4.9)
∂ 2 f ∂ x ∂ y = 3 x 2 − e x y − x y e x y , ∂ 2 f ∂ y ∂ x = 3 x 2 − e x y − x y e x y . (4.10)

Conclusion: Mixed partials agree:

∂ 2 f ∂ x ∂ y = ∂ 2 f ∂ y ∂ x , (4.11)

(as long as f is sufficiently smooth — Clairaut's Theorem).

RemarkCommon mistake

Writing ∂ ∂ x e x y = e x y . The exponent depends on x , so the chain rule brings down its derivative: ∂ ∂ x e x y = y e x y , with y treated as a number. Likewise ∂ ∂ y ( y e x y ) = e x y + x y e x y needs the product rule, because both factors contain y .

Remark

For sufficiently smooth functions, the mixed derivatives are equal:

∂ 2 f ∂ x ∂ y = ∂ 2 f ∂ y ∂ x . (4.12)

This is known as Clairaut’s theorem.

What a mixed derivative measures: ∂ f ∂ x is the slope of the slice y = y 0 , and ∂ ∂ y ( ∂ f ∂ x ) is how fast that slope changes as the slice moves in the y direction. For f = 2.4 − 0.3 x 2 − 0.2 y 2 + 0.25 x y , ∂ f ∂ x = − 0.6 x + 0.25 y , so at x = 0.6 the slope grows by 0.25 for every unit of y ; and the slope in the y direction, − 0.4 y + 0.25 x , grows in x at the same rate 0.25 .

Slices of f = 2.4 - 0.3x^2 - 0.2y^2 + 0.25xy at several values of y. The slope of each slice at x = 0.6 increases by 0.25 for each unit increase in y; this rate is the mixed derivative ^2 f y x.
Figure 4.2. Slices of f = 2.4 − 0.3 x 2 − 0.2 y 2 + 0.25 x y at several values of y . The slope of each slice at x = 0.6 increases by 0.25 for each unit increase in y ; this rate is the mixed derivative ∂ 2 f ∂ y ∂ x .
ExampleChange of Variables and Partial Derivatives

Let

z = x 2 − y 2 , x = r cos ⁡ ( θ ) , y = r sin ⁡ ( θ ) . (4.13)

Then, using x 2 + y 2 = r 2 , we can rewrite z in different but equivalent forms and compute ∂ z ∂ r while holding different variables constant.

1) Expressing z in terms of r and θ :

z = r 2 cos 2 ⁡ ( θ ) − r 2 sin 2 ⁡ ( θ ) = r 2 cos ⁡ ( 2 θ ) . (4.14)

Holding θ constant:

( ∂ z ∂ r ) θ = 2 r ( cos 2 ⁡ ( θ ) − sin 2 ⁡ ( θ ) ) = 2 r cos ⁡ ( 2 θ ) . (4.15)

2) Expressing z in terms of x and r :

z = 2 x 2 − ( x 2 + y 2 ) = 2 x 2 − r 2 . (4.16)

Holding x constant:

( ∂ z ∂ r ) x = − 2 r . (4.17)

3) Expressing z in terms of y and r :

z = ( x 2 + y 2 ) − 2 y 2 = r 2 − 2 y 2 . (4.18)

Holding y constant:

( ∂ z ∂ r ) y = 2 r . (4.19)

Important: Each derivative is different because a different quantity is held fixed. Thus, we write:

( ∂ z ∂ r ) θ , ( ∂ z ∂ r ) x , ( ∂ z ∂ r ) y , (4.20)

to remove ambiguity in multivariable calculus.

The contour map shows why. At P = ( 2 , 1 ) , where r = 5 and cos ⁡ ( 2 θ ) = 3 5 , “increase r ” means three different moves: with x fixed, straight up, toward lower levels ( − 2 r ≈ − 4.47 ); with y fixed, straight right, toward higher levels ( 2 r ≈ 4.47 ); with θ fixed, outward along the ray ( 2 r cos ⁡ ( 2 θ ) ≈ 2.68 ).

Level curves of z = x^2 - y^2 (blue z > 0, red z < 0) and three ways to increase r at P = (2, 1): three directions, three rates.
Figure 4.3. Level curves of z = x 2 − y 2 (blue z > 0 , red z < 0 ) and three ways to increase r at P = ( 2 , 1 ) : three directions, three rates.

4.2Applications in Thermodynamics

Video Lecture 13, Part 3: Which Variable Is Held Constant (9:48)

Partial derivatives play a central role in thermodynamics because most physical quantities depend on more than one variable. For example, temperature T , pressure p , volume V , and entropy S are related through equations of state and energy relations. To describe how one variable changes while others are held constant, we use partial derivatives with explicit subscripts.

For example, the temperature can be expressed as a function of pressure and volume,

T = T ( p , V ) , (4.21)

or as a function of pressure and internal energy,

T = T ( p , U ) . (4.22)

In these cases, we encounter derivatives such as

( ∂ T ∂ p ) V , ( ∂ T ∂ p ) U , … (4.23)

Written per mole, the ideal gas law is p V = n R T ( N k B = n R ). Then

T = p V n R   ⇒   ( ∂ T ∂ p ) V = V n R , p = n R T V   ⇒   ( ∂ p ∂ T ) V = n R V . (4.24)

Both derivatives hold the same variable, V , fixed, so they are reciprocals. On the p – V diagram the isotherms p V = n R T are hyperbolas, hotter ones further out; constant V is a vertical line, and going up it crosses to hotter isotherms.

Remark

Constant U is not the same as adiabatic. Adiabatic means no heat crosses the boundary, δ Q = 0 ; for a reversible process that is constant entropy, S . A gas compressed adiabatically does have work done on it, so its internal energy rises. The free expansion above happens to be both adiabatic and at constant U only because no work is done either.

Remark

The subscript indicates which variables are kept constant during differentiation. For example:

( ∂ T ∂ p ) V means “change in  T  with respect to  p  while keeping  V  fixed.” (4.25)

This removes ambiguity and prevents misinterpretation of derivatives.

ExamplePhysics: the thermodynamic cyclic relation

A gas has an equation of state relating p , V and T , such as p V = N k B T , so that any one of the three is determined by the other two. Show that

( ∂ p ∂ V ) T ( ∂ V ∂ T ) p ( ∂ T ∂ p ) V = − 1 . (4.26)

Solution.

The result is surprising at first sight: one might expect the three factors to cancel to + 1 , as they would if the symbols were ordinary fractions. They do not, and the minus sign is the point.

Regard T as a function of p and V and write its total differential:

d T = ( ∂ T ∂ p ) V d p + ( ∂ T ∂ V ) p d V . (4.27)

Now specialise to a process at constant temperature, so d T = 0 :

0 = ( ∂ T ∂ p ) V d p + ( ∂ T ∂ V ) p d V . (4.28)

Dividing by d V at fixed T and solving for the ratio gives

( ∂ p ∂ V ) T = − ( ∂ T ∂ V ) p ( ∂ T ∂ p ) V . (4.29)

Substitute this into the left-hand side of (4.26). The middle factor may be inverted, because ( ∂ V ∂ T ) p and ( ∂ T ∂ V ) p hold the same variable p fixed and so are genuine reciprocals:

( ∂ p ∂ V ) T ( ∂ V ∂ T ) p ( ∂ T ∂ p ) V = − ( ∂ T ∂ V ) p ( ∂ T ∂ p ) V ⋅ 1 ( ∂ T ∂ V ) p ⋅ ( ∂ T ∂ p ) V = − 1 . (4.30)

As a check, use the ideal gas law p V = N k B T directly:

( ∂ p ∂ V ) T = − N k B T V 2 , ( ∂ V ∂ T ) p = N k B p , ( ∂ T ∂ p ) V = V N k B , (4.31)

whose product is − N k B T V p = − 1 , since p V = N k B T .

The minus sign has a physical reading. Raise the pressure at fixed volume and the temperature rises; raise the temperature at fixed pressure and the volume rises; so increasing the volume at fixed temperature must lower the pressure. Two increases and one decrease give the negative sign. This relation is used constantly in thermodynamics to trade an unmeasurable derivative for two measurable ones.

The p–V diagram near a point. Moving up at fixed V or to the right at fixed p both reach a hotter isotherm, so those two derivatives are positive; moving along the isotherm, the pressure falls as the volume grows. Two positive derivatives and one negative one give the product -1.
Figure 4.4. The p – V diagram near a point. Moving up at fixed V or to the right at fixed p both reach a hotter isotherm, so those two derivatives are positive; moving along the isotherm, the pressure falls as the volume grows. Two positive derivatives and one negative one give the product − 1 .

4.3Power Series in Two Variables

Video Lecture 13, Part 4: Taylor Series in Two Variables (14:42)

Just as a function of a single variable can be expressed as a power series expansion, functions of two variables can also be expanded into a series about a point ( a , b ) .

ExampleSeries Expansion of sin ⁡ ( x ) cos ⁡ ( y )

Use the power series

sin ⁡ ( x ) = x − x 3 3 ! + x 5 5 ! − ⋯ , cos ⁡ ( y ) = 1 − y 2 2 ! + y 4 4 ! − ⋯ . (4.32)

Multiply the expansions:

sin ⁡ ( x ) cos ⁡ ( y ) = ( x − x 3 3 ! + ⋯ ) ( 1 − y 2 2 ! + ⋯ ) . (4.33)

Collecting lowest-order terms:

= x − x 3 3 ! − x y 2 2 ! + ⋯ (4.34)

Thus, the (truncated) power-series expansion is:

sin ⁡ ( x ) cos ⁡ ( y ) = x − x 3 6 − x y 2 2 + ⋯ (4.35)
ExampleSeries Expansion of ln ⁡ ( 1 + x − y )

Start with the known expansion (for | z | < 1 ):

ln ⁡ ( 1 + z ) = z − z 2 2 + z 3 3 − ⋯ . (4.36)

Let z = x − y :

ln ⁡ ( 1 + x − y ) = ( x − y ) − ( x − y ) 2 2 + ( x − y ) 3 3 − ⋯ . (4.37)

Expand:

= ( x − y ) − x 2 − 2 x y + y 2 2 + x 3 − 3 x 2 y + 3 x y 2 − y 3 3 − ⋯ (4.38)

Simplify:

ln ⁡ ( 1 + x − y ) = x − y − x 2 2 + x y − y 2 2 + x 3 3 − x 2 y + x y 2 − y 3 3 + ⋯ (4.39)

General Expansion

Start from one variable. Write the derivative in the Taylor series of f ( x ) about x = a with a separate letter X , differentiated and then set equal to a :

f ( x ) = ∑ n = 0 ∞ f ( n ) ( a ) n ! ( x − a ) n = ∑ n = 0 ∞ 1 n ! ( x − a ) n d n f ( X ) d X n | a = ∑ n = 0 ∞ 1 n ! [ ( x − a ) d d X ] n f ( X ) | a . (4.40)

For the derivative with respect to X , x − a is a constant, so it can stand inside the bracket. With two variables the bracket gets one term for each variable.

In general, a sufficiently smooth function f ( x , y ) can be expanded in a power series about a point ( a , b ) as

f ( x , y ) = ∑ n = 0 ∞ 1 n ! ( ( x − a ) ∂ ∂ X + ( y − b ) ∂ ∂ Y ) n f ( X , Y ) | ( a , b ) . (4.41)

This is the multivariable Taylor series expansion. The operator in brackets is raised to the n th power before acting on f , so at order n it produces every mixed derivative of total order n , each weighted by a binomial coefficient. Writing out n = 2 gives the familiar three terms in x 2 , x y and y 2 used below. Explicitly, multiplying the two brackets term by term gives four second-order terms,

1 2 ( x − a ) 2 ∂ 2 f ∂ X 2 + 1 2 ( x − a ) ( y − b ) ∂ 2 f ∂ X ∂ Y + 1 2 ( y − b ) ( x − a ) ∂ 2 f ∂ Y ∂ X + 1 2 ( y − b ) 2 ∂ 2 f ∂ Y 2 , (4.42)

all at ( a , b ) ; the two mixed derivatives are equal, so the middle terms combine:

1 2 ! [ ( x − a ) 2 ∂ 2 f ∂ X 2 + 2 ( x − a ) ( y − b ) ∂ 2 f ∂ X ∂ Y + ( y − b ) 2 ∂ 2 f ∂ Y 2 ] ( a , b ) . (4.43)
RemarkCommon mistake

Dropping the factor 2 of the mixed term. The cross term appears twice in the square of the bracket, once as ∂ X ∂ Y and once as ∂ Y ∂ X , exactly as 2 u v appears in ( u + v ) 2 .

Taylor Expansion Approach

Instead of multiplying series, we can also compute the expansion of

f ( x , y ) = sin ⁡ ( x ) cos ⁡ ( y ) (4.44)

directly using the two-variable Taylor series about ( 0 , 0 ) :

f ( x , y ) = f ( 0 , 0 ) + ∂ f ∂ X | ( 0 , 0 ) x + ∂ f ∂ Y | ( 0 , 0 ) y + 1 2 ! [ ∂ 2 f ∂ X 2 | ( 0 , 0 ) x 2 + 2 ∂ 2 f ∂ X ∂ Y | ( 0 , 0 ) x y + ∂ 2 f ∂ Y 2 | ( 0 , 0 ) y 2 ] + ⋯ (4.45)

Step 1. Zeroth order

f ( 0 , 0 ) = sin ⁡ ( 0 ) cos ⁡ ( 0 ) = 0. (4.46)

Step 2. First order

∂ f ∂ X = cos ⁡ ( X ) cos ⁡ ( Y ) , ∂ f ∂ X | ( 0 , 0 ) = 1 , (4.47)
∂ f ∂ Y = − sin ⁡ ( X ) sin ⁡ ( Y ) , ∂ f ∂ Y | ( 0 , 0 ) = 0. (4.48)

So the linear contribution is x .

Step 3. Second order

At ( 0 , 0 ) , all second derivatives vanish, so there is no quadratic contribution.

Step 4. Third order

At third order the bracket in (4.41) produces four terms, not one:

1 3 ! [ ∂ 3 f ∂ X 3 | ( 0 , 0 ) x 3 + 3 ∂ 3 f ∂ X 2 ∂ Y | ( 0 , 0 ) x 2 y + 3 ∂ 3 f ∂ X ∂ Y 2 | ( 0 , 0 ) x y 2 + ∂ 3 f ∂ Y 3 | ( 0 , 0 ) y 3 ] . (4.49)

Evaluating each at the origin, where sin vanishes and cos equals one:

∂ 3 f ∂ X 3 = − cos ⁡ ( X ) cos ⁡ ( Y )   →   − 1 , ∂ 3 f ∂ X ∂ Y 2 = − cos ⁡ ( X ) cos ⁡ ( Y )   →   − 1 , (4.50)
∂ 3 f ∂ X 2 ∂ Y = sin ⁡ ( X ) sin ⁡ ( Y )   →   0 , ∂ 3 f ∂ Y 3 = sin ⁡ ( X ) sin ⁡ ( Y )   →   0 . (4.51)

So the third-order contribution is

1 6 [ − x 3 + 3 ( − 1 ) x y 2 ] = − x 3 6 − x y 2 2 . (4.52)

Result

Collecting terms:

sin ⁡ ( x ) cos ⁡ ( y ) = x − x 3 6 − x y 2 2 + ⋯ (4.53)
Remark

This matches the result obtained earlier by multiplying the single-variable series, including the x y 2 term. That term is easy to lose: it comes from the mixed derivative ∂ 3 f ∂ X ∂ Y 2 , not from differentiating three times in x . When using the multivariable Taylor series, every mixed derivative of the given total order must be included, each with its binomial coefficient.

Each order of the series fits the surface over a larger region. The first-order part is the tangent plane z = x ; the cubic terms bend it into the shape of the surface.

The surface z = (x)(y) near the origin, its tangent plane z = x, and the cubic approximation z = x - x^36 - xy^22. Green marks the region where each approximation is within 0.05 of the surface: a thin strip for the tangent plane, and a much larger region for the cubic approximation.
Figure 4.5. The surface z = sin ⁡ ( x ) cos ⁡ ( y ) near the origin, its tangent plane z = x , and the cubic approximation z = x − x 3 6 − x y 2 2 . Green marks the region where each approximation is within 0.05 of the surface: a thin strip for the tangent plane, and a much larger region for the cubic approximation.

4.4Total Differentials

Video Lecture 13, Part 5: Total Differentials (19:59)

Review: One Variable

Illustration of the differential: for a small change dx, the corresponding change in y is approximated by dy = y&#x27; dx.
Figure 4.6. Illustration of the differential: for a small change d x , the corresponding change in y is approximated by d y = y ′ d x .

If y = f ( x ) , then

y ′ = d y d x = d f ( x ) d x . (4.54)

By definition,

d y d x = lim Δ x → 0 Δ y Δ x . (4.55)

Hence, for small Δ x ,

d x = Δ x , d y = y ′ d x . (4.56)

Geometrically, the differential d y is the rise along the tangent line, while the true change Δ y is the rise along the curve. As d x shrinks, the difference between them shrinks even faster than d x itself, which is why d y is a good approximation to a small change in y .

For a step dx (green), the differential df (red) is the rise along the tangent line, and the true change f (blue) is the rise along the curve. As dx shrinks, the two become nearly equal.
Figure 4.7. For a step d x (green), the differential d f (red) is the rise along the tangent line, and the true change Δ f (blue) is the rise along the curve. As d x shrinks, the two become nearly equal.

Two Variables

If f = f ( x , y ) , then the total differential is

d f = ∂ f ∂ x d x + ∂ f ∂ y d y . (4.57)

Each variable contributes its own rate times its own small change. The area of a rectangle, A = x y , shows it: lengthen x by d x and the area grows by a strip y d x ; lengthen y by d y and it grows by a strip x d y . The corner d x d y is a product of two small numbers and is negligible, so d A = y d x + x d y = ∂ A ∂ x d x + ∂ A ∂ y d y .

dA = y\,dx + x\,dy: the two strips; the corner dx\,dy is negligible.
Figure 4.8. d A = y d x + x d y : the two strips; the corner d x d y is negligible.

On the surface z = f ( x , y ) , d f is the change along the tangent plane: a step d x rises by ∂ f ∂ x d x , then a step d y rises by ∂ f ∂ y d y .

The total differential on the tangent plane (yellow): the rise f xdx of the step dx (blue) plus the rise f ydy of the step dy (red) is df.
Figure 4.9. The total differential on the tangent plane (yellow): the rise ∂ f ∂ x d x of the step d x (blue) plus the rise ∂ f ∂ y d y of the step d y (red) is d f .

General Case

For a function of many variables,

f = f ( x , y , z , … ) , (4.58)

the total differential is

d f = ∂ f ∂ x d x + ∂ f ∂ y d y + ∂ f ∂ z d z + ⋯ (4.59)
Remark

The total differential expresses the approximate change in f resulting from small changes in its independent variables.

4.5Chain Rule: Differentiating a Function of a Function

Video Lecture 13, Part 6: The Chain Rule (23:59)

The chain rule extends naturally to functions of functions. If a variable depends on another, which in turn depends on a third, we can differentiate by following the chain of dependencies.

TheoremChain Rule for Composite Functions

If y = y ( u ) and u = u ( x ) , then the derivative of y with respect to x is

d y d x = d y d u d u d x . (4.60)

More generally, if

u = u ( x , y ) , x = x ( t ) , y = y ( t ) , (4.61)

then

d u d t = ∂ u ∂ x d x d t + ∂ u ∂ y d y d t . (4.62)

For functions depending on multiple variables,

d u d t = ∂ u ∂ x d x d t + ∂ u ∂ y d y d t + ∂ u ∂ z d z d t + ⋯ (4.63)

where the sum includes a term for each independent variable.

Example

Let

y = ln ⁡ ( u ) , u = sin ⁡ ( v ) , v = 2 x . (4.64)

Find d y d x .

Solution.

d y d x = d y d u d u d v d v d x . (4.65)

Compute the derivatives step by step:

d y d u = 1 u , d u d v = cos ⁡ ( v ) , d v d x = 2. (4.66)

Thus,

d y d x = 1 u cos ⁡ ( v ) ⋅ 2 = 2 cos ⁡ ( v ) u . (4.67)

Since u = sin ⁡ ( v ) ,

d y d x = 2 cos ⁡ ( v ) sin ⁡ ( v ) = 2 cot ⁡ ( v ) = 2 cot ⁡ ( 2 x ) . (4.68)
Example

Let

z = x y , x = 2 t 2 , y = sin ⁡ ( t ) . (4.69)

Find d z d t .

Solution.

d z d t = ∂ z ∂ x d x d t + ∂ z ∂ y d y d t . (4.70)

Since

∂ z ∂ x = y , ∂ z ∂ y = x , (4.71)

we get

d z d t = y d x d t + x d y d t . (4.72)

Now compute the derivatives:

d x d t = 4 t , d y d t = cos ⁡ ( t ) . (4.73)

Therefore,

d z d t = sin ⁡ ( t ) ( 4 t ) + ( 2 t 2 ) cos ⁡ ( t ) . (4.74)
d z d t = 4 t sin ⁡ ( t ) + 2 t 2 cos ⁡ ( t ) . (4.75)

Check: directly, z = 2 t 2 sin ⁡ ( t ) , and the product rule gives the same result.

RemarkCommon mistake

Writing ∂ z ∂ t here. Along the path, z depends on t alone (through x and y ), so its derivative is the ordinary, total derivative d z d t .

Remark

The chain rule allows us to differentiate composite functions systematically, even when variables are nested or interdependent.

4.6Implicit Differentiation

Video Lecture 14, Part 1: Implicit Differentiation (0:00)

Often, functions are defined implicitly rather than explicitly. For example, if x and t are related by

x + e x = t , (4.76)

then x is an implicit function of t .

First Derivative

Differentiate both sides of

x + e x = t (4.77)

with respect to t :

d x d t + e x d x d t = 1. (4.78)

Thus,

d x d t = 1 1 + e x . (4.79)

The same with differentials: d ( x + e x ) = d t gives d x + e x d x = d t , so d x ( 1 + e x ) = d t and d x d t = ( 1 + e x ) − 1 . No formula for x ( t ) is needed; the answer is in terms of x .

Second Derivative

From the expression for d x d t , we differentiate again:

d 2 x d t 2 = d d t [ ( 1 + e x ) − 1 ] . (4.80)

Apply the chain rule:

d 2 x d t 2 = − ( 1 + e x ) − 2 ⋅ e x d x d t . (4.81)

Now substitute d x d t = 1 1 + e x :

d 2 x d t 2 = − e x ( 1 + e x ) 3 . (4.82)

The graph shows both results. Swapping the axes of t = x + e x (reflecting it in the diagonal) gives the graph of x ( t ) . A slope triangle flips with it: the slope d t d x = 1 + e x of the first curve becomes the reciprocal slope d x d t of the second (at x = 0 : 2 and 1 2 ). The reflected curve bends down, as d 2 x d t 2 < 0 says.

The curve t = x + e^x (blue, with x on the horizontal axis) and its mirror image in the diagonal, which is the inverse function x(t) (green, with t on the horizontal axis). The reflection turns the slope 2 at (0, 1) into the slope 12 at (1, 0).
Figure 4.10. The curve t = x + e x (blue, with x on the horizontal axis) and its mirror image in the diagonal, which is the inverse function x ( t ) (green, with t on the horizontal axis). The reflection turns the slope 2 at ( 0 , 1 ) into the slope 1 2 at ( 1 , 0 ) .
RemarkCommon mistake

Differentiating e x with respect to t as if it were e t . The variable inside is x , so the chain rule adds a factor: d d t e x = e x d x d t .

Example

Find the equation of the tangent line to the curve

x 3 − 3 y 3 + x y + 21 = 0 (4.83)

at the point ( 1 , 2 ) .

Solution.

First check that the point actually lies on the curve, since everything below depends on it:

1 3 − 3 ( 2 ) 3 + ( 1 ) ( 2 ) + 21 = 1 − 24 + 2 + 21 = 0 . ✓ (4.84)

Now differentiate implicitly with respect to x , remembering that y is a function of x , so y 3 and x y need the chain and product rules:

3 x 2 − 9 y 2 d y d x + y + x d y d x = 0. (4.85)

(Equivalently, take the differential of every term, 3 x 2 d x − 9 y 2 d y + ( y d x + x d y ) = 0 , and divide by d x .)

Group the d y d x terms:

( x − 9 y 2 ) d y d x = − ( 3 x 2 + y ) . (4.86)

Solve for slope:

d y d x = − ( 3 x 2 + y ) x − 9 y 2 . (4.87)

At the point ( 1 , 2 ) :

d y d x | ( 1 , 2 ) = − ( 3 ( 1 ) 2 + 2 ) 1 − 9 ( 2 2 ) = − 5 − 35 = 1 7 . (4.88)

The tangent line with slope m = 1 7 at ( 1 , 2 ) :

y − 2 = 1 7 ( x − 1 ) . (4.89)

Simplifying:

x − 7 y + 13 = 0. (4.90)

That is, y = 1 7 x + 13 7 .

The curve x^3 - 3y^3 + xy + 21 = 0 and its tangent line y = 17 x + 137 at (1, 2).
Figure 4.11. The curve x 3 − 3 y 3 + x y + 21 = 0 and its tangent line y = 1 7 x + 13 7 at ( 1 , 2 ) .

Common mistake: d ( x y ) = x d y . Both x and y change, so d ( x y ) = y d x + x d y .

Remark

Implicit differentiation allows us to compute derivatives (and tangent lines) for curves not expressed explicitly as y = f ( x ) .

4.7More on Chain Rule

Video Lecture 14, Part 2: The Chain Rule for Several Variables (3:59)

Video Lecture 14, Part 3: The Chain Rule with Constraints (8:35)

TheoremGeneral Chain Rule

Suppose

u = u ( x , y , z ) , x = x ( s , t ) , y = y ( s , t ) , z = z ( s , t ) . (4.91)

Then the chain rule gives

∂ u ∂ s = ∂ u ∂ x ∂ x ∂ s + ∂ u ∂ y ∂ y ∂ s + ∂ u ∂ z ∂ z ∂ s (4.92)
∂ u ∂ t = ∂ u ∂ x ∂ x ∂ t + ∂ u ∂ y ∂ y ∂ t + ∂ u ∂ z ∂ z ∂ t (4.93)

Write the total differential of u = u ( x , y , z ) :

d u = ∂ u ∂ x d x + ∂ u ∂ y d y + ∂ u ∂ z d z . (4.94)

Since x = x ( s , t ) , y = y ( s , t ) , z = z ( s , t ) , their differentials are

d x = ∂ x ∂ s d s + ∂ x ∂ t d t , d y = ∂ y ∂ s d s + ∂ y ∂ t d t , d z = ∂ z ∂ s d s + ∂ z ∂ t d t . (4.95)

Substitute into d u and collect coefficients of d s and d t :

d u = ( ∂ u ∂ x ∂ x ∂ s + ∂ u ∂ y ∂ y ∂ s + ∂ u ∂ z ∂ z ∂ s ) d s + ( ∂ u ∂ x ∂ x ∂ t + ∂ u ∂ y ∂ y ∂ t + ∂ u ∂ z ∂ z ∂ t ) d t . (4.96)

By the definition of partial derivatives of u as a function of ( s , t ) ,

∂ u ∂ s = ∂ u ∂ x ∂ x ∂ s + ∂ u ∂ y ∂ y ∂ s + ∂ u ∂ z ∂ z ∂ s , ∂ u ∂ t = ∂ u ∂ x ∂ x ∂ t + ∂ u ∂ y ∂ y ∂ t + ∂ u ∂ z ∂ z ∂ t . (4.97)

Writing these two identities together in matrix form gives

( ∂ u ∂ s ∂ u ∂ t ) = ( ∂ u ∂ x ∂ u ∂ y ∂ u ∂ z ) ( ∂ x ∂ s ∂ x ∂ t ∂ y ∂ s ∂ y ∂ t ∂ z ∂ s ∂ z ∂ t ) , (4.98)

which is the desired matrix chain rule. Check the shapes: a 1 × 3 row times a 3 × 2 matrix gives a 1 × 2 row, one entry for each of s and t . The middle matrix is the Jacobian of the change of variables, and the chain rule is just matrix multiplication by it.

A tree makes the rule easy to remember: put u on top, the middle variables x , y , z below it, and s , t at the bottom. Each path from u down to s is one product of two rates, and ∂ u ∂ s is the sum over the paths. Leaving out a path (a middle variable that depends on s ) is the most common mistake.

The three paths from u to s (coloured): u s = u x x s + u y y s + u z z s.
Figure 4.12. The three paths from u to s (coloured): ∂ u ∂ s = ∂ u ∂ x ∂ x ∂ s + ∂ u ∂ y ∂ y ∂ s + ∂ u ∂ z ∂ z ∂ s .
Example

Let

z = x y , x = sin ⁡ ( s + t ) , y = s − t . (4.99)

We want to compute ∂ z ∂ s and ∂ z ∂ t .

Solution.

Step 1. Apply the Chain Rule

∂ z ∂ s = ∂ z ∂ x ∂ x ∂ s + ∂ z ∂ y ∂ y ∂ s , ∂ z ∂ t = ∂ z ∂ x ∂ x ∂ t + ∂ z ∂ y ∂ y ∂ t . (4.100)

Step 2. Compute partial derivatives of z

Since z = x y ,

∂ z ∂ x = y , ∂ z ∂ y = x . (4.101)

Step 3. Compute derivatives of x and y

x = sin ⁡ ( s + t ) ⇒ ∂ x ∂ s = cos ⁡ ( s + t ) , ∂ x ∂ t = cos ⁡ ( s + t ) , (4.102)
y = s − t ⇒ ∂ y ∂ s = 1 , ∂ y ∂ t = − 1. (4.103)

Step 4. Substitute and simplify

∂ z ∂ s = y cos ⁡ ( s + t ) + x , ∂ z ∂ t = y cos ⁡ ( s + t ) − x . (4.104)
∂ z ∂ s = ( s − t ) cos ⁡ ( s + t ) + sin ⁡ ( s + t ) , ∂ z ∂ t = ( s − t ) cos ⁡ ( s + t ) − sin ⁡ ( s + t ) (4.105)
Example

For

z = x − y , x 2 + y 2 = t 2 , x sin ⁡ ( t ) = y e y , (4.106)

find d z d t = ?

Solution.

Step 1. Differentiate the constraints.

2 x d x + 2 y d y = 2 t d t , sin ⁡ ( t ) d x + x cos ⁡ ( t ) d t = ( y + 1 ) e y d y . (4.107)

Step 2. Rearrange to a linear system for d x , d y .

x d x + y d y = t d t , sin ⁡ ( t ) d x − ( y + 1 ) e y d y = − x cos ⁡ ( t ) d t . (4.108)

Step 3. Solve for d x (and similarly d y ) by determinants.

d x = | t d t y − x cos ⁡ ( t ) d t − ( y + 1 ) e y | | x y sin ⁡ ( t ) − ( y + 1 ) e y | = − t ( y + 1 ) e y + x y cos ⁡ ( t ) − x ( y + 1 ) e y − y sin ⁡ ( t ) d t . (4.109)

Equivalently,

d x d t = t ( y + 1 ) e y − x y cos ⁡ ( t ) x ( y + 1 ) e y + y sin ⁡ ( t ) . (4.110)

A parallel computation gives

d y = | x t d t sin ⁡ ( t ) − x cos ⁡ ( t ) d t | | x y sin ⁡ ( t ) − ( y + 1 ) e y | = − x 2 cos ⁡ ( t ) − t sin ⁡ ( t ) − x ( y + 1 ) e y − y sin ⁡ ( t ) d t . (4.111)

Equivalently,

d y d t = x 2 cos ⁡ ( t ) + t sin ⁡ ( t ) x ( y + 1 ) e y + y sin ⁡ ( t ) . (4.112)

Since z = x − y , we have

d z d t = d x d t − d y d t . (4.113)
Example

Find ∂ z ∂ s and ∂ z ∂ t given

z = x 2 + x y , x 2 + y 3 = s t + 5 , x 3 − y 2 = s 2 + t 2 . (4.114)

Solution.

Step 1. Differential of z

We compute

d z = ∂ z ∂ x d x + ∂ z ∂ y d y = ( 2 x + y ) d x + x d y . (4.115)

Step 2. Differentiating the constraints

From the two constraint equations, take differentials:

2 x d x + 3 y 2 d y = s d t + t d s , (4.116)
3 x 2 d x − 2 y d y = 2 s d s + 2 t d t . (4.117)

These form a linear system for d x and d y in terms of d s , d t .

Step 3. Solve for d x , d y

We write in matrix form:

( 2 x 3 y 2 3 x 2 − 2 y ) ( d x d y ) = ( s d t + t d s 2 s d s + 2 t d t ) . (4.118)

Thus

d x = | s d t + t d s 3 y 2 2 s d s + 2 t d t − 2 y | | 2 x 3 y 2 3 x 2 − 2 y | , d y = | 2 x s d t + t d s 3 x 2 2 s d s + 2 t d t | | 2 x 3 y 2 3 x 2 − 2 y | . (4.119)

Determinant denominator

D = | 2 x 3 y 2 3 x 2 − 2 y | = − 4 x y − 9 x 2 y 2 = − ( 4 x y + 9 x 2 y 2 ) . (4.120)

Cramer's rule results simplified

d x = − ( 2 y s d t + 2 y t d s + 6 y 2 s d s + 6 y 2 t d t ) D , d y = 4 x s d s + 4 x t d t − 3 x 2 s d t − 3 x 2 t d s D . (4.121)

Step 4. Substitution into d z

d z = ( 2 x + y ) d x + x d y = N s d s + N t d t D , (4.122)

with

N s = 4 s x 2 − 12 s x y 2 − 6 s y 3 − 3 t x 3 − 4 t x y − 2 t y 2 , N t = − 3 s x 3 − 4 s x y − 2 s y 2 + 4 t x 2 − 12 t x y 2 − 6 t y 3 . (4.123)

Final partial derivatives (with positive denominator)

∂ z ∂ s = 3 t x 3 + 4 t x y + 2 t y 2 − 4 s x 2 + 12 s x y 2 + 6 s y 3 4 x y + 9 x 2 y 2 (4.124)
∂ z ∂ t = 3 s x 3 + 4 s x y + 2 s y 2 − 4 t x 2 + 12 t x y 2 + 6 t y 3 4 x y + 9 x 2 y 2 (4.125)

Two checks

Two simple checks confirm the result. First, the constraints are unchanged when s and t are exchanged, because s t and s 2 + t 2 are both symmetric in s and t . The formula for ∂ z ∂ t must therefore be the formula for ∂ z ∂ s with s and t exchanged, and it is. Second, we evaluate the result at a particular point. The values ( x , y , s , t ) = ( 2 , 1 , 7 , 0 ) satisfy both constraints, since 2 2 + 1 3 = 5 = 7 ⋅ 0 + 5 and 2 3 − 1 2 = 7 = ( 7 ) 2 + 0 2 . With t = 0 , the three terms of the numerator that contain t vanish, and

∂ z ∂ s = − 16 7 + 24 7 + 6 7 8 + 36 = 7 7 22 ≈ 0.84 . (4.126)

Figure 4.13 shows what this number means. For fixed s and t , each constraint is a curve in the ( x , y ) plane, and the point ( x , y ) is where the two curves cross. When s increases, the second curve moves, the crossing point slides along the first curve, and z = x 2 + x y changes. The derivative ∂ z ∂ s ≈ 0.84 is the rate of change at the starting point. Over a large step the average rate is smaller (about 0.26 for Δ s = 0.5 , because the rate decreases as the crossing point moves), but as the step shrinks, the ratio Δ z / Δ s approaches 0.84 ; a numerical difference quotient agrees with the formula to six decimal places.

The two constraint curves at t = 0: x^2 + y^3 = st + 5 (blue) and x^3 - y^2 = s^2 + t^2 (red, drawn at s = 7 and, faintly, at s = 7 + 0.5). As s increases, their crossing point moves from (2, 1) along the orange path, and z = x^2 + xy changes, initially at the rate z s = 77/22 0.84. The animation then shrinks the step, and z/ s approaches this value (from 0.264 to 0.839).
Figure 4.13. The two constraint curves at t = 0 : x 2 + y 3 = s t + 5 (blue) and x 3 − y 2 = s 2 + t 2 (red, drawn at s = 7 and, faintly, at s = 7 + 0.5 ). As s increases, their crossing point moves from ( 2 , 1 ) along the orange path, and z = x 2 + x y changes, initially at the rate ∂ z ∂ s = 7 7 / 22 ≈ 0.84 . The animation then shrinks the step, and Δ z / Δ s approaches this value (from 0.264 to 0.839 ).

A shortcut

If only ∂ z ∂ s is needed, we can set d t = 0 from the start. The right-hand sides of the linear system then become t d s and 2 s d s , and Cramer's rule gives ∂ x ∂ s and ∂ y ∂ s directly.

Example

For the same three equations as the previous example, namely z = x 2 + x y with x 2 + y 3 = s t + 5 and x 3 − y 2 = s 2 + t 2 , find ( ∂ s ∂ z ) x .

Solution.

Step 1. Set d x = 0

The subscript x says that x is the variable held fixed, so d x = 0 throughout and the differentials of the previous example simplify at once.

d z = x d y . (4.127)
3 y 2 d y = s d t + t d s , (4.128)
− 2 y d y = 2 s d s + 2 t d t . (4.129)

These form a linear system for d s , d t , and d y . The system becomes:

{ x d y = d z , t d s + s d t − 3 y 2 d y = 0 , 2 s d s + 2 t d t + 2 y d y = 0. (4.130)

Step 2. Solve using determinants

Writing as a determinant system, we get

d s = | d z 0 x 0 s − 3 y 2 0 2 t 2 y | | 0 0 x t s − 3 y 2 2 s 2 t 2 y | . (4.131)

Evaluating:

d s = ( 2 s y + 6 t y 2 ) d z x ( 2 t 2 − 2 s 2 ) . (4.132)

Thus

( ∂ s ∂ z ) x = s y + 3 t y 2 x ( t 2 − s 2 ) . (4.133)

4.8Chain Rule in Polar and Rectangular Coordinates

Video Lecture 14, Part 4: The Chain Rule in Polar Coordinates (16:33)

Let x , y be rectangular coordinates and r , θ be polar coordinates in a plane. The relations are

x = r cos ⁡ ( θ ) , y = r sin ⁡ ( θ ) , (4.134)

or equivalently

r = x 2 + y 2 , θ = tan − 1 ( y x ) . (4.135)

We want to study derivatives such as ∂ θ ∂ x , ∂ x ∂ θ , etc., and check whether they are reciprocals.

Step 1. Compute ∂ θ ∂ x

From

θ = arctan ( y x ) , (4.136)

we treat y as constant and differentiate:

∂ θ ∂ x = − y / x 2 1 + ( y / x ) 2 = − y r 2 . (4.137)

The last step used x 2 + y 2 = r 2 to clear the denominator.

Step 2. Compute ∂ x ∂ θ

From x = r cos ⁡ ( θ ) we get

∂ x ∂ θ = − r sin ⁡ ( θ ) = − y . (4.138)
Remark

Clearly,

∂ θ ∂ x ≠ 1 ∂ x ∂ θ . (4.139)

These derivatives are not reciprocals. The reason: ( ∂ θ ∂ x ) y means y is held constant, whereas ( ∂ x ∂ θ ) r means r is held constant. Since the conditions differ, they are not reciprocals.

The two derivatives move the point P along different paths: holding y fixed moves it horizontally (blue), while holding r fixed moves it along a circle (red). Because the paths differ, the two derivatives are not reciprocals of each other.
Figure 4.14. The two derivatives move the point P along different paths: holding y fixed moves it horizontally (blue), while holding r fixed moves it along a circle (red). Because the paths differ, the two derivatives are not reciprocals of each other.

Step 3. A reciprocal relation

Let’s compute

( ∂ x ∂ θ ) y . (4.140)

We use x = r cos ⁡ ( θ ) , y = r sin ⁡ ( θ ) , so with y constant:

( ∂ x ∂ θ ) y = y ( − csc 2 ⁡ ( θ ) ) = − y sin 2 ⁡ ( θ ) . (4.141)

Meanwhile,

( ∂ θ ∂ x ) y = − y r 2 . (4.142)

Now check:

( ∂ x ∂ θ ) y = 1 ( ∂ θ ∂ x ) y . (4.143)

So these are reciprocals.

RemarkRule

∂ u ∂ v and ∂ v ∂ u are not usually reciprocals. They are reciprocals only if the set of independent variables (besides u , v ) are the same in both cases.

Step 4. Using differentials

From θ = arctan ⁡ ( y / x ) we can find

d θ = x d y − y d x r 2 . (4.144)

From x = r cos ⁡ ( θ ) ,

d x = cos ⁡ ( θ ) d r − r sin ⁡ ( θ ) d θ . (4.145)

If y is constant ( d y = 0 ), then

d θ y = − y r 2 d x y , (4.146)

so

( ∂ θ ∂ x ) y = d θ y d x y = − y r 2 . (4.147)

By inversion,

( ∂ x ∂ θ ) y = d x y d θ y = − r 2 y , (4.148)

which is indeed the reciprocal.

Matrix notation

It is convenient to write

( d x d y ) = ( ∂ x ∂ r ∂ x ∂ θ ∂ y ∂ r ∂ y ∂ θ ) ( d r d θ ) = ( cos ⁡ ( θ ) − r sin ⁡ ( θ ) sin ⁡ ( θ ) r cos ⁡ ( θ ) ) ( d r d θ ) . (4.149)

Denote this Jacobian matrix as A .

Then the inverse relation is

( d r d θ ) = A − 1 ( d x d y ) . (4.150)

Carrying out the inversion, we obtain

( ∂ r ∂ x ∂ r ∂ y ∂ θ ∂ x ∂ θ ∂ y ) = ( cos ⁡ ( θ ) sin ⁡ ( θ ) − 1 r sin ⁡ ( θ ) 1 r cos ⁡ ( θ ) ) . (4.151)

Read off partial derivatives

Thus,

∂ r ∂ x = cos ⁡ ( θ ) = x r , ∂ r ∂ y = sin ⁡ ( θ ) = y r , (4.152)
∂ θ ∂ x = − 1 r sin ⁡ ( θ ) = − y r 2 , ∂ θ ∂ y = 1 r cos ⁡ ( θ ) = x r 2 . (4.153)
Remark

Notice: although individual pairs like ∂ θ ∂ x and ∂ x ∂ θ are not reciprocals, the Jacobian matrices ( cos ⁡ ( θ ) − r sin ⁡ ( θ ) sin ⁡ ( θ ) r cos ⁡ ( θ ) ) and ( cos ⁡ ( θ ) sin ⁡ ( θ ) − 1 r sin ⁡ ( θ ) 1 r cos ⁡ ( θ ) ) are inverses of each other.

4.9Change of Variables: Laplace Equation in Polar Coordinates

Video Lecture 14, Part 5: Laplace's Equation in Polar Coordinates (20:53)

We want to write the Laplace equation

∂ 2 f ∂ x 2 + ∂ 2 f ∂ y 2 = 0 (4.154)

in terms of polar coordinates ( r , θ ) , where

x = r cos ⁡ ( θ ) , y = r sin ⁡ ( θ ) . (4.155)

Step 1. First Derivatives

Way 1: Chain rule form

∂ f ∂ r = ∂ f ∂ x ∂ x ∂ r + ∂ f ∂ y ∂ y ∂ r = cos ⁡ ( θ ) ∂ f ∂ x + sin ⁡ ( θ ) ∂ f ∂ y , (4.156)
∂ f ∂ θ = ∂ f ∂ x ∂ x ∂ θ + ∂ f ∂ y ∂ y ∂ θ = − r sin ⁡ ( θ ) ∂ f ∂ x + r cos ⁡ ( θ ) ∂ f ∂ y . (4.157)

In matrix form,

( ∂ f ∂ r ∂ f ∂ θ ) = ( cos ⁡ ( θ ) sin ⁡ ( θ ) − r sin ⁡ ( θ ) r cos ⁡ ( θ ) ) ( ∂ f ∂ x ∂ f ∂ y ) . (4.158)

Equivalently,

( ∂ f ∂ x ∂ f ∂ y ) = ( cos ⁡ ( θ ) − sin ⁡ ( θ ) r sin ⁡ ( θ ) cos ⁡ ( θ ) r ) ( ∂ f ∂ r ∂ f ∂ θ ) . (4.159)

Step 2. Second Derivatives — Full Expansion

Now compute

∂ 2 f ∂ x 2 = ∂ ∂ x ( cos ⁡ ( θ ) ∂ f ∂ r − sin ⁡ ( θ ) r ∂ f ∂ θ ) , (4.160)
∂ 2 f ∂ y 2 = ∂ ∂ y ( sin ⁡ ( θ ) ∂ f ∂ r + cos ⁡ ( θ ) r ∂ f ∂ θ ) . (4.161)

Recall from Step 1:

∂ f ∂ x = cos ⁡ ( θ ) ∂ f ∂ r − sin ⁡ ( θ ) r ∂ f ∂ θ , ∂ f ∂ y = sin ⁡ ( θ ) ∂ f ∂ r + cos ⁡ ( θ ) r ∂ f ∂ θ . (4.162)

We will also use the relations

∂ r ∂ x = cos ⁡ ( θ ) , ∂ r ∂ y = sin ⁡ ( θ ) , ∂ θ ∂ x = − sin ⁡ ( θ ) r , ∂ θ ∂ y = cos ⁡ ( θ ) r , (4.163)

and

∂ ∂ x ( 1 r ) = − cos ⁡ ( θ ) r 2 , ∂ ∂ y ( 1 r ) = − sin ⁡ ( θ ) r 2 . (4.164)

Compute ∂ 2 f ∂ x 2 .

Write

∂ f ∂ x = A − B , A = cos ⁡ ( θ ) ∂ f ∂ r , B = sin ⁡ ( θ ) r ∂ f ∂ θ . (4.165)

Term A x :

∂ A ∂ x = ( ∂ ∂ x cos ⁡ ( θ ) ) ∂ f ∂ r + cos ⁡ ( θ ) ∂ ∂ x ( ∂ f ∂ r ) . (4.166)

Now

∂ ∂ x cos ⁡ ( θ ) = − sin ⁡ ( θ ) ∂ θ ∂ x = sin 2 ⁡ ( θ ) r , (4.167)

and

∂ ∂ x ( ∂ f ∂ r ) = ∂ 2 f ∂ r 2 ∂ r ∂ x + ∂ 2 f ∂ r ∂ θ ∂ θ ∂ x = cos ⁡ ( θ ) ∂ 2 f ∂ r 2 − sin ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ . (4.168)

Thus

∂ A ∂ x = sin 2 ⁡ ( θ ) r ∂ f ∂ r + cos 2 ⁡ ( θ ) ∂ 2 f ∂ r 2 − sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ . (4.169)

Term B x :

∂ B ∂ x = ∂ ∂ x ( sin ⁡ ( θ ) r ) ∂ f ∂ θ + sin ⁡ ( θ ) r ∂ ∂ x ( ∂ f ∂ θ ) . (4.170)

Compute

∂ ∂ x ( sin ⁡ ( θ ) r ) = − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 , (4.171)

and

∂ ∂ x ( ∂ f ∂ θ ) = ∂ 2 f ∂ r ∂ θ ∂ r ∂ x + ∂ 2 f ∂ θ 2 ∂ θ ∂ x = cos ⁡ ( θ ) ∂ 2 f ∂ r ∂ θ − sin ⁡ ( θ ) r ∂ 2 f ∂ θ 2 . (4.172)

Hence

∂ B ∂ x = − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 ∂ f ∂ θ + sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ − sin 2 ⁡ ( θ ) r 2 ∂ 2 f ∂ θ 2 . (4.173)

Combine:

∂ 2 f ∂ x 2 = cos 2 ⁡ ( θ ) ∂ 2 f ∂ r 2 + sin 2 ⁡ ( θ ) r ∂ f ∂ r − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ + 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 ∂ f ∂ θ + sin 2 ⁡ ( θ ) r 2 ∂ 2 f ∂ θ 2 . (4.174)

Compute ∂ 2 f ∂ y 2 .

Similarly,

∂ f ∂ y = C + D , C = sin ⁡ ( θ ) ∂ f ∂ r , D = cos ⁡ ( θ ) r ∂ f ∂ θ . (4.175)

Term C y :

∂ C ∂ y = ( ∂ ∂ y sin ⁡ ( θ ) ) ∂ f ∂ r + sin ⁡ ( θ ) ∂ ∂ y ( ∂ f ∂ r ) . (4.176)

Now

∂ ∂ y sin ⁡ ( θ ) = cos ⁡ ( θ ) ∂ θ ∂ y = cos 2 ⁡ ( θ ) r , (4.177)

and

∂ ∂ y ( ∂ f ∂ r ) = ∂ 2 f ∂ r 2 ∂ r ∂ y + ∂ 2 f ∂ r ∂ θ ∂ θ ∂ y = sin ⁡ ( θ ) ∂ 2 f ∂ r 2 + cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ . (4.178)

Thus

∂ C ∂ y = cos 2 ⁡ ( θ ) r ∂ f ∂ r + sin 2 ⁡ ( θ ) ∂ 2 f ∂ r 2 + sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ . (4.179)

Term D y :

∂ D ∂ y = ∂ ∂ y ( cos ⁡ ( θ ) r ) ∂ f ∂ θ + cos ⁡ ( θ ) r ∂ ∂ y ( ∂ f ∂ θ ) . (4.180)

Now

∂ ∂ y ( cos ⁡ ( θ ) r ) = − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 , (4.181)

and

∂ ∂ y ( ∂ f ∂ θ ) = ∂ 2 f ∂ r ∂ θ ∂ r ∂ y + ∂ 2 f ∂ θ 2 ∂ θ ∂ y = sin ⁡ ( θ ) ∂ 2 f ∂ r ∂ θ + cos ⁡ ( θ ) r ∂ 2 f ∂ θ 2 . (4.182)

Thus

∂ D ∂ y = − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 ∂ f ∂ θ + sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ + cos 2 ⁡ ( θ ) r 2 ∂ 2 f ∂ θ 2 . (4.183)

Combine:

∂ 2 f ∂ y 2 = sin 2 ⁡ ( θ ) ∂ 2 f ∂ r 2 + cos 2 ⁡ ( θ ) r ∂ f ∂ r + 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r ∂ 2 f ∂ r ∂ θ − 2 sin ⁡ ( θ ) cos ⁡ ( θ ) r 2 ∂ f ∂ θ + cos 2 ⁡ ( θ ) r 2 ∂ 2 f ∂ θ 2 . (4.184)

Final Combination.

Adding the two results, every term containing sin ⁡ ( θ ) cos ⁡ ( θ ) cancels between them, and the surviving sin 2 ⁡ ( θ ) + cos 2 ⁡ ( θ ) factors reduce to 1 :

∂ 2 f ∂ x 2 + ∂ 2 f ∂ y 2 = ∂ 2 f ∂ r 2 + 1 r ∂ f ∂ r + 1 r 2 ∂ 2 f ∂ θ 2 . (4.185)
∂ 2 f ∂ x 2 + ∂ 2 f ∂ y 2 = ∂ 2 f ∂ r 2 + 1 r ∂ f ∂ r + 1 r 2 ∂ 2 f ∂ θ 2 (4.186)

Final Result

The first two terms are often written more compactly by recognising a product rule, which gives the form of Laplace's equation used throughout Chapter 10:

1 r ∂ ∂ r ( r ∂ f ∂ r ) + 1 r 2 ∂ 2 f ∂ θ 2 = 0. (4.187)

Note the extra 1 r ∂ f ∂ r term, which has no counterpart in Cartesian coordinates. It is not an algebraic accident: it is what accounts for the fact that circles of larger radius have more room, and it is the reason solutions in polar coordinates involve ln ⁡ ( r ) and powers r n rather than the linear functions of the Cartesian case.

As an example, the function f = ln ⁡ ( r ) depends only on r , so its θ derivatives vanish and Laplace's equation reduces to

f r r + 1 r f r = − 1 r 2 + 1 r 2 = 0 . (4.188)

Thus ln ⁡ ( r ) is a solution, and the term 1 r f r , which has no counterpart in Cartesian coordinates, is exactly what makes it one. Physically, ln ⁡ ( r ) is, up to constants, the electric potential around a long, straight charged wire. As a second check, the function f = r 2 cos ⁡ ( 2 θ ) , which equals x 2 − y 2 , gives 2 cos ⁡ ( 2 θ ) + 2 cos ⁡ ( 2 θ ) − 4 cos ⁡ ( 2 θ ) = 0 in polar form, in agreement with f x x + f y y = 2 − 2 = 0 in Cartesian form.

The function f = (r) on a ring around the origin, drawn over a polar grid. It is a solution of Laplace's equation.
Figure 4.15. The function f = ln ⁡ ( r ) on a ring around the origin, drawn over a polar grid. It is a solution of Laplace's equation.
Remark

This change of variables illustrates how PDEs can be transformed into more convenient coordinate systems. In particular, Laplace’s equation in polar form is crucial in problems with radial or angular symmetry.

4.10Leibniz’s Rule

Video Lecture 14, Part 6: Leibniz's Rule (26:40)

Consider a function defined by an integral:

f ( x ) = d F ( x ) d x , F ( x ) = ∫ a x f ( t ) d t . (4.189)

Then by the Fundamental Theorem of Calculus,

d d x ∫ a x f ( t ) d t = f ( x ) . (4.190)

If instead we write

∫ x a f ( t ) d t = F ( a ) − F ( x ) , (4.191)

then

d d x ∫ x a f ( t ) d t = − f ( x ) . (4.192)

General Leibniz Rule

If

I ( x ) = ∫ u ( x ) v ( x ) f ( x , t ) d t , (4.193)

then differentiating with respect to x gives

d I d x = f ( x , v ( x ) ) d v d x − f ( x , u ( x ) ) d u d x + ∫ u ( x ) v ( x ) ∂ f ( x , t ) ∂ x d t . (4.194)

This is known as Leibniz’s Rule. Each of its three terms has a geometric meaning, as a change in the area under the curve f ( x , t ) between t = u and t = v when x increases by d x (Figure 4.16). The first term is the strip gained as the right edge moves out, f ( x , v ) d v ; the second is the strip lost as the left edge moves, f ( x , u ) d u ; and the third is the band added because the curve itself rises, ( ∫ u v ∂ f ∂ x d t ) d x .

The three terms of Leibniz's rule as three pieces of area, for f = e^xt/t between u = x and v = 2x. The step dx is drawn large for visibility.
Figure 4.16. The three terms of Leibniz's rule as three pieces of area, for f = e x t / t between u = x and v = 2 x . The step d x is drawn large for visibility.
ExampleLeibniz rule with variable limits

Evaluate

I ( x ) = ∫ x 2 x e x t t d t . (4.195)

Solution.

Step 1. Apply Leibniz’s rule

d I d x = e x ( 2 x ) 2 x d ( 2 x ) d x − e x ( x ) x d ( x ) d x + ∫ x 2 x ∂ ∂ x ( e x t t ) d t . (4.196)

Step 2. Simplify

d I d x = e 2 x 2 2 x ( 2 ) − e x 2 x ( 1 ) + ∫ x 2 x e x t d t . (4.197)
d I d x = e 2 x 2 x − e x 2 x + [ 1 x e x t ] t = x 2 x . (4.198)

Step 3. Evaluate the integral

∫ x 2 x e x t d t = 1 x ( e 2 x 2 − e x 2 ) . (4.199)

Step 4. Collect terms

d I d x = e 2 x 2 x − e x 2 x + 1 x ( e 2 x 2 − e x 2 ) . (4.200)
d I d x = 2 x ( e 2 x 2 − e x 2 ) . (4.201)
Remark

Leibniz’s rule generalizes the Fundamental Theorem of Calculus by handling integrals with variable limits and integrands depending on the parameter x .

4.11Where Partial Differentiation Is Used

Video Lecture 14, Part 7: Partial Derivatives at Work (31:03)

The thermodynamic examples earlier in this chapter are the most immediate application, but the techniques developed here recur throughout the rest of these notes. It is worth seeing the pattern now.

Remark

Notice how much of the chapter reduces to one habit: write the total differential, then impose whatever is being held constant. The chain rule, implicit differentiation, the reciprocal relations and the cyclic relation (4.26) were all obtained that way. If a problem asks how one quantity changes when another is varied under some constraint, start by writing d f and setting the constrained differential to zero.

Summary Table

IdeaFormulaNotes
Partial derivative ∂ f ∂ x Differentiate in x , all other variables held fixed.
Held-constant notation ( ∂ z ∂ r ) θ The subscript says what is fixed; without it the symbol is ambiguous.
Mixed partials f x y = f y x Equal for sufficiently smooth f (Clairaut).
Total differential d f = ∂ f ∂ x d x + ∂ f ∂ y d y The workhorse of the chapter.
Chain rule d u d t = ∂ u ∂ x d x d t + ∂ u ∂ y d y d t One term per intermediate variable.
Matrix chain rulerow vector × JacobianShapes: 1 × n times n × m .
Implicit differentiationDifferentiate the whole relation, then solveFor curves not given as y = f ( x ) .
Reciprocal rule ( ∂ u ∂ v ) w = 1 / ( ∂ v ∂ u ) w Only when the same variable is held fixed.
Cyclic relation ( ∂ p ∂ V ) T ( ∂ V ∂ T ) p ( ∂ T ∂ p ) V = − 1 Note the minus sign.
Two-variable Taylor ∑ 1 n ! ( ( x − a ) ∂ X + ( y − b ) ∂ Y ) n f Include every mixed derivative of each order.
Laplacian in polar ∂ 2 f ∂ r 2 + 1 r ∂ f ∂ r + 1 r 2 ∂ 2 f ∂ θ 2 The 1 r ∂ f ∂ r term has no Cartesian analogue.
Leibniz's rule d I d x = f ( x , v ) v ′ − f ( x , u ) u ′ + ∫ u v ∂ f ∂ x d t Variable limits and a parameter in the integrand.

For the Interested Reader

This chapter is the multivariable calculus a physics course actually uses, compressed. If any of it went past too quickly, the sources below cover the same ground at a gentler pace. Everything listed is free.

Videos

Derivatives are much easier to grasp from a picture than from a limit. 3Blue1Brown's Essence of Calculus explains what each rule of this chapter actually does — the chain and product rules, higher derivatives, and implicit differentiation seen geometrically:

Video

Visualizing the chain rule and product rule — 3Blue1Brown

Video thumbnail for Visualizing the chain rule and product rule — 3Blue1BrownWatch on YouTube

Open video on YouTube

Video

Implicit differentiation, what's going on here? — 3Blue1Brown

Video thumbnail for Implicit differentiation, what's going on here? — 3Blue1BrownWatch on YouTube

Open video on YouTube

Video

Higher order derivatives — 3Blue1Brown

Video thumbnail for Higher order derivatives — 3Blue1BrownWatch on YouTube

Open video on YouTube

Two short Khan Academy clips build the specific picture of a partial derivative as the slope of a slice through a surface:

Video

Partial derivatives, introduction — Khan Academy

Video thumbnail for Partial derivatives, introduction — Khan AcademyWatch on YouTube

Open video on YouTube

Video

Partial derivatives and graphs — Khan Academy

Video thumbnail for Partial derivatives and graphs — Khan AcademyWatch on YouTube

Open video on YouTube

Websites

Remark

One thing you will not find in the calculus sources: the notation ( ∂ T ∂ p ) V with an explicit subscript. Mathematics courses usually fix the independent variables once and never revisit the choice, so the ambiguity never arises. In thermodynamics it arises constantly, which is why this chapter labours the point. For that side of the subject a thermodynamics text will serve you better than a calculus one.

Video lectures

Each section of this chapter links to the part of a lecture that teaches it. The full lectures are below, and all of them are in the course playlist.

Video Lecture 13: Partial Differentiation (full lecture)

Video Lecture 14: Implicit Differentiation, Coordinates and Leibniz's Rule (full lecture)