Flow Lab

Syllabus / Module 2: Multivariable & Vector Calculus

Lesson 2.2

Linearization, the Chain Rule & the Jacobian

Tangent planes, differentiability, the multivariable chain rule, and the Jacobian matrix as the best linear approximation of a map.

Written byClaude Opus

🌊
Why this matters for simulation: The material derivative — the rate of change felt by a moving fluid parcel — is the chain rule.

By the end of this lesson you can…

  • Write the tangent plane to a surface z = f(x, y) and use it to approximate f near a point, with an estimate of the error.
  • State what it means for a function of several variables to be differentiable, and recognize functions that fail.
  • Apply the multivariable chain rule, using tree diagrams to organize every dependency.
  • Compute the Jacobian matrix of a map from ℝ² to ℝ² and interpret it as the local linear transformation, including its determinant as an area factor.
  • Use the matrix form of the chain rule: the Jacobian of a composition is the product of Jacobians.
  • Derive the material derivative D/Dt = ∂/∂t + u·∇ from the chain rule along a particle path, and explain what it measures in a fluid.
On this page
·
  1. Zoom in: the tangent line, revisited
  2. Tangent planes
  3. Worked example: a tangent plane and an estimate
  4. Differentials
  5. Differentiability: what “smooth” really requires
  6. The multivariable chain rule
  7. Tree diagrams
  8. Worked example: a probe on a circle
  9. Two intermediate variables, two independent ones
  10. Worked example: polar coordinates
  11. The Jacobian matrix: the derivative of a map
  12. Worked example: the polar coordinate map
  13. The chain rule as matrix multiplication
  14. Worked example: composing two maps
  15. The material derivative
  16. Worked examples
  17. Linearization in code
  18. Where linearization goes next
  19. Key Takeaways

Almost everything in simulation is nonlinear: drag grows with the square of speed, a pendulum’s restoring force goes like sin⁡θ\sin\theta, and the Navier–Stokes equations contain the velocity multiplied by its own derivatives. Yet nearly every tool we have for analyzing simulations is linear: matrices, eigenvalues, stability factors like 1+hλ1 + h\lambda. The bridge between the two worlds is the oldest idea in calculus: zoom in far enough on anything smooth and it looks linear. In Calc I that gave you the tangent line. In 2.1 Functions of Several Variables & Partial Derivatives you learned to measure slopes of a surface along the coordinate directions. This lesson glues those slopes together into a tangent plane, then into a matrix, the Jacobian, which is the honest derivative of a map from R2\mathbb{R}^2 to R2\mathbb{R}^2. Along the way we derive the multivariable chain rule, and from it the single most-used operator in fluid dynamics: the material derivative.

▶ Video Zoom in on a smooth surface and it becomes its tangent planecaptions only
Transcript
  1. Calculus has one big idea: if you zoom in far enough on anything smooth, it looks linear. This lesson takes that idea into several dimensions.
  2. Start with what you know from Calc One. Here is a curved graph and one point on it. The tangent line touches the curve there with the same slope.
  3. Now zoom in on the point. The more we magnify, the less the curve bends away from its tangent line, until the two are indistinguishable. Locally, the function is linear: f of x zero plus h is about f of x zero plus slope times h.
  4. Functions of two variables have graphs that are surfaces. Here is a dome, z equals f of x and y, and a point on it.
  5. Slice the surface in the x direction and you get a curve whose slope is the partial derivative f sub x. Slice it in the y direction and the slope is f sub y.
  6. Two tangent lines through the same point determine a plane: the tangent plane. Its equation just adds the two slopes, each times how far you step in that direction.
  7. Walk around it. The plane hugs the dome near the point, and peels away from it only as you move farther off.
  8. Zoom in, and the dome and the plane become indistinguishable. That is linear approximation in two variables: near a point, a smooth surface is a plane.
  9. This is what differentiable means. The error between the surface and its tangent plane must shrink faster than your distance from the point. For smooth functions it shrinks like the distance squared.
  10. A surface with a sharp crease or a cone tip has no tangent plane there. Zooming in never makes it flat, so it is not differentiable, even if both partial derivatives happen to exist.
  11. Next, let us see what happens when the inputs themselves are moving: the chain rule.

Zoom in: the tangent line, revisited

Recall the one-variable picture. If ff is differentiable at x0x_0, then for a small step hh,

f(x0+h)=f(x0)+f′(x0) h+error(h),f(x_0 + h) = f(x_0) + f'(x_0)\,h + \text{error}(h),

and the error is small compared with hh: error(h)/h→0\text{error}(h)/h \to 0 as h→0h \to 0. For a smooth function, Taylor’s theorem says more precisely that the error is about 12f′′(x0) h2\tfrac12 f''(x_0)\,h^2. Halve the step, and the error drops by a factor of four.

That is all “the tangent line is the best linear approximation” means. Geometrically: magnify the graph around (x0,f(x0))(x_0, f(x_0)) by a factor 1/h1/h. The curve’s deviation from its tangent line, measured in magnified units, is about 12f′′(x0) h\tfrac12 f''(x_0)\,h, which vanishes as you zoom. Smooth curves are locally straight.

Tangent planes

Now take a function of two variables, z=f(x,y)z = f(x, y), whose graph is a surface. Pick a point (a,b)(a, b) on the ground and the point (a,b,f(a,b))\big(a, b, f(a,b)\big) above it on the surface.

Any non-vertical plane through that point has an equation of the form

z=f(a,b)+m (x−a)+n (y−b)z = f(a,b) + m\,(x - a) + n\,(y - b)

