Chapter VII · Additional theorems in the differential and integral calculus

Partial derivatives and the chain rule

§§156–158 40 min

Differentiating a function of two variables one variable at a time, differentiating it along a curve, and why the chain rule needs continuous partial derivatives.

Why this matters

Most quantities depend on more than one variable: the area of a rectangle on two sides, the pressure of a gas on its volume and temperature. §§156–158 extends differentiation to such functions. The first step is easy, and Hardy stresses that it contains no new idea: a partial derivative is an ordinary derivative taken with all the other variables held fixed. The second step is the real theorem: how fast does f(x,y)f(x, y) change when xx and yy both move along a curve? The answer, the chain rule F′(t)=fx ϕ′(t)+fy ψ′(t)F'(t) = f_x\,\phi'(t) + f_y\,\psi'(t), is true only under a hypothesis that is easy to forget, and Hardy’s counter-examples show what goes wrong without it.

The idea

A function z=f(x,y)z = f(x, y) can be pictured as a landscape over the (x,y)(x, y)-plane; below it is drawn as a colour map, darker where ∣f∣|f| is larger. Through a point P=(a,b)P = (a, b) we can cut the landscape along the line y=by = b. The cut is the graph of a function of one variable, t↦f(a+t,b)t \mapsto f(a + t, b), and its slope at t=0t = 0 is the partial derivative fx(a,b)f_x(a, b). Cutting along x=ax = a gives fy(a,b)f_y(a, b) in the same way.

We could cut in any other direction too. Along the line through PP at angle α\alpha, the slice is t↦f(a+tcos⁡α, b+tsin⁡α)t \mapsto f(a + t\cos\alpha,\ b + t\sin\alpha). If ff is well behaved, its slope is determined by the two partial derivatives alone: it is fxcos⁡α+fysin⁡αf_x\cos\alpha + f_y\sin\alpha. That is the chain rule in its simplest case.

Explore Partial derivatives are slopes of slices

Try this. Drag PP around the saddle x2−y2x^2 - y^2 and watch the three slices. Find a point where fx=0f_x = 0 but fy≠0f_y \ne 0. Then turn the angle α\alpha and compare the slope of the third slice with the prediction in the read-out.

f(x,y)=x2−y2f(x, y) = x^2 - y^2; point P=(0.8, 0.5)P = (0.8,\ 0.5)
xy
  • f > 0 (darker = larger)
  • f < 0
  • P (drag) and the direction α
slice y = b: t ↦ f(a + t, b)
t
slice x = a: t ↦ f(a, b + t)
t
slice at angle α = 45°
t
Partial derivatives at PP: fx=1.6f_x = 1.6, fy=−1f_y = -1 (the dashed tangents in the first two slices).
Chain rule prediction for the slope of the third slice: fxcos⁡α+fysin⁡α=0.4243f_x\cos\alpha + f_y\sin\alpha = 0.4243. Actual slope: 0.42430.4243. They agree.
What to notice

Each slice is an ordinary curve, and each partial derivative is an ordinary slope. For this smooth function the slope in every direction is the combination fxcos⁡α+fysin⁡αf_x\cos\alpha + f_y\sin\alpha of the two partial slopes: two numbers control all directions at once.

Precise statements

Definition Partial derivatives Hardy: §156

Let f(x,y)f(x, y) be a function of two independent variables. If the limits

fx(x,y)=lim⁡h→0f(x+h,y)−f(x,y)h,fy(x,y)=lim⁡k→0f(x,y+k)−f(x,y)kf_x(x, y) = \lim_{h \to 0} \frac{f(x + h, y) - f(x, y)}{h}, \qquad f_y(x, y) = \lim_{k \to 0} \frac{f(x, y + k) - f(x, y)}{k}

exist, they are the partial derivatives (Hardy: partial differential coefficients) of ff, also written ∂f∂x\dfrac{\partial f}{\partial x}, ∂f∂y\dfrac{\partial f}{\partial y} or DxfD_x f, DyfD_y f.

