Sign in

Libre University uses your GitHub account. Signing in is only needed to sit a final test, so the score is kept on your profile.

Partial derivatives

A surface has a different slope in every direction through a point, but along the two coordinate directions the slope is an ordinary derivative that the calculus of one variable already knows how to take.

The previous lesson defined limits and continuity in two variables and found that freezing one variable at a time is a poor test of continuity, because it looks along only two paths. As a way of measuring slopes, freezing works well. This lesson defines the partial derivative, computes it with the rules of Calculus I, reads it off real models, differentiates twice, and meets the theorem that makes second derivatives manageable, together with the function where it fails.

Freeze every variable but one

Let f be a function of x and y and fix a point (a,b). Holding y at b leaves x↦f(x,b), a function of one variable, and its ordinary derivative at x=a is the partial derivative of f with respect to x:

fx(a,b)=limh→0f(a+h,b)-f(a,b)h

Only x moves in the quotient; y sits at b throughout. Holding x at a and moving y instead gives fy(a,b), the same limit with f(a,b+k) in place of f(a+h,b).

Two notations are in use and they mean exactly the same thing: fx, compact enough for long calculations, and the Leibniz form ∂f∂x, whose curly ∂ warns that other variables are being held still. Adrien-Marie Legendre used the symbol in 1786 and Carl Jacobi made it standard in 1841.

Take the paraboloid f(x,y)=x2+y2 at (3,4), where f=25. Holding y=4, the difference quotient is

(3+h)2+16-25h=6h+h2h=6+h

which tends to 6, so fx(3,4)=6. The same work in y gives 8+k, so fy(3,4)=8. At h=0.001 the quotients are 6.001 and 8.001, the east and north slopes found by stepping away from (3,4) when this surface first appeared, in the lesson on functions of several variables.

Nobody evaluates that limit for every function. Since fx is an ordinary derivative, every rule of Calculus I applies, and the one new instruction is to treat every other variable as a constant. In x2+y2 the term y2 is a constant as far as x is concerned, so fx=2x and likewise fy=2y, and fx(3,4)=6 falls out by substitution. In x2y3 with y frozen, y3 is a coefficient like the 5 in 5x2, so the x partial is 2xy3 and the y partial is 3x2y2. The product rule returns only when both factors contain the moving variable, and the chain rule whenever the moving variable sits inside another function. In three or more variables nothing changes: gz freezes x and y and differentiates in z.

Example. Find fx and fy for f(x,y)=x2y3+sin(xy), and evaluate both at (1,2).

With y constant, x2y3 gives 2xy3, and sin(xy) needs the chain rule with inner function xy, whose x derivative is y. So fx=2xy3+ycos(xy), and with x constant the same steps give fy=3x2y2+xcos(xy). At (1,2), cos2=-0.4161, so fx=16-0.8323=15.168 and fy=12-0.4161=11.584. A central difference in x with step 0.001 also gives 15.168: a partial derivative can always be checked by nudging one input.

Now you. Find fx and fy for f(x,y)=xexy+y2 at (1,1), to three decimal places.

Answer

In x both factors of xexy move, so the product rule gives fx=exy+xyexy, which at (1,1) is 2e=5.437. In y the factor x is a constant: fy=x2exy+2y=e+2=4.718.

The slope of a slice

Cut the surface z=f(x,y) with the vertical plane y=b and what remains is the curve z=f(x,b), the trace of the surface in that plane. Its slope at x=a is fx(a,b). So fx is the slope of the surface for a walker heading due east, in the direction of increasing x, and fy is the slope for a walker heading due north. Neither says anything about a walker heading north-east.

On the paraboloid, the slice y=4 is the parabola z=x2+16, whose tangent line at x=3 has slope 6. In space that line passes through (3,4,25) and climbs 6 units for each unit east, so it runs along ⟨1,0,6⟩; the slice x=3 gives a tangent line along ⟨0,1,8⟩. Two lines through one point determine a plane, and any tangent plane at (3,4,25) must contain both. Whether the surface actually has one is a question for the next lesson.

Each partial derivative has its own meaning and its own units. The wind chill index W(T,v)=13.12+0.6215T-11.37v0.16+0.3965Tv0.16, with T in degrees Celsius and v in km/h, has WT=0.6215+0.3965v0.16, which at v=30 is 1.305: in that wind each degree of real cooling feels like 1.3 degrees. It also has Wv=0.16v-0.84(-11.37+0.3965T), which at T=-5 and v=30 is -0.123 degrees per km/h. Raising the wind from 30 to 31 km/h lowers the index by 0.121, slightly less than the rate because the curve flattens as the wind grows.

A rate with everything else fixed