for some slopes mm and nn. Which plane is tangent? Slice everything with the vertical plane y=by = b. The surface becomes the curve z=f(x,b)z = f(x, b), whose slope at x=ax = a is the partial derivative fx(a,b)f_x(a,b). The plane becomes the line z=f(a,b)+m(x−a)z = f(a,b) + m(x-a), with slope mm. Tangency demands the slopes agree, so m=fx(a,b)m = f_x(a,b). Slicing with x=ax = a gives n=fy(a,b)n = f_y(a,b) in the same way.

The formula reads naturally: start at the known height, then add (slope in xx) × (step in xx) plus (slope in yy) × (step in yy). Each partial derivative handles its own direction, and for small steps the two contributions simply add. That additivity is what “linear” means, and it’s the reason everything that follows works.

Worked example: a tangent plane and an estimate

Find the tangent plane to f(x,y)=x2+3xy−y2f(x,y) = x^2 + 3xy - y^2 at (1,2)(1, 2), and use it to estimate f(1.02, 1.97)f(1.02,\, 1.97).

  1. Height: f(1,2)=1+6−4=3f(1,2) = 1 + 6 - 4 = 3.
  2. Slopes: fx=2x+3yf_x = 2x + 3y, so fx(1,2)=8f_x(1,2) = 8; and fy=3x−2yf_y = 3x - 2y, so fy(1,2)=−1f_y(1,2) = -1.
  3. Tangent plane: z=3+8(x−1)−(y−2)z = 3 + 8(x - 1) - (y - 2).
  4. Estimate: with Δx=0.02\Delta x = 0.02 and Δy=−0.03\Delta y = -0.03, L=3+8(0.02)−(−0.03)=3.19L = 3 + 8(0.02) - (-0.03) = 3.19.

The exact value is f(1.02,1.97)=1.0404+6.0282−3.8809=3.1877f(1.02, 1.97) = 1.0404 + 6.0282 - 3.8809 = 3.1877, so the error is 0.00230.0023. Where does it come from? Expand ff exactly around (1,2)(1,2): because ff is quadratic, f=L+(Δx)2+3 Δx Δy−(Δy)2f = L + (\Delta x)^2 + 3\,\Delta x\,\Delta y - (\Delta y)^2, and the leftover is 0.0004−0.0018−0.0009=−0.00230.0004 - 0.0018 - 0.0009 = -0.0023. The error is quadratic in the step, exactly like the tangent line. You’ll see the general version (with second derivatives, the Hessian) in 2.4 Taylor Series in One and Several Variables.

Differentials

Writing dx,dydx, dy for small changes in the inputs and dfdf for the resulting change predicted by the linearization gives the compact total differential

df=fx dx+fy dy.df = f_x\,dx + f_y\,dy .

Engineers use this constantly for sensitivity and error propagation: if the inputs are uncertain by dxdx and dydy, the output is uncertain by about ∣fx∣ ∣dx∣+∣fy∣ ∣dy∣|f_x|\,|dx| + |f_y|\,|dy| in the worst case.

✅ Concept check

At $(a,b)$ a function has $f = 5$, $f_x = 2$ and $f_y = -1$. What does the linearization predict for $f(a + 0.1,\ b + 0.2)$?

✏️ Pen & paperTangent plane and its error●○○

Let f(x,y)=excos⁡yf(x,y) = e^x \cos y.

  1. Find the tangent plane at (0,0)(0, 0).
  2. Use it to estimate f(0.1, 0.2)f(0.1,\, 0.2) and compare with the exact value.
  3. Is the error roughly the size you’d expect for a step of length about 0.220.22?
Show worked solution
  1. f(0,0)=1f(0,0) = 1, fx=excos⁡y⇒fx(0,0)=1f_x = e^x\cos y \Rightarrow f_x(0,0) = 1, fy=−exsin⁡y⇒fy(0,0)=0f_y = -e^x \sin y \Rightarrow f_y(0,0) = 0. The tangent plane is z=1+xz = 1 + x.
  2. L(0.1,0.2)=1.1L(0.1, 0.2) = 1.1. Exactly, f(0.1,0.2)=e0.1cos⁡0.2≈1.10517×0.98007≈1.0831f(0.1, 0.2) = e^{0.1}\cos 0.2 \approx 1.10517 \times 0.98007 \approx 1.0831. The error is about 0.0170.017.
  3. Yes. The step has length 0.01+0.04≈0.224\sqrt{0.01 + 0.04} \approx 0.224, and the error should be of order (second derivatives) × (step)², i.e. about 0.050.05 times a modest constant. Indeed the second-order Taylor term is 12(fxx(0.1)2+2fxy(0.1)(0.2)+fyy(0.2)2)=12(0.01+0−0.04)=−0.015\tfrac12\big(f_{xx}(0.1)^2 + 2f_{xy}(0.1)(0.2) + f_{yy}(0.2)^2\big) = \tfrac12(0.01 + 0 - 0.04) = -0.015, which accounts for almost all of the error.

Differentiability: what “smooth” really requires

In one variable, “the derivative exists” and “the tangent line is a good approximation” are the same statement. In two variables they are not, and the difference is worth a few minutes.

In words: the linearization’s error must shrink faster than the distance ∥h⃗∥\|\vec h\|, and it must do so as h⃗→0⃗\vec h \to \vec 0 from every direction at once, not just along the axes. Partial derivatives only test two directions, so they can exist even when the function is badly behaved in between.

The classic counterexample. Let f(x,y)=xyx2+y2f(x,y) = \dfrac{xy}{x^2 + y^2} for (x,y)≠(0,0)(x,y) \neq (0,0) and f(0,0)=0f(0,0) = 0. On both axes ff is identically zero, so fx(0,0)=fy(0,0)=0f_x(0,0) = f_y(0,0) = 0. But on the diagonal y=xy = x, f=x2/(2x2)=12f = x^2/(2x^2) = \tfrac12 no matter how close you get to the origin. The function isn’t even continuous at the origin, let alone well approximated by the plane z=0z = 0. Partial derivatives exist; differentiability fails.

