Key takeaways
- The gradient is ∇f = (∂f/∂x, ∂f/∂y): a vector, not a single number.
- It points in the direction of steepest increase.
- Its length |∇f| is the steepest slope at that point.
- It is always perpendicular to the contour lines.
- Differentiate first, then plug in the point.
In this guide
What is the gradient?
Imagine f(x, y) is the height of the ground at each spot on a map. From where you stand you could walk in any direction. The gradient, written ∇f (say "del f" or "grad f"), is an arrow on the map that points in the steepest uphill direction. The longer the arrow, the steeper the hill.
It is built from two partial derivatives: how fast f changes if you move only in x, and how fast it changes if you move only in y. Put those two slopes side by side and you have the gradient.
Why does the gradient matter?
The gradient is the compass of multivariable calculus. It tells you, at every point, which way is 'most up' and how strongly. Walk against it and you go downhill as fast as possible.
That one idea powers a lot of modern technology. Machine learning models are trained by gradient descent: take a small step against the gradient of the error, then repeat, millions of times.
The gradient never points along a contour line. It always crosses contours at a right angle, straight up the slope.
The formula
| Symbol | What it means | Example |
|---|---|---|
| ∇f | The gradient vector | (12, 3) |
| ∂f/∂x | Slope when you step in the x direction only | 12 |
| ∂f/∂y | Slope when you step in the y direction only | 3 |
| ‖∇f‖ | Length of the arrow, the steepest slope: √((∂f/∂x)² + (∂f/∂y)²) | 12.3693 |
| (x₀, y₀) | The point where you measure it | (1, 2) |
This calculator uses functions of the form f(x, y) = a·xⁿ·yᵐ. Then ∂f/∂x = a·n·xⁿ⁻¹·yᵐ and ∂f/∂y = a·m·xⁿ·yᵐ⁻¹. You enter a, n, m and the point (x₀, y₀). The steps list both parts and the length |∇f|. The main result shown is the first part, ∂f/∂x.
How to find the gradient step by step
- 1Find ∂f/∂x. Treat y as a constant and differentiate in x.
- 2Find ∂f/∂y. Treat x as a constant and differentiate in y.
- 3Plug in the point. Put x₀ and y₀ into both to get two numbers.
- 4Write the vector. ∇f = (∂f/∂x, ∂f/∂y). For the steepness, find its length with the vector magnitude calculator.
Now try your own function. Enter a, the powers and the point below, and the calculator shows both parts of the gradient.
Try it yourself
Pre-filled with the example — change any value.
Common mistakes to avoid
- Treating the gradient as one number. It is a vector with two parts (three in 3D).
- Forgetting to hold the other variable constant. When finding ∂f/∂x, y acts like a fixed number.
- Thinking the gradient points along a curve. It is perpendicular to contour lines, not along them.
- Reading only the main result. The calculator's headline number is ∂f/∂x. Check the steps for ∂f/∂y and |∇f|.
Tips and tricks
- Slope in any direction: dot the gradient with a unit vector to get the directional derivative.
- Flat spot check: if ∇f = (0, 0), you are at a peak, a valley or a saddle point.
- Power shortcut: for a·xⁿ·yᵐ, the x-part just brings n down and lowers the x power by 1. The y-part does the same with m.
Where you'll use it in real life
- Machine learning: gradient descent trains neural networks by stepping against the gradient.
- Heat flow: heat moves opposite to the temperature gradient, from hot to cold.
- Maps and hiking: the steepest path up a hill runs across the contour lines.
- Physics: electric and gravity fields are gradients of potential energy (with a minus sign).
Quick summary
The gradient ∇f = (∂f/∂x, ∂f/∂y) is an arrow pointing in the direction of fastest increase, and its length is the steepest slope. Differentiate in each variable, then plug in the point. Use the calculator above for any function a·xⁿ·yᵐ.
Worked example
The temperature on a metal plate is T(x, y) = 3x²y °C. A tiny bug sits at the point (1, 2). In which direction does it get warmer fastest? Here a = 3, n = 2, m = 1, x₀ = 1 and y₀ = 2.
- 01f(x,y) = 3x^2y^1
- 02∂f/∂x = 6x^1y^1
- 03∂f/∂y = 3x^2y^0
- 04At (1, 2):
- 05∂f/∂x = 6 × 1^1 × 2^1 = 12
- 06∂f/∂y = 3 × 1^2 × 2^0 = 3
- 07∇f = (12, 3)
- 08|∇f| = 12.3693
These numbers are pre-filled in the calculator above.
Frequently asked questions
What does the gradient vector tell you?
Its direction is where the function rises fastest, and its length is how fast it rises in that direction. The opposite direction is the fastest way down.
What is the gradient of f = x²y³ at (2, 1)?
∂f/∂x = 2xy³ = 4 and ∂f/∂y = 3x²y² = 12, so ∇f = (4, 12).
What does a zero gradient mean?
If ∇f = (0, 0), the surface is flat at that point. It could be a peak, a valley bottom or a saddle point, just like a critical point in one-variable calculus.
Why does the calculator show only one number as the result?
The headline result is the first component, ∂f/∂x. The steps list the full gradient vector (both components) and its length |∇f|.