A partial derivative depends on which variables are held fixed, not only on the one that varies. If u=x+y+zu = x + y + z with x,y,zx, y, z independent, then ux=1u_x = 1. But if we choose as independent variables xx, η=x+y\eta = x + y and ζ=x+y+z\zeta = x + y + z, then u=ζu = \zeta, and now ux=0u_x = 0: holding η\eta and ζ\zeta fixed while xx changes forces yy and zz to change too.

Theorem The chain rule (theorem of the total differential coefficient) Hardy: §157

Let fxf_x and fyf_y be continuous functions of (x,y)(x, y) (in the sense of §108) in a region containing the curve x=ϕ(t)x = \phi(t), y=ψ(t)y = \psi(t), where ϕ′\phi' and ψ′\psi' are continuous. Then F(t)=f{ϕ(t),ψ(t)}F(t) = f\{\phi(t), \psi(t)\} is differentiable and

F′(t)=fx ϕ′(t)+fy ψ′(t),ordFdt=∂f∂xdxdt+∂f∂ydydt,F'(t) = f_x\,\phi'(t) + f_y\,\psi'(t), \qquad\text{or}\qquad \frac{dF}{dt} = \frac{\partial f}{\partial x}\frac{dx}{dt} + \frac{\partial f}{\partial y}\frac{dy}{dt},

where fxf_x, fyf_y are evaluated at (ϕ(t),ψ(t))(\phi(t), \psi(t)).

An important special case is t=xt = x, with y=ψ(x)y = \psi(x):

ddxf{x,ψ(x)}=∂f∂x+∂f∂y ψ′(x).\frac{d}{dx} f\{x, \psi(x)\} = \frac{\partial f}{\partial x} + \frac{\partial f}{\partial y}\,\psi'(x).

This is the case that made the notation ∂\partial necessary. With f(x,y)=x+yf(x, y) = x + y and y=1−xy = 1 - x, the function f{x,1−x}=1f\{x, 1 - x\} = 1 has derivative 00, but ∂f/∂x=1\partial f/\partial x = 1. The left side, df/dxdf/dx, means “substitute, then differentiate”; ∂f/∂x\partial f/\partial x means “differentiate with yy fixed, then substitute”.

Theorem Existence of partial derivatives is not enough Hardy: §158

(i) The function f(x,y)=2xyx2+y2f(x, y) = \dfrac{2xy}{x^2 + y^2}, with f=0f = 0 when x=0x = 0 or y=0y = 0, has partial derivatives at every point, but is discontinuous at the origin.

(ii) The function f(x,y)=2xy(x+y)x2+y2f(x, y) = \dfrac{2xy(x + y)}{x^2 + y^2}, with f=0f = 0 when x=0x = 0 or y=0y = 0, is continuous everywhere and has partial derivatives everywhere, but along x=y=tx = y = t we have F(t)=2tF(t) = 2t, F′(0)=2F'(0) = 2, while fx(0,0)⋅1+fy(0,0)⋅1=0f_x(0,0)\cdot 1 + f_y(0,0)\cdot 1 = 0. The chain rule fails.

Proofs

Proof The chain rule
Strategy

Move from (x,y)(x, y) to (x+ξ,y+η)(x + \xi, y + \eta) in two stages, first changing xx with y+ηy + \eta fixed, then changing yy with xx fixed. Each stage is a change in one variable only, so the ordinary mean value theorem applies. Continuity of the partial derivatives then lets the intermediate points slide back to (x,y)(x, y).

Set up the increments

Let tt change to t+τt + \tau, and let x=ϕ(t)x = \phi(t), y=ψ(t)y = \psi(t) change to x+ξx + \xi, y+ηy + \eta. Then ξ,η→0\xi, \eta \to 0 and ξ/τ→ϕ′(t)\xi/\tau \to \phi'(t), η/τ→ψ′(t)\eta/\tau \to \psi'(t) as τ→0\tau \to 0.

