Lesson 1 of 9
Partial derivatives: one direction at a time
For a function with many inputs, a partial derivative changes one input while temporarily freezing the others.
Core lesson · about 6 minutes · 3 guided parts
On a hill, you can ask how steep it is east–west while refusing to move north–south. That one-direction slope is a partial derivative.
Your learning route
Build the idea one piece at a time
- Slices through a surface
- Level sets and local linear models
- How a weather map predicts temperature a short walk away
Slices through a surface
Freeze y and slice the surface. The slice is an ordinary curve, so its slope is ∂f/∂x.
For z=f(x,y), ∂f/∂x treats y as a constant and ∂f/∂y treats x as a constant.
Partials carry units. If f is temperature and x is kilometres east, ∂f/∂x is temperature change per eastward kilometre.
Mixed partials such as ∂²f/∂y∂x measure how one directional slope changes in another direction. For smooth functions, the order usually agrees.
Holding y fixed describes a mathematical slice through the surface, not a claim that y can always be frozen in the physical system being modelled.
The symbol ∂ distinguishes a partial derivative from a one-variable derivative and reminds us which coordinate is allowed to move in that calculation.
Having every partial derivative at a point does not alone guarantee a good tangent plane; differentiability requires the combined error to be small in every approaching direction.
fₓ=∂f/∂x, fᵧ=∂f/∂yWorked example
For f(x,y)=x²y+3y², find fₓ and fᵧ at (2,1).
- Hold y fixed: fₓ=2xy.
- At (2,1), fₓ=2·2·1=4.
- Hold x fixed: fᵧ=x²+6y.
- At (2,1), fᵧ=4+6=10.
Answer: fₓ(2,1)=4 and fᵧ(2,1)=10
Level sets and local linear models
A contour map joins points with equal output. Zoom in near a smooth point and the surface looks like a tilted plane.
A level set f(x,y)=c is a curve of constant output, like an elevation contour or equal-loss line.
The tangent-plane approximation is f(a+Δx,b+Δy)≈f(a,b)+fₓΔx+fᵧΔy.
This total differential combines small changes from every input and is often the quickest way to estimate sensitivity or propagated measurement error.
Along a level curve, the first-order change df is zero, so its tangent movements balance the coordinate contributions f_x dx and f_y dy.
The tangent plane uses information at one base point and ignores quadratic terms, making its error usually much smaller for a move of one metre than one kilometre.
For measured inputs with small uncertainties, absolute derivative values times input uncertainties provide a cautious first-order estimate of possible output uncertainty.
df≈fₓdx+fᵧdyWorked example
Use a linear approximation for f(x,y)=xy near (2,3) to estimate f(2.01,2.98).
- At (2,3), f=6, fₓ=y=3, and fᵧ=x=2.
- The input changes are Δx=0.01 and Δy=−0.02.
- The predicted change is 3(0.01)+2(−0.02)=−0.01.
- So f≈6−0.01=5.99; the exact product is 5.9898.
Answer: Approximately 5.99
Practical deep dive for this lesson
How a weather map predicts temperature a short walk away
A temperature field depends on east-west and north-south position together. Partial derivatives separate those directions, while the tangent plane recombines them for a nearby prediction.
Let T(x,y) be temperature in degrees Celsius, where x kilometres points east and y kilometres points north from a weather station.
The partial derivative Tₓ asks how temperature changes during an eastward move while north-south position is temporarily held fixed.
Likewise Tᵧ measures change per northward kilometre while x stays fixed. These are two different slopes through the same surface.
A contour line joins locations with equal temperature. Walking along it changes x and y in a combination whose first-order temperature changes cancel.
Near a measured point, the curved temperature surface is approximated by a plane. Its tilt in each coordinate direction comes from the two partial derivatives.
For a small move (Δx,Δy), the estimate ΔT≈TₓΔx+TᵧΔy adds the contribution from each direction.
Units verify the calculation: degrees per kilometre times kilometres gives degrees, so the two terms can be added to the starting temperature.
A mixed partial such as T_xy measures how the eastward slope itself changes as we travel north. That detects interactions not visible in one straight slice.
Weather software repeats this local calculation on a grid, but the derivatives usually come from fitted or simulated fields because raw station readings are sparse.
The approximation supports short-range interpolation and sensor planning; it does not replace the full atmosphere model for a large journey or long forecast.
T(a+Δx,b+Δy)≈T(a,b)+TₓΔx+TᵧΔyWorked example
Near a station, T(x,y)=20+2x−y+0.1xy. Estimate T(1.04,1.98) by linearising at (1,2), with distance in km.
- Evaluate the starting temperature: T(1,2)=20+2−2+0.2=20.2°C.
- Differentiate with respect to x while holding y fixed: Tₓ=2+0.1y.
- At (1,2), Tₓ=2.2°C per eastward kilometre.
- Differentiate with respect to y: Tᵧ=−1+0.1x, so Tᵧ(1,2)=−0.9°C per northward kilometre.
- The move is Δx=0.04 km and Δy=−0.02 km.
- Estimate ΔT≈2.2(0.04)+(−0.9)(−0.02)=0.088+0.018=0.106°C.
- Add the change to the starting value: T≈20.2+0.106=20.306°C.
- The exact formula gives 20.30592°C, so the small difference is the ignored product of the two small moves.
Answer: Approximately 20.306°C.
Check your picture
For f(x,y)=x³+y, what is ∂f/∂x?
Reveal answer
3x².
This lesson versus the whole chapter
Your topic-specific practical example is above.
The final lesson collects five longer chapter-wide workflows for machine learning, LLMs, trading, physics, and everyday decisions.
Formula shelf
Symbols with meaning
fₓᵢ=∂f/∂xᵢChange one input while holding the others fixed.
∇f=[fₓ₁,…,fₓₙ]ᵀDirection and size of steepest local rise.
Dᵤf=∇f·uSlope in unit direction u.
Jᵢⱼ=∂Fᵢ/∂xⱼLocal linear map from input changes to output changes.
∫ᴿf(x)dx=∫ᵁf(T(u))|det JT|duCorrects area or volume when coordinates stretch.
∫ᶜF·dr=∫F(r(t))·r′(t)dtAccumulates the component of a field along a path.
∯∂ⱽF·n dS=∭ⱽ∇·F dVEquates outward boundary flux with sources inside a volume.
Hᵢⱼ=∂²f/∂xᵢ∂xⱼMatrix of local curvature.
f(x+Δ)≈f(x)+∇fᵀΔ+½ΔᵀHΔLocal quadratic approximation.
∇ₓL=Wᵀg; ∇W L=gxᵀPass sensitivity through z=Wx+b.
Y[b,t,o]=sum over d of X[b,t,d]W[d,o]Contracts feature axis d while retaining batch, token, and output axes.
LSE(z)=m+logΣᵢeᶻᶦ⁻ᵐComputes a smooth maximum and softmax normalizer without overflow.
J=diag(p)−ppᵀCaptures how all normalized probabilities respond together.
∇W log det W=W⁻ᵀDifferentiates volume change for an invertible positive-determinant matrix.
Hv=d[∇f(x+εv)]/dε|₀Measures curvature along v without forming the full Hessian.
Before moving on
You are ready when you can…
- Compute and interpret partial derivatives and tangent planes.
- Use gradients and directional derivatives geometrically.
- Build Jacobians with correct shapes and compose them.
- Set up double and triple integrals, apply Jacobian factors, and interpret line integrals, divergence, curl, Green, Stokes, and divergence theorems with their assumptions.
- Use Hessians to describe curvature and stationary points.
- Track batch, sequence, and feature axes; apply broadcasting rules; and shape-check tensor contractions and einsum expressions.
- Differentiate vector and matrix expressions and trace a backward pass.
- Derive stable log-sum-exp, softmax Jacobians, and the fused softmax–cross-entropy gradient.
- Use trace differentials, log-determinant rules, JVPs, VJPs, and Hessian-vector products with correct shapes.