Fortunately, there’s a simple test that covers every function you’ll meet in practice:

Theorem. If fxf_x and fyf_y exist near p⃗\vec p and are continuous at p⃗\vec p, then ff is differentiable at p⃗\vec p.

Polynomials, exponentials, sines and cosines, and their sums, products, quotients (away from zero denominators) and compositions all qualify. Trouble lives at kinks, creases, cone tips and jumps: ∣x∣|x|, x2+y2\sqrt{x^2+y^2} at the origin, max⁡(u,v)\max(u, v) where u=vu = v, and a shock wave in a compressible flow.

✅ Concept check

A function $f(x,y)$ has partial derivatives $f_x$ and $f_y$ at the point $\vec p$. What can you conclude?

The multivariable chain rule

The second video covers the rest of the lesson: the chain rule, the Jacobian and the material derivative. Watch it now for the big picture, then work through the details below.

▶ Video The chain rule, the Jacobian as a local matrix, and the material derivativecaptions only
Transcript
  1. Here is a temperature field, T equals x squared times y. Red is hot, blue is cold. A probe moves through it along a circle, so its x and y are both functions of time.
  2. The probe's reading changes for two reasons: it moves in x, and it moves in y. How fast does the reading change?
  3. Add the two contributions. The rate in x times how sensitive T is to x, plus the rate in y times how sensitive T is to y. That is the multivariable chain rule.
  4. A tree diagram keeps the bookkeeping straight. T depends on x and y, which each depend on t. Multiply along each branch from top to bottom, then add the branches.
  5. Now a whole map of the plane to itself, F of x and y, with two output components. A matrix would keep grid lines straight. This map bends them.
  6. Pick a point p and a small square window around it, of half width h. On the left is its image under the map. On the right we magnify that image by one over h, so it always fills the same box.
  7. For a big window the image is clearly curved. Overlay, in dashed amber, what a single matrix would do to the same window. They disagree.
  8. Now shrink the window. Watch the cyan grid straighten out and slide onto the amber one. Zoomed in far enough, the nonlinear map is a linear map.
  9. That matrix is the Jacobian. Exactly as in lesson one point two, its columns are where the tiny steps in x and in y land: the partial derivatives of F with respect to x and to y.
  10. So the best linear approximation of a map is F of p plus delta, approximately F of p plus the Jacobian times delta. Same formula as the tangent line, with a matrix in place of the slope.
  11. Composing two maps multiplies their Jacobians, which is the chain rule in matrix form. And the determinant of the Jacobian tells you how much the map scales tiny areas.
  12. Last idea, and the most important one for fluids. Wind blows to the right through a temperature field. A thermometer can sit still, or it can ride along with a parcel of air.
  13. First, a steady field: the temperature at each fixed place never changes, so the probe's reading is constant. But the parcel moves through warm and cold regions, so its temperature changes anyway.
  14. Now let the wind carry the warm and cold air along with it. The parcel now rides with its own air and its reading stays constant, while the fixed probe sees the pattern sweep past.
  15. The chain rule explains both cases. The rate felt by the parcel is the local rate at a fixed point plus the velocity times the spatial rates of change. This is the material derivative, D T D t.
  16. In shorthand, D D t equals partial d t plus u dot del. Every fluid equation, from advection to Navier Stokes, is written with it, because Newton's laws apply to parcels, not to fixed points in space.
  17. To recap. Smooth means locally linear. For a surface that is the tangent plane, for a map it is the Jacobian matrix, and following a moving parcel gives the material derivative.
  18. Next time, we pack the partial derivatives of a single function into one vector, the gradient, and find out why it always points uphill.

Suppose a temperature probe moves through a room. The temperature field is T(x,y)T(x, y) and the probe’s position at time tt is (x(t),y(t))\big(x(t), y(t)\big). Its reading is the composite function T(x(t),y(t))T\big(x(t), y(t)\big). How fast does the reading change?

Over a short time Δt\Delta t, the probe moves by Δx≈x′(t) Δt\Delta x \approx x'(t)\,\Delta t and Δy≈y′(t) Δt\Delta y \approx y'(t)\,\Delta t. Because TT is differentiable, its change is given by the linearization plus a small error:

ΔT=Tx Δx+Ty Δy+error,errorΔx2+Δy2→0.\Delta T = T_x\,\Delta x + T_y\,\Delta y + \text{error}, \qquad \frac{\text{error}}{\sqrt{\Delta x^2 + \Delta y^2}} \to 0 .

Divide by Δt\Delta t and let Δt→0\Delta t \to 0. The error term vanishes (this is exactly where differentiability, not just existence of partials, is needed), and we get

dTdt=∂T∂x dxdt+∂T∂y dydt.\frac{dT}{dt} = \frac{\partial T}{\partial x}\,\frac{dx}{dt} + \frac{\partial T}{\partial y}\,\frac{dy}{dt}.

Each input contributes (sensitivity of the output to that input) × (rate at which that input changes), and the contributions add.

Tree diagrams

When variables depend on variables that depend on other variables, draw a tree. Put the final output at the top, its direct inputs below, and so on down to the independent variables. Label each branch with the corresponding partial (or ordinary) derivative:

T∂T/∂x ↙↘ ∂T/∂yxydx/dt ↓↓ dy/dttt\begin{array}{ccccc} & & T & & \\ & {\scriptstyle \partial T/\partial x}\ \swarrow & & \searrow\ {\scriptstyle \partial T/\partial y} & \\ x & & & & y \\ {\scriptstyle dx/dt}\ \downarrow & & & & \downarrow\ {\scriptstyle dy/dt} \\ t & & & & t \end{array}

