Gradient

Courses

∇\nabla∇The maths behind AI0/72
π\piπMaths0/84
⋆\star⋆AI for everyone0/10
Γ\GammaΓGame theory0/49
py\texttt{py}pyPython for AI0/15
y^\hat{y}y^​Build your own AI0/15
All courses

Tuition

My tuitionOlympiad trackCompetitions

Practice

ProjectsAsk a questionTrain on a GPUExplorationsMaths StoriesUnsolved problemsPlaygroundScience labsMock testsOlympiad

Reference

GlossaryBlogDiscoveries
Blog › Explore in 3D

25 November 2026 · 3 min readInteractive 3D

Aerial view of a mountain valley with a river running through it
Photo by Karsten Winegeart on Unsplash

What is a partial derivative? Slopes two ways

On a curved surface, the slope depends on which way you walk. A flat tangent plane shows both slopes at once.

On a curve, the derivative is the slope at a point. On a surface, there is no single slope: walking east might be steep while walking north is flat. So we measure one slope for each direction. Those are partial derivatives.

Move the point. The two arrows show the slope in each direction; the flat plane just touches the surface.

Freeze one, vary the other

To find the slope in the x direction, hold y fixed and see how fast the height changes as x moves. That is ∂f/∂x. Do the same the other way for ∂f/∂y. Each is an ordinary derivative, taken while pretending the other input is a constant.

The gradient

Put the two partial derivatives in a list and you have the gradient. It points in the direction of steepest climb, and its length is how steep that climb is. Gradient descent walks the opposite way. The flat tangent plane in the picture is completely fixed by these two numbers.

Find a point where both readouts are 0. The plane lies perfectly flat: you are on a peak, in a valley, or on a saddle.

A worked example

Take f(x, y) = x²y + 3y. To find ∂f/∂x, treat y as a fixed number; to find ∂f/∂y, treat x as fixed.

  1. ∂f/∂x = 2xy (3y is a constant here, so it disappears)
  2. ∂f/∂y = x² + 3
  3. At (2, 1): ∂f/∂x = 4 and ∂f/∂y = 7
  4. The gradient at (2, 1) is (4, 7)

The gradient points uphill

The gradient (4, 7) is an arrow pointing in the direction where f rises fastest, and its length (about 8.06) is how steep that is. Walking along the opposite arrow goes downhill fastest. That is exactly what gradient descent does to train a model, with one partial derivative for every weight.

Where you see them

  • Weather maps: how temperature changes going north versus going east.
  • Economics: how profit changes with price while holding cost fixed.
  • Machine learning: how the loss changes with each weight separately.
  • Physics: heat flow and waves are described with partial derivatives.

The symbol ∂ is a curly d, read “partial”, to show that the other variables are held still.

A hill-walking example

A hill’s height is h(x, y) = 100 − x² − 2y² metres. At (3, 2), ∂h/∂x = −6 and ∂h/∂y = −8. Walking east you drop 6 m per metre; walking north you drop 8 m per metre. The gradient (−6, −8) points the way up, back towards the summit at (0, 0).

Glossary

  • Multivariable function: a function of several inputs.
  • Gradient: vector of all partial derivatives.
  • Contour line: a line of equal height on a map.
  • Chain rule: how to differentiate functions inside functions.

Try these yourself

  1. Q1. f = 3x + 2y: ∂f/∂x = 3, ∂f/∂y = 2
  2. Q2. f = x²y²: ∂f/∂x = 2xy²
  3. Q3. f = xy at (2, 5): gradient (5, 2)
  4. Q4. Which way is fastest downhill? Opposite the gradient

In short

A partial derivative measures change along one direction with the rest held still. Together they form the gradient, which points uphill and drives learning.

Keep going

  • Lesson: gradients
  • Glossary: gradient
  • Gradient descent in 3D
  • What is Ohm’s law?
  • How does attention work in transformers?
  • What is convolution? How AI finds edges
  • What does a matrix actually do? Watch it stretch space

Read and listen in

Indian languages

World languages

Questions people ask

What is a partial derivative?

The rate of change of a function of several variables with respect to one variable, while all the others are held fixed.

What is the gradient?

The list of all partial derivatives. It points in the direction of steepest increase.

How are partial derivatives used in AI?

Training computes the partial derivative of the loss with respect to every weight and nudges each weight downhill.

More articles

  • How does attention work in transformers?
  • What is convolution? How AI finds edges
  • What does a matrix actually do? Watch it stretch space