Courses / Computer Science I
Calculus

Multivariable Calculus and Gradients

Computer Science I 259 words Free to read

Multivariable Calculus

Real problems depend on many variables; a machine-learning model's error depends on thousands of parameters. Multivariable calculus extends derivatives to functions of several inputs, and its central tool, the gradient, is the engine behind modern machine learning.

A partial derivative measures the rate of change with respect to one variable while holding the others fixed. For f(x,y)f(x, y), the partial fx\frac{\partial f}{\partial x} is the ordinary derivative treating yy as a constant, and fy\frac{\partial f}{\partial y} treats xx as constant. Each partial is a slope along one axis.

The gradient f\nabla f collects all partials into a vector: f=(fx,fy)\nabla f = (\frac{\partial f}{\partial x}, \frac{\partial f}{\partial y}). It points in the direction of steepest increase of ff, and its magnitude is how steep that increase is. At a maximum or minimum, the gradient is the zero vector.

The Gradient & Descent

ConceptDefinition & Rule
Gradient f\nabla fPoints uphill toward steepest increase
Descent StepMoves opposite f\nabla f to minimise ff
Zero VectorReached at local extrema (f=0\nabla f = 0)
Learning RateSize of the step taken each iteration

This drives gradient descent, the workhorse optimisation algorithm: to minimise a function, repeatedly step in the direction opposite the gradient by a learning-rate amount until the gradient is near zero.

Pitfall: Differentiating with respect to the wrong variable, or forgetting that gradient descent moves opposite the gradient vector because the gradient points uphill.
Multivariable Calculus and Gradients

Practise this lesson

The explanation above is free to read. The graded practice for this lesson lives in the Tryals app.

11practice questions
2interactive scenes

Calculus