The rule: to differentiate the top with respect to a bottom variable, find every path from top to that variable, multiply the derivatives along each path, and add over paths. Here there are two paths from TT to tt, giving the two terms above.

Worked example: a probe on a circle

Let T(x,y)=x2yT(x,y) = x^2 y and let the probe follow x=cos⁡tx = \cos t, y=sin⁡ty = \sin t. Find dT/dtdT/dt, and its value at t=π/4t = \pi/4.

The partials are Tx=2xyT_x = 2xy and Ty=x2T_y = x^2; the path derivatives are x′=−sin⁡tx' = -\sin t and y′=cos⁡ty' = \cos t. The chain rule gives

dTdt=(2xy)(−sin⁡t)+(x2)(cos⁡t)=−2cos⁡t sin⁡2t+cos⁡3t.\frac{dT}{dt} = (2xy)(-\sin t) + (x^2)(\cos t) = -2\cos t\,\sin^2 t + \cos^3 t .

Check by substituting first: T(t)=cos⁡2t sin⁡tT(t) = \cos^2 t\,\sin t, and the product rule gives −2cos⁡tsin⁡t⋅sin⁡t+cos⁡2tcos⁡t-2\cos t \sin t \cdot \sin t + \cos^2 t \cos t, the same thing. At t=π/4t = \pi/4, with cos⁡=sin⁡=22\cos = \sin = \tfrac{\sqrt2}{2}:   −2⋅22⋅12+24=−22+24=−24≈−0.354\;-2\cdot\tfrac{\sqrt2}{2}\cdot\tfrac12 + \tfrac{\sqrt2}{4} = -\tfrac{\sqrt2}{2} + \tfrac{\sqrt2}{4} = -\tfrac{\sqrt2}{4} \approx -0.354. The probe is cooling at that instant.

Substituting first worked here, but it often doesn’t: in a simulation, TT is a grid of numbers and the path comes from an ODE solver. The chain rule only needs the local partials and velocities, which is exactly what a solver has.

Two intermediate variables, two independent ones

If z=f(x,y)z = f(x,y) with x=x(s,t)x = x(s,t) and y=y(s,t)y = y(s,t), the tree has two leaves on each branch, ss and tt. Following paths:

∂z∂s=∂z∂x∂x∂s+∂z∂y∂y∂s,∂z∂t=∂z∂x∂x∂t+∂z∂y∂y∂t.\frac{\partial z}{\partial s} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial s} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial s}, \qquad \frac{\partial z}{\partial t} = \frac{\partial z}{\partial x}\frac{\partial x}{\partial t} + \frac{\partial z}{\partial y}\frac{\partial y}{\partial t}.

Worked example: polar coordinates

Express frf_r and fθf_\theta in terms of fxf_x and fyf_y, where x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta.

The branch derivatives are xr=cos⁡θx_r = \cos\theta, yr=sin⁡θy_r = \sin\theta, xθ=−rsin⁡θx_\theta = -r\sin\theta, yθ=rcos⁡θy_\theta = r\cos\theta. So

fr=fxcos⁡θ+fysin⁡θ,fθ=−fx rsin⁡θ+fy rcos⁡θ.f_r = f_x\cos\theta + f_y\sin\theta, \qquad f_\theta = -f_x\, r\sin\theta + f_y\, r\cos\theta .

Sanity check with f=x2+y2=r2f = x^2 + y^2 = r^2: fr=2xcos⁡θ+2ysin⁡θ=2r(cos⁡2θ+sin⁡2θ)=2rf_r = 2x\cos\theta + 2y\sin\theta = 2r(\cos^2\theta + \sin^2\theta) = 2r ✓, and fθ=−2xrsin⁡θ+2yrcos⁡θ=0f_\theta = -2x r\sin\theta + 2y r\cos\theta = 0 ✓ (the distance from the origin doesn’t change as you go around a circle). Formulas like these are how the Laplacian gets rewritten in polar coordinates for flow around a cylinder.

✏️ Pen & paperChain rule with a tree●●○

Let z=exsin⁡yz = e^x \sin y with x=stx = st and y=s+ty = s + t.

  1. Draw the tree diagram.
  2. Use the chain rule to find ∂z/∂s\partial z/\partial s and ∂z/∂t\partial z/\partial t at (s,t)=(1,0)(s, t) = (1, 0).
  3. Check your answers by substituting first.
Show worked solution
  1. zz branches to xx and yy; each of xx and yy branches to ss and tt. There are two paths from zz to ss and two from zz to tt.
  2. At (s,t)=(1,0)(s,t) = (1,0): x=0x = 0, y=1y = 1. Then zx=exsin⁡y=sin⁡1z_x = e^x \sin y = \sin 1 and zy=excos⁡y=cos⁡1z_y = e^x\cos y = \cos 1. The branch derivatives are xs=t=0x_s = t = 0, xt=s=1x_t = s = 1, ys=1y_s = 1, yt=1y_t = 1. So ∂z∂s=sin⁡1⋅0+cos⁡1⋅1=cos⁡1≈0.540\dfrac{\partial z}{\partial s} = \sin 1 \cdot 0 + \cos 1 \cdot 1 = \cos 1 \approx 0.540 and ∂z∂t=sin⁡1⋅1+cos⁡1⋅1≈0.841+0.540=1.382\dfrac{\partial z}{\partial t} = \sin 1\cdot 1 + \cos 1 \cdot 1 \approx 0.841 + 0.540 = 1.382.
  3. z(s,t)=estsin⁡(s+t)z(s,t) = e^{st}\sin(s+t). Then ∂sz=testsin⁡(s+t)+estcos⁡(s+t)\partial_s z = t e^{st}\sin(s+t) + e^{st}\cos(s+t), which at (1,0)(1,0) is 0+cos⁡10 + \cos 1 ✓. And ∂tz=sestsin⁡(s+t)+estcos⁡(s+t)\partial_t z = s e^{st}\sin(s+t) + e^{st}\cos(s+t), which at (1,0)(1,0) is sin⁡1+cos⁡1\sin 1 + \cos 1 ✓.
