Partial Derivatives

Slice a surface to find its slope in each direction, zoom in until it becomes a plane, and point downhill with the directional derivative

Partial Derivatives

Standing on a hillside, you cannot ask for the slope: it depends which way you face. Partial derivatives answer the question for the two compass directions along the axes, by freezing one variable and differentiating in the other. Put them together and you get the tangent plane, the flat surface a landscape turns into under a microscope, and the gradient, an arrow that knows the slope in every direction at once.

Slicing the Surface

Drag the point on the contour map. The two planes through it slice the surface, and each slice, drawn below as an ordinary graph, has a tangent line whose slope is a partial derivative.

∂f/∂x = e^(−x² − y²) − 2x² e^(−x² − y²)
∂f/∂y = −2xy e^(−x² − y²)
−0.345
f(−0.50, 0.35)
0.345
f_x: slope of the y = y₀ slice
0.241
f_y: slope of the x = x₀ slice
At (−0.50, 0.35) the surface is rising in the +x-direction (f_x = 0.345) and rising in the +y-direction (f_y = 0.241). To get f_x, freeze y at 0.35 and differentiate the one-variable function x ↦ f(x, 0.35) in the lower-left panel; f_y freezes x instead.

Drag the surface to turn it. The pink plane is y = y₀ and the green plane is x = x₀; the lines on the map are where they meet the floor. The 3D height is rescaled to fit the scene, so slopes look steeper or shallower than they are; the slice graphs below use true heights, and every readout is exact (differentiated symbolically).

Go deeper:Freeze One Variable

The partial derivative of f with respect to x at (a, b) is the ordinary derivative of the one-variable function x ↦ f(x, b):

f_x(a, b) = lim (h → 0) [f(a + h, b) − f(a, b)] / h

Geometrically, the plane y = b cuts the surface along a curve, and f_x(a, b) is the slope of that curve. To compute it, treat y as a constant: for f = x²y + sin y, f_x = 2xy and f_y = x² + cos y. The notations ∂f/∂x, f_x and D₁f all mean the same thing. The curly ∂ was used by Adrien-Marie Legendre in 1786 and revived for good by Carl Jacobi in 1841.

Differentiating again gives four second partials: f_xx, f_yy and the mixed f_xy and f_yx. Switch them on in the demo and the two mixed ones always agree. That is Clairaut’s theorem, also called Schwarz’s theorem after Hermann Schwarz, who gave the first rigorous proof in 1873: if the mixed partials are continuous, the order of differentiation does not matter. The hypothesis is needed. For f = xy(x² − y²)/(x² + y²), with f(0, 0) = 0, the mixed partials at the origin are −1 and +1.

Zooming In on the Tangent Plane

Press Zoom in and watch the surface flatten onto the violet tangent plane. Then try the cone and xy/√(x² + y²) at the origin, which never flatten however far you zoom.

z = 0.383 + 0.179(x − 0.60) + 0.230(y − (−0.30))
×1.4
magnification (window ±1.416)
0.9504
largest gap |f − plane| in the window
0.6712
gap ÷ w (how it looks on screen)
0.474
gap ÷ w²
On screen the gap is gap ÷ w = 0.6712 of the window. Each tenfold zoom divides it by about ten, because the gap itself shrinks like w² (gap ÷ w² stays near 0.47). Zoom far enough and the surface cannot be told from its tangent plane: that is what differentiable means.

The window is the square a − w ≤ x ≤ a + w, b − w ≤ y ≤ b + w, drawn the same size at every zoom with equal magnification in all three directions (steep planes are squashed vertically by a fixed factor). The surface is coloured by its distance from the plane on screen. The gap is measured on a 41 × 41 grid. Where the formula reads 0/0, as for xy/√(x² + y²) at the origin, f takes its limiting value 0.

Go deeper:What Differentiable Means

The two tangent lines from the slices span a plane through (a, b, f(a, b)):

z = f(a, b) + f_x(a, b)(x − a) + f_y(a, b)(y − b)

f is differentiable at (a, b) when this plane fits so well that the gap, divided by the distance from (a, b), tends to zero. On the screen that is exactly what zooming shows: a window of half-width w is magnified by 1/w, so a gap of size g appears as g/w. For a smooth surface the gap is of order w², by Taylor’s theorem, and its image shrinks in proportion to w. The log–log plot shows slope 2.

Having both partial derivatives is not enough. The function xy/√(x² + y²) is zero on both axes, so f_x(0, 0) = f_y(0, 0) = 0 and the candidate plane is z = 0. But along the diagonal y = x it equals |x|/√2, which grows in proportion to the distance from the origin. The function is the same at every scale (it is homogeneous of degree one), so no amount of zooming flattens it, and the log–log plot has slope 1. A useful sufficient condition goes the other way: if f_x and f_y exist near (a, b) and are continuous at it, then f is differentiable there.

The tangent plane is the linear approximation Δz ≈ f_x Δx + f_y Δy. It tells you how errors in measurements propagate, and it is the first step of almost every numerical method in several variables.

The Directional Derivative

Drag on the map to aim the direction u, or spin it. The slope of the surface in direction u traces a circle in the polar plot, largest along the gradient and zero along the level curve.

(0.55, 0.57)
∇f = (f_x, f_y)
0.797
|∇f|: the steepest slope
(0.83, 0.56)
u at θ = 34°
0.781
D_u f = ∇f · u
u makes 12° with ∇f, so D_u f = |∇f| cos 12° = 0.781: uphill, but less steeply than along ∇f.

The pink plane contains the point and the direction u; the curve where it meets the surface is the slice whose slope is D_u f. The 3D height is rescaled to fit, so read slopes from the numbers. In the polar plot each direction u is marked at distance D_u f along u (along −u when D_u f is negative, which lands on the same circle): the circle with diameter ∇f.

Go deeper:Every Direction from Two Numbers

For a unit vector u = (u₁, u₂), the directional derivative is the slope of the surface in direction u:

D_u f(a, b) = lim (h → 0) [f(a + hu₁, b + hu₂) − f(a, b)] / h

If f is differentiable, the tangent plane gives it at once: moving h along u changes the height by about h(f_x u₁ + f_y u₂), so D_u f = ∇f · u, where ∇f = (f_x, f_y) is the gradient. Two partial derivatives determine the slope in every direction.

Writing the dot product as ∇f · u = |∇f| cos θ, with θ the angle between u and ∇f, explains the polar plot. The slope is greatest, |∇f|, when u points along the gradient, most negative when it points the other way, and zero when u is perpendicular. The points D_u f · u lie on a circle with the gradient as its diameter, by Thales’ theorem.

Zero slope means walking along a contour, so the gradient is perpendicular to the level curves. For a proof, take a level curve r(t) with f(r(t)) = c and differentiate with the chain rule: ∇f · r′(t) = 0. That is why water runs downhill at right angles to the contour lines of a map, and why steepest ascent, explored in Gradients and Optimization, follows the gradient.

Key Takeaways

  • A partial derivative is an ordinary derivative of a slice: freeze every variable but one.
  • The tangent plane z = f(a, b) + f_x(x − a) + f_y(y − b) is what a differentiable surface looks like under a microscope.
  • Partial derivatives can exist without a tangent plane; continuity of the partials guarantees one.
  • D_u f = ∇f · u: the gradient points in the steepest direction, its length is the steepest slope, and it is perpendicular to the level curves.

Spot a mistake or have an idea?

Search