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.
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) change when x and y both move along a curve? The answer, the chain ruleF′(t)=fxϕ′(t)+fyψ′(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) can be pictured as a landscape over the (x,y)-plane; below it is drawn as a colour map, darker where ∣f∣ is larger. Through a point P=(a,b) we can cut the landscape along the line y=b. The cut is the graph of a function of one variable, t↦f(a+t,b), and its slope at t=0 is the partial derivativefx(a,b). Cutting along x=a gives fy(a,b) in the same way.
We could cut in any other direction too. Along the line through P at angle α, the slice is t↦f(a+tcosα,b+tsinα). If f is well behaved, its slope is determined by the two partial derivatives alone: it is fxcosα+fysinα. That is the chain rule in its simplest case.
ExplorePartial derivatives are slopes of slices
Try this.Drag P around the saddle x2−y2 and watch the three slices. Find a point where fx=0 but fy=0. Then turn the angle α and compare the slope of the third slice with the prediction in the read-out.
f(x,y)=x2−y2; point 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 P: fx=1.6, fy=−1 (the dashed tangents in the first two slices). Chain rule prediction for the slope of the third slice: fxcosα+fysinα=0.4243. Actual slope: 0.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α of the two partial slopes: two numbers control all directions at once.
Precise statements
DefinitionPartial derivativesHardy: §156
Let f(x,y) be a function of two independent variables. If the limits
exist, they are the partial derivatives (Hardy: partial differential coefficients) of f, also written ∂x∂f, ∂y∂f or Dxf, Dyf.
A partial derivative depends on which variables are held fixed, not only on the one that varies. If u=x+y+z with x,y,z independent, then ux=1. But if we choose as independent variables x, η=x+y and ζ=x+y+z, then u=ζ, and now ux=0: holding η and ζ fixed while x changes forces y and z to change too.
TheoremThe chain rule (theorem of the total differential coefficient)Hardy: §157
Let fx and fy be continuous functions of (x,y) (in the sense of §108) in a region containing the curve x=ϕ(t), y=ψ(t), where ϕ′ and ψ′ are continuous. Then F(t)=f{ϕ(t),ψ(t)} is differentiable and
This is the case that made the notation ∂ necessary. With f(x,y)=x+y and y=1−x, the function f{x,1−x}=1 has derivative 0, but ∂f/∂x=1. The left side, df/dx, means “substitute, then differentiate”; ∂f/∂x means “differentiate with y fixed, then substitute”.
TheoremExistence of partial derivatives is not enoughHardy: §158
(i) The function f(x,y)=x2+y22xy, with f=0 when x=0 or y=0, has partial derivatives at every point, but is discontinuous at the origin.
(ii) The function f(x,y)=x2+y22xy(x+y), with f=0 when x=0 or y=0, is continuous everywhere and has partial derivatives everywhere, but along x=y=t we have F(t)=2t, F′(0)=2, while fx(0,0)⋅1+fy(0,0)⋅1=0. The chain rule fails.
Proofs
ProofThe chain rule
Strategy
Move from (x,y) to (x+ξ,y+η) in two stages, first changing x with y+η fixed, then changing y with x 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).
Set up the increments
Let t change to t+τ, and let x=ϕ(t), y=ψ(t) change to x+ξ, y+η. Then ξ,η→0 and ξ/τ→ϕ′(t), η/τ→ψ′(t) as τ→0.
Split the change of f into two one-variable changes
The first bracket is a change in x alone (with second argument y+η), so it equals ξfx(x+θξ,y+η) for some 0<θ<1. The second is a change in y alone, and equals ηfy(x,y+θ′η) with 0<θ′<1.
Divide by τ and let τ→0
τF(t+τ)−F(t)=τξfx(x+θξ,y+η)+τηfy(x,y+θ′η).
The points (x+θξ,y+η) and (x,y+θ′η) tend to (x,y), though in a way we do not control. Because fx and fy are continuous functions of the pair(x,y), their values there tend to fx(x,y) and fy(x,y). The right side therefore tends to fxϕ′(t)+fyψ′(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+η) need not tend to fx(0,0)=0.
ProofThe counter-examples of §158
Strategy
Compute the partial derivatives at the origin from the definition (along the axes the function is identically 0), then look along the diagonal.
Both functions vanish on the axes
For both functions f(h,0)=f(0,k)=0, so fx(0,0)=limh→0(0−0)/h=0 and likewise fy(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=x (with x=0), f=2x2/(2x2)=1. So there are points arbitrarily close to the origin with f=1, while f(0,0)=0.
(ii) is continuous at the origin
Since ∣2xy∣≤x2+y2, we have ∣f(x,y)∣≤∣x+y∣≤∣x∣+∣y∣, which tends to 0 as (x,y)→(0,0).
(ii) breaks the chain rule
With x=y=t, F(t)=2t2⋅2t/(2t2)=2t for t=0 and F(0)=0; so F′(0)=2. The chain rule would give fx(0,0)⋅1+fy(0,0)⋅1=0.
∎
ExploreWhere the chain rule breaks
Try this.This is §158's continuous example, with P at the origin. Turn α from 0° to 90° and compare the actual slope of the third slice with the chain-rule prediction. Then move P away from the origin. Finally choose example (i), 2xy/(x2+y2), and put P back at the origin.
f(x,y)=x2+y22xy(x+y), value 0 on the axes; point 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 P: fx=0, fy=0 (the dashed tangents in the first two slices). Chain rule prediction for the slope of the third slice: fxcosα+fysinα=0. Actual slope: 1.414. They disagree: the partial derivatives exist but are not continuous at P.
What to notice
At the origin both partial slopes are 0, so the prediction is always 0, but the diagonal slice (α=45°) climbs with slope 2: the slice in direction α is a straight line of slope 2cosαsinα(cosα+sinα). Away from the origin the partial derivatives are continuous and the two agree again. For example (i) the diagonal slice jumps from 0 to 1 at the origin: a function with both partial derivatives can fail to be continuous.
(Along x=y=t Hardy’s slope is 2; in the widget the slice is parametrised by distance along the line, x=y=t/2, which turns 2 into 2.)
From now on, as Hardy says, we assume the continuity of all the derivatives that occur.
Let x=rcosθ, y=rsinθ, so that r=x2+y2. Show that ∂x∂r=rx=cosθ and ∂r∂x=cosθ. Explain why ∂x∂r is not1/∂r∂x.
Hint
Each partial derivative holds a different second variable fixed: y in the first, θ in the second.
Solution
Differentiating r=x2+y2 with y fixed gives ∂r/∂x=x/x2+y2=cosθ. Differentiating x=rcosθ with θ fixed gives ∂x/∂r=cosθ. Their product is cos2θ, not 1.
For a function of one variable, dy/dx and dx/dy describe the same change seen from two sides, so they are reciprocals. Here they describe different changes. In ∂r/∂x, the point moves horizontally (with y fixed), and r grows only by the projection of that step on the radius. In ∂x/∂r the point moves along the radius (with θ fixed), and x grows by the projection of the radial step on the horizontal. Each projection contributes a factor cosθ. Similarly ∂θ/∂x=−y/r2=−sinθ/r, while ∂x/∂θ=−rsinθ.
Exercise●○○Hardy: Examples LX, 3
Prove that if z=f(ax+by), where f is a differentiable function of one variable, then b∂x∂z=a∂y∂z.
Hint
Use the one-variable chain rule with y fixed, then with x fixed.
Solution
With y fixed, u=ax+by has du/dx=a, so zx=af′(ax+by). With x fixed, zy=bf′(ax+by). Hence bzx=abf′=azy. (Geometrically: z is constant along every line ax+by=const, so its slope in the direction (b,−a) along those lines is bzx−azy=0.)
ExerciseChecking the chain rule●○○Hardy: Examples LXI, 1–2
Verify the chain rule for f(x,y)=x2+y2 along (a) the circle x=acost, y=asint, and (b) the curve x=(1−t2)/(1+t2), y=2t/(1+t2).
Hint
In both cases F(t) is constant. What must fxx′+fyy′ come out as?
Solution
fx=2x, fy=2y, so the chain rule gives F′(t)=2(xx′+yy′).
(a) xx′+yy′=acost(−asint)+asint(acost)=0, and indeed F(t)=a2 is constant.
(b) x′=−4t/(1+t2)2 and y′=2(1−t2)/(1+t2)2. Then xx′+yy′=(1+t2)3−4t(1−t2)+4t(1−t2)=0, and indeed x2+y2=1 on this curve: it is a rational parametrisation of the unit circle.
ExercisePolar rates●●○Hardy: Examples LXI, 5
Let x and y be functions of t, and r, θ the polar coordinates of (x,y). Show that r′=(xx′+yy′)/r and θ′=(xy′−yx′)/r2, dashes denoting derivatives with respect to t.
Hint
Apply the chain rule to r=x2+y2 and to θ=arctan(y/x), using the partial derivatives of the first exercise.
Solution
rx=x/r and ry=y/r, so r′=rxx′+ryy′=(xx′+yy′)/r. For θ=arctan(y/x) (locally; any branch differs by a constant), θx=1+y2/x2−y/x2=−r2y and θy=1+y2/x21/x=r2x, so θ′=(xy′−yx′)/r2. These partial derivatives are continuous away from the origin, so the chain rule applies there.
ExercisePartial derivatives of a discontinuous function●●○Hardy: §158
For f(x,y)=2xy/(x2+y2) (and 0 on the axes), compute fx at a point (x,y)=(0,0), and show that fx is unbounded near the origin.
Hint
Differentiate the quotient with y fixed. Then look at the points (0,y) with y small.
Solution
fx=(x2+y2)22y(x2+y2)−2xy⋅2x=(x2+y2)22y(y2−x2). At (0,y) with y=0 this is 2/y, which is unbounded as y→0, although fx(0,0)=0. So fx is badly discontinuous at the origin, as it must be, given that f itself is discontinuous there.
Check yourself
Check yourselfTrue or false?
If fx and fy exist at every point of the plane, then f is continuous.
Why
False. Hardy’s 2xy/(x2+y2) (with 0 on the axes) has both partial derivatives everywhere but is discontinuous at the origin: it equals 1 all along the line y=x. Partial derivatives only look along two lines through each point.
Check yourselfChoose one
Let u=x+y+z. Take as independent variables x, η=x+y and ζ=x+y+z. What is ∂u/∂x?
Why
In terms of the new variables u=ζ, which does not involve x. 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 yourselfEnter a number
Let f(x,y)=xy and F(t)=f(t,t2). Use the chain rule to compute F′(1).
Why
fx=y, fy=x, x′=1, y′=2t. At t=1: F′(1)=1⋅1+1⋅2=3. Check: F(t)=t3, so F′(1)=3.
Check yourselfChoose one
In the proof of the chain rule, where is the continuity of fx and fy used?
Why
The mean value theorem needs only the existence of the one-variable derivatives. But it produces values of fx at points like (x+θξ,y+η) that approach (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) is the slope at a of the slice x↦f(x,b); nothing more than one-variable differentiation with y held fixed.
A partial derivative depends on which variables are held fixed: ∂r/∂x=1/(∂x/∂r).
Chain rule: if fx,fy are continuous, dtdf(ϕ(t),ψ(t))=fxϕ′+fyψ′. Proof: split the step into an x-step and a y-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.