✏️ Pen & paperError propagation in dynamic pressure●●○

The dynamic pressure of an airflow is q=12ρV2q = \tfrac12 \rho V^2, where ρ\rho is the air density and VV the airspeed. A wind-tunnel run has ρ=1.20 kg/m3\rho = 1.20\ \text{kg/m}^3 and V=50 m/sV = 50\ \text{m/s}.

  1. Compute qq and its differential dqdq in terms of dρd\rho and dVdV.
  2. Show that the relative error satisfies dqq=dρρ+2 dVV\dfrac{dq}{q} = \dfrac{d\rho}{\rho} + 2\,\dfrac{dV}{V}.
  3. If density is known to within 1% and speed to within 2%, what is the worst-case relative error in qq? Which measurement should you improve first?
Show worked solution
  1. q=12(1.20)(2500)=1500 Paq = \tfrac12(1.20)(2500) = 1500\ \text{Pa}. The partials are qρ=12V2q_\rho = \tfrac12 V^2 and qV=ρVq_V = \rho V, so dq=12V2 dρ+ρV dVdq = \tfrac12 V^2\, d\rho + \rho V\, dV (numerically, dq=1250 dρ+60 dVdq = 1250\,d\rho + 60\,dV).
  2. Divide by q=12ρV2q = \tfrac12\rho V^2: dqq=12V2dρ12ρV2+ρV dV12ρV2=dρρ+2dVV\dfrac{dq}{q} = \dfrac{\tfrac12 V^2 d\rho}{\tfrac12\rho V^2} + \dfrac{\rho V\, dV}{\tfrac12 \rho V^2} = \dfrac{d\rho}{\rho} + 2\dfrac{dV}{V}.
  3. Worst case, the errors add: 1%+2×2%=5%1\% + 2 \times 2\% = 5\%, i.e. about ±75\pm 75 Pa. The speed error counts double because VV is squared, so improving the airspeed measurement pays off first.

The Jacobian matrix: the derivative of a map

So far the output has been a single number. Now let the output be a vector too. A map F:R2→R2F:\mathbb{R}^2 \to \mathbb{R}^2,

F(x,y)=[u(x,y)v(x,y)],F(x, y) = \begin{bmatrix} u(x,y) \\ v(x,y) \end{bmatrix},

moves every point of the plane somewhere else. In 1.2 Matrices as Transformations you pictured linear maps by watching the grid deform: lines stayed straight, parallel and evenly spaced. A nonlinear map bends the grid into curves. Examples are everywhere: the change from polar to Cartesian coordinates, a camera’s lens distortion, the curvilinear mesh wrapped around an airfoil, and the flow map that sends each fluid particle’s starting position to its position one time unit later.

Linearize each component separately, using its own tangent plane. For a small displacement δ⃗=(δx,δy)\vec\delta = (\delta x, \delta y) from p⃗\vec p:

u(p⃗+δ⃗)≈u(p⃗)+ux δx+uy δy,v(p⃗+δ⃗)≈v(p⃗)+vx δx+vy δy.\begin{aligned} u(\vec p + \vec\delta) &\approx u(\vec p) + u_x\,\delta x + u_y\,\delta y, \\ v(\vec p + \vec\delta) &\approx v(\vec p) + v_x\,\delta x + v_y\,\delta y . \end{aligned}

Stack these two lines and you get a matrix–vector product:

F(p⃗+δ⃗)≈F(p⃗)+J(p⃗) δ⃗,J=[∂u∂x∂u∂y∂v∂x∂v∂y].F(\vec p + \vec\delta) \approx F(\vec p) + J(\vec p)\,\vec\delta, \qquad J = \begin{bmatrix} \dfrac{\partial u}{\partial x} & \dfrac{\partial u}{\partial y} \\[2mm] \dfrac{\partial v}{\partial x} & \dfrac{\partial v}{\partial y} \end{bmatrix}.

So the Jacobian is to a map what the slope is to a curve: the linear transformation the map looks like when you zoom in. A single-output function is the special case m=1m = 1, where the Jacobian is the 1×21\times 2 row [fxfy]\begin{bmatrix} f_x & f_y\end{bmatrix} from the tangent plane.

◆ Interactive Zoom in on a warped grid: the map becomes its Jacobian

Loading simulation…

Things to try:

  1. With the wavy warp, set hh near its maximum. In the zoom window the cyan grid (the true image of a small square of grid around p⃗\vec p) is visibly curved, and it disagrees with the amber parallelogram grid (the image under JJ).
  2. Slowly shrink hh. The cyan grid straightens and lands on the amber one. Watch the readout: error / h heads to zero (that’s differentiability), and error / h² settles to a constant (that’s the quadratic error of a smooth map).
  3. Drag the point around (you can click anywhere). The Jacobian changes from place to place: a nonlinear map is a different matrix at every point.
  4. Switch to the squaring map and drag p⃗\vec p toward the origin. The determinant goes to zero, and the zoom window collapses toward a point: the linearization stops being invertible there.
  5. Switch to the swirl. The determinant stays at exactly 1 everywhere, even where the grid is wildly sheared. Hold that thought for the fluids callout below.

