Goal
Learn how to ask a precise local question about a function with several inputs:
If I change only this input, how does the output respond?
That question is answered by a partial derivative.
Motivation
A machine-learning loss usually depends on many parameters:
Training needs to know how sensitive the loss is to each parameter. Partial derivatives isolate those coordinate-by-coordinate effects.
They are the entries from which gradients, Jacobians, and backpropagation are built.
Intuition: One Knob At A Time
Imagine a sound mixer with several knobs. The output volume depends on all of them, but you can study one knob while leaving the others untouched.
For a function :
- asks how the output changes as moves while is fixed;
- asks how the output changes as moves while is fixed.
The other variable does not disappear. During that derivative, it behaves like a constant.
Notation / Symbol Table
| Symbol | Plain-English name | Meaning |
|---|---|---|
| scalar field | A function taking two coordinates and returning one number. | |
| partial derivative with respect to | Local output sensitivity when only varies. | |
| compact partial notation | Another way to write . | |
| evaluation point | The input where a derivative is measured. | |
| finite input changes | Small but non-infinitesimal coordinate changes. | |
| total differential | First-order change assembled from all coordinate sensitivities. |
The rounded symbol is used because the function has multiple inputs and we are differentiating with respect to only one of them.
Formal Definition
For , the partial derivative with respect to at is:
Only the first coordinate changes. The second remains exactly .
Similarly:
This is ordinary one-variable differentiation applied to a coordinate slice through the surface.
Worked Example: A Quadratic Surface
Let:
To differentiate with respect to , treat as a constant:
Why?
- contributes ;
- contributes because is constant;
- contributes because it does not change as changes.
Now hold fixed and differentiate with respect to :
At :
Near that point, the output is slightly more sensitive to motion in the coordinate than in the coordinate.
Geometry: Slicing A Surface
The graph of is a surface.
To see at :
- freeze ;
- intersect the surface with that vertical plane;
- measure the slope of the resulting curve in the direction.
For , freeze and take the perpendicular slice.
Each partial derivative is a slope along one coordinate direction. It is not yet the whole gradient; it is one component of it.
Partial Derivatives Assemble Into The Gradient
For a scalar field , the gradient collects all first partial derivatives:
This shape distinction matters:
- is one scalar;
- each is one scalar;
- is a vector containing those scalars.
The next lesson studies that assembled vector directly.
Partial Change Versus Total Change
A partial derivative isolates one coordinate. A real input change may move several coordinates at once.
For a small displacement , the first-order output change is approximately:
In differential notation:
The partial derivatives provide local sensitivity coefficients; the coordinate changes say how much of each sensitivity is activated.
Connection To Constrained Optimization
Lesson 33 used the stationarity equation:
For , that compact equation expands into separate partial-derivative equations:
The constraint is recovered from:
Partial derivatives are therefore the mechanics underneath the Lagrange-multiplier system you already solved.
Connection To Machine Learning
Suppose a loss depends on a weight and bias :
Gradient descent updates them using different partial derivatives:
Each derivative measures the local effect of changing one parameter while conceptually holding the others fixed. The optimizer then changes all parameters together using the assembled gradient.
Connection To Programming
A scalar field with two inputs can be represented as:
type ScalarField2 = (x: number, y: number) => number;
A centered finite-difference approximation to the partial is:
function partialX(
f: ScalarField2,
x: number,
y: number,
h = 1e-5,
): number {
return (f(x + h, y) - f(x - h, y)) / (2 * h);
}
Notice that both function evaluations use the same . Only changes.
The corresponding partial keeps fixed:
function partialY(
f: ScalarField2,
x: number,
y: number,
h = 1e-5,
): number {
return (f(x, y + h) - f(x, y - h)) / (2 * h);
}
These numerical approximations are useful for checking analytic derivatives, although training systems usually obtain derivatives through automatic differentiation.
Common Mistakes
Differentiating every variable
When computing , all other independent variables are held constant.
Dropping a constant factor that contains another variable
For , differentiating with respect to gives , not and not .
Confusing the function with its gradient
A scalar objective returns one number. Its partial derivatives are scalar components; the gradient collects them into a vector.
Treating a partial derivative as the whole change
describes sensitivity along one coordinate direction. If several inputs move, their first-order contributions must be combined.
Ignoring the evaluation point
is generally a function. A numerical slope appears only after evaluating it at a particular input.
Exercises
-
In one sentence, distinguish an ordinary derivative for from a partial derivative for .
-
For , compute and .
-
Evaluate both partial derivatives from Problem 2 at and interpret their signs.
-
For , compute both first partial derivatives. State explicitly which quantity is held fixed in each calculation.
-
Explain geometrically what measures on the surface .
-
A loss is . Compute and using the one-variable chain rule inside each partial derivative.
-
At a point, and . Estimate for and using the first-order approximation.
-
For , compute all three partial derivatives and explain what setting each one to zero enforces.
-
Explain why one partial derivative alone cannot determine the steepest direction of a scalar field with multiple inputs.
-
Write TypeScript-style pseudocode for a generic centered finite-difference function that approximates the partial derivative of a scalar field with respect to coordinate . Make the scalar return type of explicit.
Summary
- A partial derivative varies one input while holding the others fixed.
- Geometrically, it is the slope of a coordinate slice through a surface.
- Partial derivatives are scalar local sensitivities.
- The gradient collects all first partial derivatives into a vector.
- Small total changes combine partial sensitivities with coordinate changes.
- Lagrangian stationarity and machine-learning parameter updates are built from partial derivatives.
Next Lesson
Lesson 35 assembles coordinate sensitivities into gradients and directional derivatives, then interprets the gradient as a local linear approximation.
Completed Exercises
Handwritten work submitted after completing this lesson.