In a model, a partial derivative answers the question every controlled experiment asks: change this one thing and hold the rest. The ideal gas law p=nRT/V, with R=8.314 joules per mole per kelvin, has three. With n and V held, nR/V is a constant coefficient; with n and T held, V appears as V-1. So

∂p∂T=nRV,∂p∂V=-nRTV2

and ∂p/∂n=RT/V. For one mole at T=273.15 K in V=0.0224 cubic metres, where p=101383 Pa, these give ∂p/∂T=371.2 Pa per kelvin and ∂p/∂V=-101383/0.0224=-4.526×106 Pa per cubic metre, or -4526 Pa per litre. Finite steps from the same state, taken in the lesson on functions of several variables, found that one extra kelvin raises the pressure by 371 Pa and one extra litre lowers it by 4333 Pa. The temperature figures agree exactly because p is linear in T. The volume step falls short of the rate because p falls less and less steeply as V grows, so a whole litre averages a weakening slope.

Example. A plant has the Cobb-Douglas production function Q=1.01L3/4K1/4, fitted to American manufacturing data in 1928, and runs at L=16, K=81. Find the marginal products QL and QK, the extra output per extra unit of each input with the other held fixed.

Treating K as constant, QL=1.01×34L-1/4K1/4=0.7575(K/L)1/4, and the fourth root of 81/16 is 32, so QL=1.136. Treating L as constant, QK=0.2525(L/K)3/4=0.2525×827=0.0748. An actual extra unit of labour raises output from 24.24 to 25.37, an increase of 1.128, close to the rate. As a check, LQL+KQK=18.18+6.06=24.24=Q. That is no accident: the derivatives show LQL=34Q and KQK=14Q, so if each input were paid its marginal product, labour would take three quarters of the output, close to the share of wages Douglas found in the data.

Now you. Find QL and QK for the same plant at L=81, K=16, to three decimal places.

Answer

Now (K/L)1/4=23, so QL=0.7575×23=0.505, and (L/K)3/4=278, so QK=0.2525×278=0.852. With capital scarce, its marginal product is now the larger. The check 81×0.505+16×0.852=54.54 matches Q.

Second and mixed partials

The partials fx and fy are functions of x and y again, so they have partials of their own. Differentiating fx in x gives fxx, the concavity of the slice y=b, and fyy is the concavity of the slice x=a. The new objects are the mixed partials: fxy differentiates fx with respect to y, measuring how the eastward slope changes as the walker steps north, and fyx differentiates fy with respect to x.

The subscript reads left to right, fxy=(fx)y, while Leibniz notation reads right to left, outwards from f:

fxy=∂∂y(∂f∂x)=∂2f∂y∂x

The conventions are opposite, which matters for the one function below where the order changes the answer. The pure partials are unambiguous: fxx=∂2f∂x2.

For x2+y2, fxx=fyy=2 and fxy=fyx=0: the eastward slope 2x does not depend on y, so walking north does not change it. For x2y3, fxy is the y derivative of 2xy3 and fyx is the x derivative of 3x2y2, and both are 6xy2. Different calculations, same function.

Example. For f(x,y)=x3y2+ye2x, find all four second partial derivatives at (1,2).

The first partials are fx=3x2y2+2ye2x and fy=2x3y+e2x. Then fxx=6xy2+4ye2x, fyy=2x3, and both mixed partials come out as 6x2y+2e2x, one from fx and one from fy. At (1,2), with e2=7.389, fxx=12+59.11=71.11, fyy=2 and fxy=fyx=12+14.78=26.78.

Now you. For f(x,y)=x2siny+xy3, find fxx, fyy and both mixed partials at (2,1), to three decimal places.

Answer

The first partials are fx=2xsiny+y3 and fy=x2cosy+3xy2. Then fxx=2siny=1.683 and fyy=-x2siny+6xy=8.634. Both mixed partials are 2xcosy+3y2=4cos1+3=5.161.

Clairaut's theorem

The agreement of the mixed partials in every example so far is a theorem, used by Leonhard Euler and Alexis Clairaut in the 1730s and 1740s and first proved rigorously by Hermann Schwarz in 1873. If fxy and fyx both exist and are continuous on an open disc around (a,b), then fxy(a,b)=fyx(a,b). Every function built from polynomials, exponentials, sines and logarithms satisfies the hypothesis wherever it is defined, which is why the order of differentiation is normally ignored.

The proof shows where continuity enters. For small h and k, combine the values at the four corners of a small rectangle:

Δ=f(a+h,b+k)-f(a+h,b)-f(a,b+k)+f(a,b)

