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 to , 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 (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, , right up to the origin.
Predict
near (1, 2). Estimate f(1.01, 2.02) from the derivative.
2.06. The gradient is , so . The exact value is ; the difference, 0.0006, is second order in the step.
Name it
The derivative
is differentiable at x if there's a linear map Df(x) (an m × n matrix) with
meaning the error divided by goes to 0. Df(x) is the Jacobian, with entries .
Partials aren't enough
Partial derivatives existing doesn't imply differentiability, or even continuity, as shows. But if all partial derivatives exist and are continuous near x, then f is differentiable there.
Chain rule and mean value inequality
: matrices multiply. For vector-valued f there's no mean value equality, but there is an inequality: on a convex set, , with the operator norm of lesson 38.
Error propagation
A small error δx in the inputs gives . For a scalar f with independent input errors:
- worst case: ;
- random, with standard deviations : .
Second order
, with the Hessian , symmetric when the second partials are continuous. That's the basis of Newton's method for optimization and of testing critical points.
Worked example
. Find Df at (1, 0) and estimate f(1.01, 0.02).
Show the solution
- The derivative.
- At (1, 0).
- Linear estimate. With f(1, 0) = (0, 1) and h = (0.01, 0.02):
- Compare with the exact value. Exactly, . The errors, and , are of order , as the definition requires.
- The second component. It's almost linear here, since .
Answer , and .
Worked example
Show that (f(0, 0) = 0) has both partial derivatives at the origin but isn't differentiable there.
Show the solution
- The partials. On the axes f is identically 0, so .
- What differentiability would need. Its derivative would be the zero matrix, and .
- Look along the diagonal. Along h = (t, t), for every t ≠ 0, which doesn't even go to 0.
- Conclude. So f isn't continuous at the origin, let alone differentiable.
- 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
- Nominal power. P = 0.25 W.
- Sensitivity to V.
- Sensitivity to R.
- Contributions.
- Worst case. or 3%.
- Independent errors. If the errors are independent with those standard deviations: 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
at (1, 0.5).
(a)
What is the Jacobian's entry ?
(b)
And ?
Check
. What does the linear approximation at (1, 0) give for f(1 + 0.01, −0.03)?
Check
along the circle . What is 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
, which is 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
.
Step 1
What is ?
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°.
Step 2
What is ?
Step 3
What is the mixed partial ?
Check
Write jacobian(f, x, e) approximating Df(x) by central differences with step e in each coordinate. Set J for at (1, 0) with .
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?
A partial derivative measures how f changes along one coordinate direction only, with the other coordinates frozen. Differentiability asks for a single linear map that predicts the change along every direction, with an error small compared with the step, uniformly over directions. A function can behave perfectly along the axes and badly along diagonals, as does, so the axis information can't determine the behavior elsewhere. Continuity of the partials near the point rules this out, because then the change along any path can be built from small axis-aligned steps whose rates are all close to the partials at the point.
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.