A1443 of 55
0 XP
  1. Hook
  2. Play
  3. Predict
  4. Name it
  5. Check
  6. Explain

A14 · Lesson 43 · The derivative in several variables

The best linear approximation, the Jacobian, the chain rule and error propagation

For a function of one variable, the derivative is a number. For a map from ℝn to ℝm, such as node voltages as functions of component values, the derivative is a matrix: the best linear approximation to the map near a point. Defining it properly takes care, because a function can have partial derivatives in every coordinate direction and still not be differentiable. With the right definition come the chain rule, the mean value inequality, and the formulas engineers use every day to propagate tolerances and measurement errors through a calculation.

  • The surface is f(x,y)=xyx2+y2 (with f(0, 0) = 0), shown by shading and contours.
  • Along both axes f is 0, so both partial derivatives at the origin are 0. But along the line y = x it's ½, and along y = −x it's −½: f isn't even continuous at the origin.
  • So partial derivatives alone don't make a function differentiable. Move the slider to see f on a line through the origin at angle θ: it's constant, 12sin⁡2θ, right up to the origin.

Predict

f(x,y)=x2y near (1, 2). Estimate f(1.01, 2.02) from the derivative.

Name it

The derivative

f:ℝn→ℝm is differentiable at x if there's a linear map Df(x) (an m × n matrix) with

f(x+h)=f(x)+Df(x)h+o(‖h‖),

meaning the error divided by ‖h‖ goes to 0. Df(x) is the Jacobian, with entries ∂fi∂xj.

Partials aren't enough

Partial derivatives existing doesn't imply differentiability, or even continuity, as xyx2+y2 shows. But if all partial derivatives exist and are continuous near x, then f is differentiable there.

Chain rule and mean value inequality

D(g∘f)(x)=Dg(f(x))Df(x): matrices multiply. For vector-valued f there's no mean value equality, but there is an inequality: on a convex set, ‖f(x)−f(y)‖≤sup⁡‖Df‖‖x−y‖, with the operator norm of lesson 38.

Error propagation

A small error δx in the inputs gives δf≈Dfδx. For a scalar f with independent input errors:

  • worst case: |δf|≤∑i|∂f∂xi||δxi|;
  • random, with standard deviations σi: σf≈∑i(∂f∂xiσi)2.

Second order

f(x+h)=f(x)+∇f⋅h+12hTHh+o(‖h‖2), with the Hessian Hij=∂2f∂xi∂xj, symmetric when the second partials are continuous. That's the basis of Newton's method for optimization and of testing critical points.

Worked example

f(x,y)=(x2y,x+sin⁡y). Find Df at (1, 0) and estimate f(1.01, 0.02).

Show the solution
  1. The derivative. Df=(2xyx21cos⁡y)
  2. At (1, 0). Df(1,0)=(0111)
  3. Linear estimate. With f(1, 0) = (0, 1) and h = (0.01, 0.02): f≈(0,1)+(0.02,0.03)=(0.02,1.03)
  4. Compare with the exact value. Exactly, f(1.01,0.02)=(0.020402,1.029999). The errors, 4×10−4 and 10−6, are of order ‖h‖2, as the definition requires.
  5. The second component. It's almost linear here, since sin⁡y≈y.

Answer Df(1,0)=(0111), and f(1.01,0.02)≈(0.02,1.03).

Worked example

Show that f(x,y)=xyx2+y2 (f(0, 0) = 0) has both partial derivatives at the origin but isn't differentiable there.

Show the solution
  1. The partials. On the axes f is identically 0, so fx(0,0)=fy(0,0)=0.
  2. What differentiability would need. Its derivative would be the zero matrix, and f(h)=o(‖h‖).
  3. Look along the diagonal. Along h = (t, t), for every t ≠ 0, f=t22t2=12 which doesn't even go to 0.
  4. Conclude. So f isn't continuous at the origin, let alone differentiable.
  5. Why partials aren't enough. The partials only look along two directions; differentiability demands a linear approximation in every direction at once, with a uniform error.

Answer both partials are 0 at the origin, but f is ½ all along the diagonal, so f isn't even continuous there, let alone differentiable.

Worked example

P = V²/R with V = 5.00 ± 0.05 V and R = 100 ± 1 Ω. Propagate the errors.

Show the solution
  1. Nominal power. P = 0.25 W.
  2. Sensitivity to V. ∂P∂V=2VR=0.1W/V
  3. Sensitivity to R. ∂P∂R=−V2R2=−0.0025W/Ω
  4. Contributions. 0.1×0.05=0.005W 0.0025×1=0.0025W
  5. Worst case. |δP|≤0.0075W or 3%.
  6. Independent errors. If the errors are independent with those standard deviations: σP=0.0052+0.00252W=0.0056W or 2.2%. The voltage dominates because P depends on its square.

Answer P = 0.25 W, within 0.0075 W (3%) in the worst case, or with a standard deviation of 0.0056 W (2.2%) if the errors are independent.

Check

f(x,y)=(x2y,xy3) at (1, 0.5).

(a)

What is the Jacobian's entry ∂f1∂x?

(b)

And ∂f2∂y?

Check

f(x,y)=xey. What does the linear approximation at (1, 0) give for f(1 + 0.01, −0.03)?

Check

g(x,y)=x2+3y along the circle (cos⁡t,sin⁡t). What is ddtg at t = 1?

Check

P = V²/R with V = 5 ± 0.05 V and R = 470 ± 5 Ω.

(a)

What is the worst-case error in P?

Write units the way you normally would: 1.5 W, 1500 mW and 0.0015 kW are the same answer.

(b)

And the RMS error, if the input errors are independent standard deviations?

Check

f(x,y)=(x2−y2,2xy), which is z2 in complex form. What is the operator 2-norm of Df at (1, 1)?

Check

A function has partial derivatives everywhere. What can you conclude?

Check

f(x,y)=x2y+y3.

Step 1

What is fx?

Type it the way you would write it, like 3sin(2πft) or 3*sin(2*pi*f*t). Angles can be in radians or carry a degree sign, like 45°.

Check

Write jacobian(f, x, e) approximating Df(x) by central differences with step e in each coordinate. Set J for f(x,y)=(x2y,x+sin⁡y) at (1, 0) with e=10−6.

Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.

Explain why

Why isn't having all partial derivatives the same as being differentiable?

Practice

Keep practicing

7 kinds of problem on this topic, dealt one at a time with new numbers every time, for as long as you like.