Read as g(a+h)-g(a) with g(x)=f(x,b+k)-f(x,b), the mean value theorem gives Δ=hg′(c) for some c between a and a+h, and g′(c)=fx(c,b+k)-fx(c,b) is a difference of fx in the y direction, which the mean value theorem again turns into kfxy(c,d). So Δ/hk equals fxy at some point of the rectangle. Grouping the four terms the other way shows it also equals fyx at some point of the rectangle. Shrink the rectangle, and continuity forces both values to their values at (a,b), which must therefore agree.

A check on a less friendly function: for ln(x2+y2), fx=2x/(x2+y2) and fy=2y/(x2+y2), and the quotient rule gives -4xy/(x2+y2)2 for both mixed partials. They are continuous away from the origin, and at (1,2) both equal -8/25=-0.32.

When the mixed partials disagree

The hypothesis of continuity is not decoration. Giuseppe Peano published the standard counterexample in 1884:

f(x,y)=xy(x2-y2)x2+y2,f(0,0)=0

Since |x2-y2|≤x2+y2, its size is at most |xy|, so it is continuous everywhere, and its first partials exist everywhere. The trouble is at the second level.

Since fxy(0,0) is the y derivative of y↦fx(0,y), first find fx all along the y axis. For y≠0, from the definition,

fx(0,y)=limh→0f(h,y)-0h=limh→0y(h2-y2)h2+y2=-y

and at y=0 the quotient is 0 because f(h,0)=0. So fx(0,y)=-y on the whole axis, and fxy(0,0)=-1. Exchanging the roles, fy(x,0)=limk→0x(x2-k2)/(x2+k2)=x, so fyx(0,0)=1. The order of differentiation changes the answer.

Nudges alone confirm it. A central difference with step 10-7 estimates fx(0,0.01)=-0.0100 and fx(0,-0.01)=0.0100, and the outer quotient (-0.01-0.01)/0.02 is -1.0000. Nudging in the other order gives +1.0000, and a smaller outer step changes neither.

Clairaut is not contradicted, because the hypothesis fails. Away from the origin

fxy=(x2-y2)(x4+10x2y2+y4)(x2+y2)3

with numerator and denominator of the same degree, the pattern the previous lesson flagged: in polar coordinates r cancels and only the direction remains. It equals 1 along the x axis, -1 along the y axis and 0 along y=x, however close to the origin, so fxy is not continuous there.

A glimpse of partial differential equations

Once partial derivatives exist, equations can be written between them, and much of physics consists of such equations. In 1822 Joseph Fourier published the heat equation for the temperature u(x,t) at position x along a thin bar at time t:

∂u∂t=α∂2u∂x2

A point warms where the temperature profile curves upwards, where it is colder than the average of its neighbours. The thermal diffusivity α is about 1.11×10-4 square metres per second for copper.

Checking a proposed solution needs only partial derivatives. For u=e-αk2tsin(kx), holding x gives ut=-αk2u, and holding t gives ux=ke-αk2tcos(kx) and uxx=-k2u. So αuxx=ut everywhere. For a copper bar one metre long with its ends held at zero and a single hump of heat, k=π, and the hump halves when απ2t=ln2, after 0.693/(1.11×10-4×9.870)=633 seconds, about ten and a half minutes.

When a flat plate has reached a steady temperature, ut=0 and the two dimensional heat equation becomes Laplace's equation, uxx+uyy=0, which Pierre-Simon Laplace studied in the 1780s in his work on gravitation. The function x2-y2 satisfies it, since 2-2=0, and so does exsiny. For ln(x2+y2), the first partials above give uxx=2(y2-x2)/(x2+y2)2 and uyy=2(x2-y2)/(x2+y2)2, which cancel. The paraboloid x2+y2 fails, with sum 4: a bowl cannot be a steady temperature, since its centre is colder than everything around it.

Two slopes are not enough

Partial derivatives reduce the calculus of several variables to the calculus of one, but they look along only two lines through each point, and the previous lesson showed how little two lines can see. Its function

g(x,y)=xyx2+y2,g(0,0)=0

takes the constant value m/(1+m2) along each line y=mx through the origin, so it has no limit there and is not continuous. Yet g(x,0)=0 for every x, so the difference quotient (g(h,0)-g(0,0))/h is 0 for every h and gx(0,0)=0. Likewise gy(0,0)=0. Both partial derivatives exist at the origin, and both are zero.

The two slopes describe the plane z=0. Along the diagonal y=x, though, the surface stays at height 12 all the way in, at (0.001,0.001) as much as at (1,1). There is a cliff at the origin that the two coordinate slices step exactly around, and no plane can be tangent to a surface torn like that.

So the existence of fx and fy at a point does not make f smooth there, or even continuous. The partials remain the right numbers to compute, but their existence is too weak to build on. What is needed is a condition that looks in every direction at once: near the point the surface should be close to a plane, with an error small compared with the distance moved. That is differentiability, the existence of a genuine tangent plane, and it is the subject of the next lesson.