Dragging uses Newton’s method to find which p⃗\vec p maps to where your mouse is, and Newton’s method works by repeatedly solving J δ⃗=residualJ\,\vec\delta = \text{residual}. The Jacobian is doing double duty.

Worked example: the polar coordinate map

Find the Jacobian of F(r,θ)=(rcos⁡θ, rsin⁡θ)F(r, \theta) = (r\cos\theta,\ r\sin\theta) and interpret its columns and determinant.

Differentiate each component with respect to each input:

J=[∂x/∂r∂x/∂θ∂y/∂r∂y/∂θ]=[cos⁡θ−rsin⁡θsin⁡θrcos⁡θ],det⁡J=rcos⁡2θ+rsin⁡2θ=r.J = \begin{bmatrix} \partial x/\partial r & \partial x/\partial\theta \\ \partial y/\partial r & \partial y/\partial \theta \end{bmatrix} = \begin{bmatrix} \cos\theta & -r\sin\theta \\ \sin\theta & r\cos\theta \end{bmatrix}, \qquad \det J = r\cos^2\theta + r\sin^2\theta = r .
  • Column 1, (cos⁡θ,sin⁡θ)(\cos\theta, \sin\theta), is the unit vector pointing radially outward: increasing rr moves you straight away from the origin at unit speed.
  • Column 2, r(−sin⁡θ,cos⁡θ)r(-\sin\theta, \cos\theta), points around the circle with length rr: increasing θ\theta by dθd\theta moves you an arc length r dθr\,d\theta, farther when you’re farther out.
  • The determinant rr is the area scaling factor (lesson 1.4 Determinants as Volume Scaling): a tiny rectangle dr×dθdr \times d\theta maps to a curved patch of area about r dr dθr\,dr\,d\theta. That’s the famous rr in polar integrals, which you’ll use in 2.5 Multiple Integrals.

The chain rule as matrix multiplication

Compose two maps: first FF, then GG. Near p⃗\vec p, FF looks like the matrix JF(p⃗)J_F(\vec p); near F(p⃗)F(\vec p), GG looks like JG(F(p⃗))J_G\big(F(\vec p)\big). Composing linear maps multiplies their matrices (lesson 1.2), so

JG∘F(p⃗)=JG(F(p⃗))  JF(p⃗).J_{G\circ F}(\vec p) = J_G\big(F(\vec p)\big)\; J_F(\vec p).

This is the general chain rule, and every formula in the previous section is a special case. For the probe, t↦(x,y)t \mapsto (x, y) has the 2×12\times1 Jacobian [x′y′]\begin{bmatrix} x' \\ y' \end{bmatrix} and TT has the 1×21\times2 Jacobian [TxTy]\begin{bmatrix} T_x & T_y \end{bmatrix}; their product is the 1×11\times1 matrix Txx′+Tyy′T_x x' + T_y y'. The tree diagram’s “multiply along paths, add over paths” is just the row-times-column rule of matrix multiplication.

Worked example: composing two maps

Let F(x,y)=(x+y, xy)F(x,y) = (x + y,\ xy) and G(u,v)=(u2, u+v)G(u,v) = (u^2,\ u + v). Find the Jacobian of G∘FG\circ F at (1,2)(1, 2) two ways.

Via the chain rule. JF=[11yx]=[1121]J_F = \begin{bmatrix} 1 & 1 \\ y & x\end{bmatrix} = \begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix} at (1,2)(1,2). Next, F(1,2)=(3,2)F(1,2) = (3, 2), and JG=[2u011]=[6011]J_G = \begin{bmatrix} 2u & 0 \\ 1 & 1 \end{bmatrix} = \begin{bmatrix} 6 & 0 \\ 1 & 1\end{bmatrix} at (3,2)(3,2). Multiply, right to left:

JG∘F(1,2)=[6011][1121]=[6632].J_{G\circ F}(1,2) = \begin{bmatrix} 6 & 0 \\ 1 & 1\end{bmatrix}\begin{bmatrix} 1 & 1 \\ 2 & 1 \end{bmatrix} = \begin{bmatrix} 6 & 6 \\ 3 & 2 \end{bmatrix}.

Directly. G(F(x,y))=((x+y)2, x+y+xy)G\big(F(x,y)\big) = \big((x+y)^2,\ x + y + xy\big), whose Jacobian is [2(x+y)2(x+y)1+y1+x]\begin{bmatrix} 2(x+y) & 2(x+y) \\ 1 + y & 1 + x\end{bmatrix}, equal to [6632]\begin{bmatrix} 6 & 6 \\ 3 & 2\end{bmatrix} at (1,2)(1,2) ✓. Note that JGJ_G had to be evaluated at F(p⃗)F(\vec p), not at p⃗\vec p: forgetting that is the most common chain-rule mistake.

✅ Concept check

A map $F$ has Jacobian $J = \begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix}$ at $\vec p$. Approximately where does $F$ send the point $\vec p + (0, 0.01)$?

✏️ Pen & paperThe squaring map●●○

Let F(x,y)=(x2−y2, 2xy)F(x,y) = (x^2 - y^2,\ 2xy). (If you know complex numbers, this is z↦z2z \mapsto z^2.)

  1. Compute J(x,y)J(x,y) and det⁡J\det J.
  2. At p⃗=(1,1)\vec p = (1, 1), approximately what is the area of the image of a tiny square of side 0.010.01 centered at p⃗\vec p?
  3. Find the Jacobian of the local inverse of FF near F(1,1)=(0,2)F(1,1) = (0, 2).
  4. Where is FF not locally invertible?
