Two routes to one derivative
A function f(x, y) has two mixed second partial derivatives. One differentiates in x first and then in y, written . The other differentiates in y first and then in x, written .
The routes pass through different first derivatives, on one and on the other. The mixed derivative theorem says that they arrive at the same function: for a well-behaved f, the order of mixed partial differentiation makes no difference. It is also known as Schwarz’s theorem, or Clairaut’s theorem.
Checking it
Take . In x first: , and differentiating that in y gives . In y first: , and differentiating that in x gives . Both routes give , which is 24 at (1, 2).
Take . In x first: , and in y the product rule gives . In y first: , and in x the product rule gives . Both are , which is at (1, 2).
Why the order does not matter
Take a small rectangle with corners (a, b), (a + h, b), (a, b + k) and (a + h, b + k). Find the change in f across the rectangle in the x direction along its top edge, and subtract the same change along its bottom edge. That is f(a + h, b + k) − f(a, b + k) − f(a + h, b) + f(a, b).
Now do it the other way round: the change in the y direction along the right edge, minus the change along the left edge. That is the same four heights with the same four signs. Divided by h k, the first way approximates and the second approximates , and they are one number.
For on the rectangle from (1, 2) to (1.5, 2.5), the corner heights are 8, 18, 15.625 and 35.15625. The combination is 35.15625 − 15.625 − 18 + 8 = 9.53125, and divided by 0.5 × 0.5 it is 38.125. The mixed derivative at the center of the rectangle, (1.25, 2.25), is 37.97, and the two get closer as the rectangle shrinks.
The four corners where is measured: (1, 2), (1.5, 2), (1, 2.5) and (1.5, 2.5), with heights 8, 18, 15.625 and 35.15625. The two arrows are the steps h and k, both 0.5. Taking the x differences first or the y differences first uses these same four heights with the same signs.
When it can fail
The theorem needs the mixed partial derivatives to be continuous near the point. Polynomials, exponentials, sines and cosines, and the functions built from them away from a zero denominator, all satisfy that, so for nearly every surface you meet the order does not matter.
The standard exception is , with f(0, 0) = 0. Along the y-axis its x-slope is , and along the x-axis its y-slope is . So at the origin , while . The mixed derivatives of this function are not continuous at the origin, so the theorem does not apply there.
The usual mistakes
Expecting the mixed derivatives to differ because their middle steps differ. and are different functions, but both lead to .
Expecting them to agree only at special points. For they are the same function, , at every point.
Lowering only one power. For , differentiating in y gives , and then in x gives : each differentiation brings its own power down and lowers it by one.
Price and advertising
In the application below, a shop’s weekly sales depend on the price p and the advertising a. One mixed derivative says how advertising changes the effect of the price, and the other says how the price changes the effect of advertising. By the theorem they are the same number.
Worked example: An Online Shop's Price and Advertising: How Each Changes the Sales, and How Each Changes the Effect of the Other
Question An online shop sells a phone case at p dollars and spends a hundred dollars a week on advertising. Its weekly sales are modeled by S(p, a) = 20√a(40 − p) cases, for prices from $10 to $35 and advertising from $400 to $3600 a week. At present p = 20 and a = 16. (a) Find the weekly sales, and ∂ S∂ p and ∂ S∂ a at present, and say what each one means. (b) Find both mixed partial derivatives at present: ∂2 S∂ a ∂ p, which differentiates first in p and then in a, and ∂2 S∂ p ∂ a, which takes the other order. Say what each one tells the shop. Then use one of them to estimate ∂ S∂ p if the advertising rises to $2000 a week, and compare the estimate with the exact value.
1.(a) At present, S(20, 16) = 20 × √16 × (40 − 20) = 20 × 4 × 20 = 1600 cases a week.
(a) At a price of $20 with $1600 of advertising a week, the shop sells 1600 cases. The line is the cross-section a = 16: sales against price. 2.Holding a constant, ∂ S∂ p = −20√a = −80: each extra dollar on the price loses about 80 sales a week. Holding p constant, ∂ S∂ a = 20(40 − p) × 12√a = 10(40 − p)√a = 2004 = 50: each extra $100 of advertising brings about 50 more sales a week.
The gradient of that line is ∂ S∂ p = −80 cases per dollar; with the price held, each extra $100 of advertising adds about ∂ S∂ a = 50 cases. 3.(b) Differentiate ∂ S∂ p = −20√a with respect to a: ∂2 S∂ a ∂ p = −10√a = −104 = −2.5. Each extra $100 of advertising makes the sales lost per dollar of price about 2.5 cases larger.
(b) At a = 20 the line is steeper: ∂ S∂ p changes by about −2.5 for each extra $100 of advertising. 4.Differentiate ∂ S∂ a = 10(40 − p)√a with respect to p: ∂2 S∂ p ∂ a = −10√a = −2.5. Each extra dollar on the price makes $100 of advertising bring about 2.5 fewer sales. The two mixed derivatives are equal, as the mixed derivative theorem says, since every second partial derivative of S is continuous for a > 0.
Differentiating in the other order gives the same −2.5: each extra dollar on the price takes about 2.5 cases off what $100 of advertising brings. 5.Raising the advertising from a = 16 to a = 20 changes ∂ S∂ p by about −2.5 × 4 = −10, to about −90 cases per dollar. Exactly, ∂ S∂ p = −20√20 ≈ −89.4, so the estimate is within 0.6 of it.
The estimate of the gradient at a = 20 is −90 cases per dollar; the exact gradient is −20√20 ≈ −89.4.
Answer: (a) 1600 cases a week; ∂ S∂ p = −80 cases per dollar and ∂ S∂ a = 50 cases per $100 of advertising; (b) both mixed derivatives are −2.5; the estimate of ∂ S∂ p at $2000 a week is −90 cases per dollar, against −20√20 ≈ −89.4 exactly
Common mistakes
- Expecting the two mixed derivatives to differ because they describe different effects for the shop. The mixed derivative theorem makes them equal wherever the second partial derivatives are continuous, which holds here for every a > 0.
- Differentiating √a as 1√a. The derivative of a12 is 12a−12 = 12√a, so ∂ S∂ a at present is 50 cases, not 100.