Learn

Learning preferences

Make learning more comfortable. Changes apply immediately.

Enlarges page content, including diagrams and their labels. You can also use your browser’s zoom.

Choose the colours that are easiest for you to distinguish. Applies to lesson diagrams and lab plots. Labels, shapes, hatching and line patterns also distinguish meanings. Source photographs and raw image brightness stay unchanged; mask-only views are available for image overlays.

ExampleComparisonSample link

Saved in this browser on this device. Preferences are separate from progress backups.

Lesson 5 of 20

Chain rule, gradients and directional derivatives

Compose derivative maps and distinguish a unit-direction rate from a parameter-dependent rate.

Loading your saved responses…

Try the optional starting-point checks and targeted refreshers. You can continue directly into this lesson.

Try

A temperature model is f(x,y)=x²+3y². At (1,1), its gradient is (2,6). Suppose a sensor moves along r(t)=(1+t,1−2t). The sensor changes both input coordinates at once, so neither partial derivative alone gives its temperature rate. At t=0 the chain rule gives 2(1)+6(−2)=−10. Temperature falls along this motion even though both coordinate partials are positive. The negative y-motion dominates the positive x-motion.

Predict

Predict the greatest temperature increase per unit distance at this point. A direction must be a unit vector u before a dot product represents a rate per unit distance. The directional derivative is ∇f·u. Cauchy–Schwarz bounds this by |∇f|=√40, achieved at u=(2,6)/√40. Moving in the opposite direction gives the most negative rate. A vector perpendicular to the gradient gives zero first-order change, though finite movement in that direction may still change temperature.

Experiment

Use the live quadratic experiment below. It uses f=x²+xy+2y², a different function from the temperature worked example. Change the base point, direction and finite step separately. Record the gradient prediction and actual finite change. Shrink the step while keeping point and direction fixed: the rate discrepancy should decrease for this smooth quadratic. Compare opposite directions at the same positive step length before attributing a difference to rounding.

Live experiment: direction, derivative and finite change

On the surface f(x,y)=x²+xy+2y², choose a point and a direction. Predict the sign of the change before taking a step. Contours show equal function values in the x–y plane; they are not a three-dimensional perspective drawing.

Contours, chosen step and gradient directionFixed equal axis scales from minus three to three. Contours are function values 1, 2, 4, 8, 16 and 24. The red solid arrow is the chosen step; the blue dashed arrow shows gradient direction only, normalized to length 0.8 for display. Numerical values follow the diagram.-3-3-2-2-1-100112233xy
Contour values increase outward: 1, 2, 4, 8, 16, 24. Solid arrow: actual chosen displacement h·u. Dashed arrow: gradient direction, with normalized display length. The function and axis scales stay fixed.

The unit direction u=(cos θ,sin θ)=(1,0). The gradient ∇f=(3,5) gives directional derivative ∇f·u = 3.

Starting value: 4. Linear prediction: f+h∇f·u = 5.5. Actual endpoint value: 5.75. Actual minus linear: 0.25.

The finite-step rate (f(point+h·u)−f(point))/h is 3.5. It differs from the derivative because the derivative describes the limit as h approaches zero. For this quadratic, the exact algebraic remainder is h²(uₓ²+uₓuᵧ+2uᵧ²), where the parenthesis is 1.

Try the origin, then a nonzero point and opposite directions. Reduce h and explain how the error changes. Contours use 180 straight segments and calculations use rounded browser arithmetic; the remainder formula is an exact mathematical identity for this function. Settings are temporary.

The displayed quadratic is a controlled local model. Its exact arithmetic structure makes the remainder inspectable; it is not a numerical proof that every function with partial derivatives is differentiable.

Understand

For a differentiable scalar f and differentiable path r, d(f∘r)/dt=∇f(r(t))·r′(t). The gradient must be evaluated at the path’s current point. If |r′| is not one, this is a rate per parameter unit, not per unit distance. A directional derivative D_u f uses a unit direction u and equals ∇f·u under differentiability.

For a map T from two parameters to two coordinates, its derivative is a 2×2 Jacobian matrix. If f is scalar, Df is a 1×2 row. The chain rule reads D(f∘T)=Df(T)DT. Matrix order reflects the mechanism: first convert parameter increments to coordinate increments, then convert those to an output increment. Reversing the matrices either has incompatible dimensions or describes a different operation.

Apply

Check a second composition directly. Let T(u,v)=(u²,v+u) and f(x,y)=xy. Then f∘T=u²v+u³. Differentiating gives (2uv+3u²,u²). The matrix calculation uses Df=(y,x) and DT=[[2u,0],[1,1]], producing (2u(v+u)+u²,u²), the same result.

Repair “the gradient points along a contour.” Along a differentiable curve r lying in f=c, the composition is constant. The chain rule gives ∇f·r′=0. Thus a nonzero gradient is normal to a nonzero level-set tangent. At a critical point, a zero gradient supplies no distinguished normal and the level set may have a crossing or an isolated point.

Continue

As optional depth, generalize to three variables and several intermediate dependencies. Write the dimensions of each derivative map before multiplying them; a dependency diagram can prevent missing a route through an intermediate variable. The chain-rule investigation provides another composed-rate example.

Save one comparison in which the same spatial direction is traversed at two speeds. Explain why the time derivative changes but the derivative per unit distance does not. In the next lessons, gradients will identify stationary candidates and constraint normals, while second-order terms will determine whether a candidate bends upward, downward or in mixed directions.

Apply · explain · revise

Practice and reasoning

Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.

Let f(x,y)=xy, x(t)=t² and y(t)=t+1. Find d(f(x(t),y(t)))/dt at t=2.

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

For f=x²+2y² at (1,1), find the directional derivative in unit direction (3/5,4/5).

Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.

For a directional derivative per unit distance in direction (3,4), use:

Your response

At a point with nonzero gradient, the greatest unit-direction derivative equals:

Your response

Prove the gradient of a differentiable function is perpendicular to a differentiable curve lying in a level surface, wherever its tangent exists.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Let T(u,v)=(u+v,uv) and f(x,y)=x²+y. Compute the derivative of f∘T at (1,2) as a row vector.

Structure your argument and preserve revisions

These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.

Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.

Reflect and continue

Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.