Show worked solution
  1. J=[2x−2y2y2x]J = \begin{bmatrix} 2x & -2y \\ 2y & 2x \end{bmatrix} and det⁡J=4x2+4y2\det J = 4x^2 + 4y^2.
  2. At (1,1)(1,1), det⁡J=8\det J = 8. The square has area 10−410^{-4}, so its image has area about 8×10−48\times 10^{-4}. (The image is close to a square rotated by 45∘45^\circ and scaled by 8\sqrt8 in each direction: J=8[cos⁡45∘−sin⁡45∘sin⁡45∘cos⁡45∘]J = \sqrt 8\begin{bmatrix} \cos 45^\circ & -\sin 45^\circ \\ \sin 45^\circ & \cos 45^\circ \end{bmatrix}.)
  3. Undoing FF near p⃗\vec p must undo its linearization, so by the chain rule (JF−1JF=IJ_{F^{-1}}J_F = I) the inverse’s Jacobian at (0,2)(0,2) is J−1=18[22−22]=[1414−1414]J^{-1} = \dfrac{1}{8}\begin{bmatrix} 2 & 2 \\ -2 & 2 \end{bmatrix} = \begin{bmatrix} \tfrac14 & \tfrac14 \\ -\tfrac14 & \tfrac14 \end{bmatrix}.
  4. Where det⁡J=0\det J = 0, i.e. only at the origin. There the map crushes every direction (both columns are zero), and indeed FF is two-to-one near the origin: F(x⃗)=F(−x⃗)F(\vec x) = F(-\vec x).

The material derivative

Here is the payoff for fluids. A fluid has a temperature field that varies in space and time, T(x,y,t)T(x, y, t), and a velocity field u⃗=(u,v)\vec u = (u, v). Follow one fluid parcel, a tiny blob of fluid carried along by the flow. Its path (x(t),y(t))\big(x(t), y(t)\big) satisfies

dxdt=u,dydt=v.\frac{dx}{dt} = u, \qquad \frac{dy}{dt} = v .

What rate of change of temperature does the parcel feel? It’s the derivative of the composite T(x(t),y(t),t)T\big(x(t), y(t), t\big). The tree has three paths from TT down to tt: through xx, through yy, and directly. The chain rule gives

ddtT(x(t),y(t),t)=∂T∂t+∂T∂xdxdt+∂T∂ydydt=∂T∂t+u ∂T∂x+v ∂T∂y.\frac{d}{dt}T\big(x(t), y(t), t\big) = \frac{\partial T}{\partial t} + \frac{\partial T}{\partial x}\frac{dx}{dt} + \frac{\partial T}{\partial y}\frac{dy}{dt} = \frac{\partial T}{\partial t} + u\,\frac{\partial T}{\partial x} + v\,\frac{\partial T}{\partial y}.

This rate gets its own notation, the material derivative:

(The vector ∇T\nabla T of partial derivatives is the gradient; next lesson, 2.3 Gradient & Directional Derivatives, is all about it. For now, u⃗⋅∇T\vec u\cdot\nabla T is just shorthand for uTx+vTyuT_x + vT_y.)

The two terms answer different questions, as the end of the video shows:

  • ∂T/∂t\partial T/\partial t is what a fixed thermometer reads: the change at one place in space.
  • DT/DtDT/Dt is what a thermometer riding with the fluid reads.

The difference, u⃗⋅∇T\vec u\cdot\nabla T, is the change caused purely by being carried to a place with a different temperature.

Worked examples

Steady field, moving parcel. The air temperature along a valley is T=20+0.5xT = 20 + 0.5x °C (xx in meters, unchanging in time), and the wind blows along it at u=10u = 10 m/s. Then ∂T/∂t=0\partial T/\partial t = 0, but DT/Dt=u Tx=10×0.5=5DT/Dt = u\,T_x = 10 \times 0.5 = 5 °C/s. Every parcel warms quickly, even though no thermometer bolted to the ground sees any change.

Frozen pattern, carried by the wind. If parcels keep their temperature (no heating, no diffusion), then DT/Dt=0DT/Dt = 0, which rearranges to

∂T∂t=−u⃗⋅∇T.\frac{\partial T}{\partial t} = -\vec u\cdot\nabla T .

This is the advection equation: a fixed probe sees temperature change only because the wind sweeps a different part of the pattern past it. For a uniform wind u=cu = c in 1D, any T=g(x−ct)T = g(x - ct) solves it, a pattern sliding rightward at speed cc. You’ll solve it properly in 9.10 First-Order PDEs: Advection & Characteristics.

A full computation. Let T(x,y,t)=10+xy−tT(x, y, t) = 10 + xy - t and u⃗=(y,−x)\vec u = (y, -x). At the point (1,2)(1, 2) and t=0t = 0: Tt=−1T_t = -1, Tx=y=2T_x = y = 2, Ty=x=1T_y = x = 1, and u⃗=(2,−1)\vec u = (2, -1). So

DTDt=−1+(2)(2)+(−1)(1)=2.\frac{DT}{Dt} = -1 + (2)(2) + (-1)(1) = 2 .

The field is cooling everywhere at 1 degree per second, but this parcel is being carried toward warmer fluid fast enough that it warms at 2 degrees per second.

✅ Concept check

A steady temperature field has $\partial T/\partial x = -0.2$ °C/m and $\partial T/\partial y = 0.1$ °C/m at a point where the velocity is $\vec u = (5, 10)$ m/s. What is $DT/Dt$ there, in °C/s?

✏️ Pen & paperSteady flow, accelerating parcels●●●
  1. A dye concentration c(x,y,t)=(x−t)2+y2c(x, y, t) = (x - t)^2 + y^2 sits in a uniform flow u⃗=(1,0)\vec u = (1, 0). Show that Dc/Dt=0Dc/Dt = 0 and interpret.
  2. Consider the rigid rotation u⃗=(−y, x)\vec u = (-y,\ x). It is steady: ∂u⃗/∂t=0\partial\vec u/\partial t = 0. Compute the parcel acceleration Du⃗/DtD\vec u/Dt, component by component, and interpret it.