Split the change of ff into two one-variable changes

F(t+τ)−F(t)={f(x+ξ,y+η)−f(x,y+η)}+{f(x,y+η)−f(x,y)}.F(t + \tau) - F(t) = \bigl\{f(x + \xi, y + \eta) - f(x, y + \eta)\bigr\} + \bigl\{f(x, y + \eta) - f(x, y)\bigr\}.

Apply the mean value theorem to each bracket

The first bracket is a change in xx alone (with second argument y+ηy + \eta), so it equals ξfx(x+θξ, y+η)\xi f_x(x + \theta\xi,\ y + \eta) for some 0<θ<10 < \theta < 1. The second is a change in yy alone, and equals ηfy(x, y+θ′η)\eta f_y(x,\ y + \theta'\eta) with 0<θ′<10 < \theta' < 1.

Divide by τ\tau and let τ→0\tau \to 0

F(t+τ)−F(t)τ=ξτ fx(x+θξ, y+η)+ητ fy(x, y+θ′η).\frac{F(t + \tau) - F(t)}{\tau} = \frac{\xi}{\tau}\,f_x(x + \theta\xi,\ y + \eta) + \frac{\eta}{\tau}\,f_y(x,\ y + \theta'\eta).

The points (x+θξ,y+η)(x + \theta\xi, y + \eta) and (x,y+θ′η)(x, y + \theta'\eta) tend to (x,y)(x, y), though in a way we do not control. Because fxf_x and fyf_y are continuous functions of the pair (x,y)(x, y), their values there tend to fx(x,y)f_x(x, y) and fy(x,y)f_y(x, y). The right side therefore tends to fxϕ′(t)+fyψ′(t)f_x\phi'(t) + f_y\psi'(t).

The last step is exactly where §158’s second example fails. Its partial derivatives exist everywhere but are not continuous at the origin (approaching along different lines gives different limits), so fx(x+θξ,y+η)f_x(x + \theta\xi, y + \eta) need not tend to fx(0,0)=0f_x(0, 0) = 0.

Proof The counter-examples of §158
Strategy

Compute the partial derivatives at the origin from the definition (along the axes the function is identically 00), then look along the diagonal.

Both functions vanish on the axes

For both functions f(h,0)=f(0,k)=0f(h, 0) = f(0, k) = 0, so fx(0,0)=lim⁡h→0(0−0)/h=0f_x(0, 0) = \lim_{h\to 0} (0 - 0)/h = 0 and likewise fy(0,0)=0f_y(0, 0) = 0. Away from the origin the formulas are quotients of polynomials with non-zero denominator, so the partial derivatives exist there too.

(i) is discontinuous at the origin

On the line y=xy = x (with x≠0x \ne 0), f=2x2/(2x2)=1f = 2x^2/(2x^2) = 1. So there are points arbitrarily close to the origin with f=1f = 1, while f(0,0)=0f(0, 0) = 0.

(ii) is continuous at the origin

Since ∣2xy∣≤x2+y2|2xy| \le x^2 + y^2, we have ∣f(x,y)∣≤∣x+y∣≤∣x∣+∣y∣|f(x, y)| \le |x + y| \le |x| + |y|, which tends to 00 as (x,y)→(0,0)(x, y) \to (0, 0).

(ii) breaks the chain rule

With x=y=tx = y = t, F(t)=2t2⋅2t/(2t2)=2tF(t) = 2t^2 \cdot 2t/(2t^2) = 2t for t≠0t \ne 0 and F(0)=0F(0) = 0; so F′(0)=2F'(0) = 2. The chain rule would give fx(0,0)⋅1+fy(0,0)⋅1=0f_x(0,0)\cdot 1 + f_y(0,0) \cdot 1 = 0.

Explore Where the chain rule breaks

Try this. This is §158's continuous example, with PP at the origin. Turn α\alpha from 0°0° to 90°90° and compare the actual slope of the third slice with the chain-rule prediction. Then move PP away from the origin. Finally choose example (i), 2xy/(x2+y2)2xy/(x^2+y^2), and put PP back at the origin.

f(x,y)=2xy(x+y)x2+y2f(x, y) = \dfrac{2xy(x+y)}{x^2+y^2}, value 0 on the axes; point P=(0, 0)P = (0,\ 0)
xy
  • f > 0 (darker = larger)
  • f < 0
  • P (drag) and the direction α
slice y = b: t ↦ f(a + t, b)
t
slice x = a: t ↦ f(a, b + t)
t
slice at angle α = 45°
t
Partial derivatives at PP: fx=0f_x = 0, fy=0f_y = 0 (the dashed tangents in the first two slices).
Chain rule prediction for the slope of the third slice: fxcos⁡α+fysin⁡α=0f_x\cos\alpha + f_y\sin\alpha = 0. Actual slope: 1.4141.414. They disagree: the partial derivatives exist but are not continuous at P.
What to notice

At the origin both partial slopes are 00, so the prediction is always 00, but the diagonal slice (α=45°\alpha = 45°) climbs with slope 2\sqrt2: the slice in direction α\alpha is a straight line of slope 2cos⁡αsin⁡α(cos⁡α+sin⁡α)2\cos\alpha\sin\alpha(\cos\alpha + \sin\alpha). Away from the origin the partial derivatives are continuous and the two agree again. For example (i) the diagonal slice jumps from 00 to 11 at the origin: a function with both partial derivatives can fail to be continuous.

(Along x=y=tx = y = t Hardy’s slope is 22; in the widget the slice is parametrised by distance along the line, x=y=t/2x = y = t/\sqrt2, which turns 22 into 2\sqrt2.)

From now on, as Hardy says, we assume the continuity of all the derivatives that occur.

Worked examples and exercises

Exercise Polar coordinates ●●○ Hardy: Examples LX, 1–2

Let x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta, so that r=x2+y2r = \sqrt{x^2 + y^2}. Show that ∂r∂x=xr=cos⁡θ\dfrac{\partial r}{\partial x} = \dfrac{x}{r} = \cos\theta and ∂x∂r=cos⁡θ\dfrac{\partial x}{\partial r} = \cos\theta. Explain why ∂r∂x\dfrac{\partial r}{\partial x} is not 1/∂x∂r1 \big/ \dfrac{\partial x}{\partial r}.

Hint
Each partial derivative holds a different second variable fixed: yy in the first, θ\theta in the second.

Solution

Differentiating r=x2+y2r = \sqrt{x^2 + y^2} with yy fixed gives ∂r/∂x=x/x2+y2=cos⁡θ\partial r/\partial x = x/\sqrt{x^2 + y^2} = \cos\theta. Differentiating x=rcos⁡θx = r\cos\theta with θ\theta fixed gives ∂x/∂r=cos⁡θ\partial x/\partial r = \cos\theta. Their product is cos⁡2θ\cos^2\theta, not 11.

For a function of one variable, dy/dxdy/dx and dx/dydx/dy describe the same change seen from two sides, so they are reciprocals. Here they describe different changes. In ∂r/∂x\partial r/\partial x, the point moves horizontally (with yy fixed), and rr grows only by the projection of that step on the radius. In ∂x/∂r\partial x/\partial r the point moves along the radius (with θ\theta fixed), and xx grows by the projection of the radial step on the horizontal. Each projection contributes a factor cos⁡θ\cos\theta. Similarly ∂θ/∂x=−y/r2=−sin⁡θ/r\partial\theta/\partial x = -y/r^2 = -\sin\theta/r, while ∂x/∂θ=−rsin⁡θ\partial x/\partial\theta = -r\sin\theta.

Exercise ●○○ Hardy: Examples LX, 3

Prove that if z=f(ax+by)z = f(ax + by), where ff is a differentiable function of one variable, then b ∂z∂x=a ∂z∂yb\,\dfrac{\partial z}{\partial x} = a\,\dfrac{\partial z}{\partial y}.

Hint
Use the one-variable chain rule with yy fixed, then with xx fixed.

Solution

With yy fixed, u=ax+byu = ax + by has du/dx=adu/dx = a, so zx=af′(ax+by)z_x = a f'(ax + by). With xx fixed, zy=bf′(ax+by)z_y = b f'(ax + by). Hence bzx=abf′=azyb z_x = ab f' = a z_y. (Geometrically: zz is constant along every line ax+by=constax + by = \text{const}, so its slope in the direction (b,−a)(b, -a) along those lines is bzx−azy=0b z_x - a z_y = 0.)

Exercise Checking the chain rule ●○○ Hardy: Examples LXI, 1–2

Verify the chain rule for f(x,y)=x2+y2f(x, y) = x^2 + y^2 along (a) the circle x=acos⁡tx = a\cos t, y=asin⁡ty = a\sin t, and (b) the curve x=(1−t2)/(1+t2)x = (1 - t^2)/(1 + t^2), y=2t/(1+t2)y = 2t/(1 + t^2).

Hint
In both cases F(t)F(t) is constant. What must fxx′+fyy′f_x x' + f_y y' come out as?

Solution

fx=2xf_x = 2x, fy=2yf_y = 2y, so the chain rule gives F′(t)=2(xx′+yy′)F'(t) = 2(xx' + yy').

(a) xx′+yy′=acos⁡t (−asin⁡t)+asin⁡t (acos⁡t)=0xx' + yy' = a\cos t\,(-a\sin t) + a\sin t\,(a\cos t) = 0, and indeed F(t)=a2F(t) = a^2 is constant.

(b) x′=−4t/(1+t2)2x' = -4t/(1 + t^2)^2 and y′=2(1−t2)/(1+t2)2y' = 2(1 - t^2)/(1 + t^2)^2. Then xx′+yy′=−4t(1−t2)+4t(1−t2)(1+t2)3=0xx' + yy' = \dfrac{-4t(1 - t^2) + 4t(1 - t^2)}{(1 + t^2)^3} = 0, and indeed x2+y2=1x^2 + y^2 = 1 on this curve: it is a rational parametrisation of the unit circle.

Exercise Polar rates ●●○ Hardy: Examples LXI, 5

Let xx and yy be functions of tt, and rr, θ\theta the polar coordinates of (x,y)(x, y). Show that r′=(xx′+yy′)/rr' = (xx' + yy')/r and θ′=(xy′−yx′)/r2\theta' = (xy' - yx')/r^2, dashes denoting derivatives with respect to tt.

Hint
Apply the chain rule to r=x2+y2r = \sqrt{x^2 + y^2} and to θ=arctan⁡(y/x)\theta = \arctan(y/x), using the partial derivatives of the first exercise.

Solution

rx=x/rr_x = x/r and ry=y/rr_y = y/r, so r′=rxx′+ryy′=(xx′+yy′)/rr' = r_x x' + r_y y' = (xx' + yy')/r. For θ=arctan⁡(y/x)\theta = \arctan(y/x) (locally; any branch differs by a constant), θx=−y/x21+y2/x2=−yr2\theta_x = \dfrac{-y/x^2}{1 + y^2/x^2} = -\dfrac{y}{r^2} and θy=1/x1+y2/x2=xr2\theta_y = \dfrac{1/x}{1 + y^2/x^2} = \dfrac{x}{r^2}, so θ′=(xy′−yx′)/r2\theta' = (xy' - yx')/r^2. These partial derivatives are continuous away from the origin, so the chain rule applies there.

Exercise Partial derivatives of a discontinuous function ●●○ Hardy: §158

For f(x,y)=2xy/(x2+y2)f(x, y) = 2xy/(x^2 + y^2) (and 00 on the axes), compute fxf_x at a point (x,y)≠(0,0)(x, y) \ne (0, 0), and show that fxf_x is unbounded near the origin.

Hint
Differentiate the quotient with yy fixed. Then look at the points (0,y)(0, y) with yy small.

Solution

fx=2y(x2+y2)−2xy⋅2x(x2+y2)2=2y(y2−x2)(x2+y2)2f_x = \dfrac{2y(x^2 + y^2) - 2xy \cdot 2x}{(x^2 + y^2)^2} = \dfrac{2y(y^2 - x^2)}{(x^2 + y^2)^2}. At (0,y)(0, y) with y≠0y \ne 0 this is 2/y2/y, which is unbounded as y→0y \to 0, although fx(0,0)=0f_x(0, 0) = 0. So fxf_x is badly discontinuous at the origin, as it must be, given that ff itself is discontinuous there.

Check yourself

Check yourself True or false?

If fxf_x and fyf_y exist at every point of the plane, then ff is continuous.

Why

False. Hardy’s 2xy/(x2+y2)2xy/(x^2 + y^2) (with 00 on the axes) has both partial derivatives everywhere but is discontinuous at the origin: it equals 11 all along the line y=xy = x. Partial derivatives only look along two lines through each point.

Check yourself Choose one

Let u=x+y+zu = x + y + z. Take as independent variables xx, η=x+y\eta = x + y and ζ=x+y+z\zeta = x + y + z. What is ∂u/∂x\partial u/\partial x?

Why

In terms of the new variables u=ζu = \zeta, which does not involve xx. A partial derivative depends on the whole list of independent variables, not just on the one that varies (Hardy’s remark after Examples LX).

Check yourself Enter a number

Let f(x,y)=xyf(x, y) = xy and F(t)=f(t,t2)F(t) = f(t, t^2). Use the chain rule to compute F′(1)F'(1).

Why

fx=yf_x = y, fy=xf_y = x, x′=1x' = 1, y′=2ty' = 2t. At t=1t = 1: F′(1)=1⋅1+1⋅2=3F'(1) = 1 \cdot 1 + 1 \cdot 2 = 3. Check: F(t)=t3F(t) = t^3, so F′(1)=3F'(1) = 3.

Check yourself Choose one

In the proof of the chain rule, where is the continuity of fxf_x and fyf_y used?

Why

The mean value theorem needs only the existence of the one-variable derivatives. But it produces values of fxf_x at points like (x+θξ,y+η)(x + \theta\xi, y + \eta) that approach (x,y)(x, y) along no particular line, and only continuity in the two-variable sense of §108 makes those values converge. §158’s example shows the step genuinely fails without it.

Hardy’s language

‘partial differentiation’ with respect to x is exactly the same process as ordinary differentiation, the only novelty lying in the presence in f of a second variable y independent of x.

— G. H. Hardy, §156

Summary

Summary
  • fx(a,b)f_x(a, b) is the slope at aa of the slice x↦f(x,b)x \mapsto f(x, b); nothing more than one-variable differentiation with yy held fixed.
  • A partial derivative depends on which variables are held fixed: ∂r/∂x≠1/(∂x/∂r)\partial r/\partial x \ne 1/(\partial x/\partial r).
  • Chain rule: if fx,fyf_x, f_y are continuous, ddtf(ϕ(t),ψ(t))=fxϕ′+fyψ′\frac{d}{dt} f(\phi(t), \psi(t)) = f_x\phi' + f_y\psi'. Proof: split the step into an xx-step and a yy-step and use the mean value theorem on each.
  • Existence of partial derivatives does not give continuity, nor the chain rule (§158); their continuity does.