Show worked solution
  1. ct=−2(x−t)c_t = -2(x - t), cx=2(x−t)c_x = 2(x - t), cy=2yc_y = 2y. Then Dc/Dt=ct+1⋅cx+0⋅cy=−2(x−t)+2(x−t)=0Dc/Dt = c_t + 1\cdot c_x + 0\cdot c_y = -2(x - t) + 2(x - t) = 0. The dye pattern (circles centered at (t,0)(t, 0)) is simply carried along by the flow, so each parcel keeps its concentration.
  2. Write u⃗=(u,v)\vec u = (u, v) with u=−yu = -y, v=xv = x. Then ux=0u_x = 0, uy=−1u_y = -1, vx=1v_x = 1, vy=0v_y = 0, and DuDt=0+u ux+v uy=(−y)(0)+x(−1)=−x\dfrac{Du}{Dt} = 0 + u\,u_x + v\,u_y = (-y)(0) + x(-1) = -x, and DvDt=0+u vx+v vy=(−y)(1)+x(0)=−y\dfrac{Dv}{Dt} = 0 + u\,v_x + v\,v_y = (-y)(1) + x(0) = -y. So Du⃗/Dt=(−x,−y)D\vec u/Dt = (-x, -y): each parcel accelerates toward the center with magnitude rr, exactly the centripetal acceleration ω2r\omega^2 r of circular motion with ω=1\omega = 1. The velocity at each fixed point never changes, but every parcel is constantly turning. This is why ∂u⃗/∂t\partial\vec u/\partial t alone can’t be the acceleration in Newton’s law.

Linearization in code

First, a numerical check of the chain rule: differentiate the probe’s reading by finite differences and compare with the chain-rule formula.

🐍 PythonChain rule vs. finite differences along a path
⌘/Ctrl + Enter

Now the main exercise. In a real code you rarely have formulas for the partial derivatives: implicit ODE solvers and Newton’s method need the Jacobian of whatever function you hand them, so they estimate it by finite differences, one column at a time. Column jj is the change in FF caused by nudging input jj, which is exactly the geometric meaning of a Jacobian column.

🧪 Coding exerciseExercise: a finite-difference Jacobian and its linearization error
⌘/Ctrl + Enter

Once it passes, look at the printed errors in the solution: each halving of hh divides the error by about 4. That’s the signature of an O(h2)O(h^2) error, the same order you’ll learn to read off log–log plots in 4.1 Local Error, Global Error & Order.

Finally, the material derivative in action. We trace a parcel through a time-dependent temperature field with RK4, then compare the rate of change of its temperature with ∂T/∂t+u⃗⋅∇T\partial T/\partial t + \vec u\cdot\nabla T.

🐍 PythonRiding with a parcel: d/dt along the path equals DT/Dt
⌘/Ctrl + Enter

Notice that a fixed thermometer would always read a cooling rate of exactly 0.20.2 degrees per second, while the parcel’s rate swings positive and negative as it circulates between warm and cold regions.

Where linearization goes next

You will use the Jacobian constantly for the rest of the course:

  • Stability of equilibria. Near an equilibrium x⃗∗\vec x^* of a nonlinear system x⃗˙=F(x⃗)\dot{\vec x} = F(\vec x), the deviation δ⃗=x⃗−x⃗∗\vec\delta = \vec x - \vec x^* obeys δ⃗˙≈J(x⃗∗) δ⃗\dot{\vec\delta} \approx J(\vec x^*)\,\vec\delta, a linear system. Its eigenvalues decide whether the equilibrium is stable (7.7 Nonlinear Systems & Linearization).
  • Implicit solvers. Backward Euler for a stiff system needs to solve y⃗n+1−hF(y⃗n+1)=y⃗n\vec y_{n+1} - h F(\vec y_{n+1}) = \vec y_n for y⃗n+1\vec y_{n+1}, which is done with Newton’s method, driven by the matrix I−hJI - hJ (4.5 Stability Regions & Stiffness).
  • Error analysis. Every finite-difference formula is a Taylor expansion, the higher-order version of the tangent plane (2.4 Taylor Series in One and Several Variables).

Key Takeaways

  • Smooth means locally linear. Zoomed in, a differentiable curve is a line, a surface is a plane, and a map of the plane is a matrix.
  • The tangent plane at (a,b)(a,b) is z=f(a,b)+fx(a,b)(x−a)+fy(a,b)(y−b)z = f(a,b) + f_x(a,b)(x-a) + f_y(a,b)(y-b); its error is quadratic in the step for smooth ff.
  • Differentiable means the linearization’s error shrinks faster than the distance, from every direction. Existing partials are not enough; continuous partials are.
  • Chain rule: multiply derivatives along each path of the tree diagram, then add over paths. In matrix form, JG∘F(p⃗)=JG(F(p⃗)) JF(p⃗)J_{G\circ F}(\vec p) = J_G(F(\vec p))\,J_F(\vec p).
  • The Jacobian is the matrix of first partials. Its columns are where tiny steps along each input axis go, and det⁡J\det J is the local area scaling factor.
  • The material derivative D/Dt=∂/∂t+u⃗⋅∇D/Dt = \partial/\partial t + \vec u\cdot\nabla is the chain rule along a particle path: local change plus change from being carried somewhere else.
  • Fluid equations use D/DtD/Dt because Newton’s laws apply to parcels. The term (u⃗⋅∇)u⃗(\vec u\cdot\nabla)\vec u is the nonlinearity of Navier–Stokes.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.

Where this leads

These later lessons build directly on this one: