Gradient Notes

Published on: September 29, 2026

These Gradient Notes explain how to collect the partial derivatives of a function into a single vector, with the working shown line by line. Each component measures how fast the function changes along one axis while the others are held still. Together they point in the direction of steepest increase, and their length is how steep that is. Following the same pattern every time keeps each variable differentiated on its own.

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Find each partial derivative.
  4. Collect the partial derivatives into the gradient.

Formula: Gradient Formula

This formula collects the partial derivatives into one vector. Each component is the partial derivative with respect to one variable.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Useful Tips to Remember

The gradient is a vector with one component for each variable in the function. It points in the direction of fastest increase, and its length is the steepest rate of increase. At a peak or a dip every component is 0. The gradient is always at right angles to the level curves of the function.

Required knowledge

Where Is the Gradient Used?

The gradient shows which way a function rises fastest and how steep it is, so it guides almost every optimisation method. Gradient descent, the algorithm behind machine learning, steps against the gradient to reduce error. In physics, forces come from the gradient of a potential, and heat flows against the temperature gradient. Map makers and hikers use gradients for the steepest route up a hill, and image software uses them to detect edges.

  • Gradient descent in machine learning
  • Forces from potential energy in physics
  • Heat flow and temperature gradients
  • Steepest paths on terrain maps
  • Edge detection in image processing

Gradient Practice Problems

Example 1 finds the gradient of \(x y + y z + z x\), which has three components, and Example 2 uses \(x^{2} y^{3}\) in two variables. Examples 3 and 4 give you two more of the same kind to try, \(f(x, y, z) = x^{2} y + 3 y z\) and \(f(x, y, z) = x y^{2} + z^{3}\). Find each partial derivative, collect them and compare.

The worked examples below go through the same pattern from start to finish, so you can compare every step with your own working. Try each problem on paper first, then open the example and check your working one step at a time, so you can see exactly which step went wrong if your answer does not match. Use them to check your answers and to understand why each step works.

See Example 1 Hide Example 1

Problem

\(f(x, y, z) = x y + x z + y z\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Find each partial derivative.
  4. Collect the partial derivatives into the gradient.

Formula

Formula: Gradient Formula

This formula collects the partial derivatives into one vector. Each component is the partial derivative with respect to one variable.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of \(f(x, y, z) = x y + x z + y z\).

\(f(x, y, z) = x y + x z + y z\)

Step 2

Step 2 - Write the formula.

In this problem: The gradient is the vector of partial derivatives. It points in the direction in which f increases fastest.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3

Step 3 - Find each partial derivative.

In this problem: Each partial derivative is found with the other variables held constant, as in the Partial Derivatives Calculator.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3a

Step 3a - Find the partial derivative with respect to x.

In this problem: Holding \(y\) and \(z\) constant, differentiating \(x y + x z + y z\) with respect to \(x\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial x} = y + z\).

\(\frac{\partial f}{\partial x} = y + z\)

Step 3b

Step 3b - Find the partial derivative with respect to y.

In this problem: Holding \(x\) and \(z\) constant, differentiating \(x y + x z + y z\) with respect to \(y\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial y} = x + z\).

\(\frac{\partial f}{\partial y} = x + z\)

Step 3c

Step 3c - Find the partial derivative with respect to z.

In this problem: Holding \(x\) and \(y\) constant, differentiating \(x y + x z + y z\) with respect to \(z\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial z} = x + y\).

\(\frac{\partial f}{\partial z} = x + y\)

Step 4

Step 4 - Collect the partial derivatives into the gradient.

In this problem: Placing the partial derivatives in order gives \(\nabla f = \left\langle y + z,\; x + z,\; x + y \right\rangle\).

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle = \left\langle y + z,\; x + z,\; x + y \right\rangle\)

Final Answer

\(\nabla f = \left\langle y + z,\; x + z,\; x + y \right\rangle\)
See Example 2 Hide Example 2

Problem

\(f(x, y) = x^{2} y^{3}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Find each partial derivative.
  4. Collect the partial derivatives into the gradient.

Formula

Formula: Gradient Formula

This formula collects the partial derivatives into one vector. Each component is the partial derivative with respect to one variable.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of \(f(x, y) = x^{2} y^{3}\).

\(f(x, y) = x^{2} y^{3}\)

Step 2

Step 2 - Write the formula.

In this problem: The gradient is the vector of partial derivatives. It points in the direction in which f increases fastest.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y} \right\rangle\)

Step 3

Step 3 - Find each partial derivative.

In this problem: Each partial derivative is found with the other variables held constant, as in the Partial Derivatives Calculator.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y} \right\rangle\)

Step 3a

Step 3a - Find the partial derivative with respect to x.

In this problem: Holding \(y\) constant, differentiating \(x^{2} y^{3}\) with respect to \(x\), covered in the Power Rule Calculator, gives \(\frac{\partial f}{\partial x} = 2 x y^{3}\).

\(\frac{\partial f}{\partial x} = 2 x y^{3}\)

Step 3b

Step 3b - Find the partial derivative with respect to y.

In this problem: Holding \(x\) constant, differentiating \(x^{2} y^{3}\) with respect to \(y\), covered in the Power Rule Calculator, gives \(\frac{\partial f}{\partial y} = 3 x^{2} y^{2}\).

\(\frac{\partial f}{\partial y} = 3 x^{2} y^{2}\)

Step 4

Step 4 - Collect the partial derivatives into the gradient.

In this problem: Placing the partial derivatives in order gives \(\nabla f = \left\langle 2 x y^{3},\; 3 x^{2} y^{2} \right\rangle\).

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y} \right\rangle = \left\langle 2 x y^{3},\; 3 x^{2} y^{2} \right\rangle\)

Final Answer

\(\nabla f = \left\langle 2 x y^{3},\; 3 x^{2} y^{2} \right\rangle\)
See Example 3 Hide Example 3

Problem

\(f(x, y, z) = x^{2} y + 3 y z\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Find each partial derivative.
  4. Collect the partial derivatives into the gradient.

Formula

Formula: Gradient Formula

This formula collects the partial derivatives into one vector. Each component is the partial derivative with respect to one variable.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of \(f(x, y, z) = x^{2} y + 3 y z\).

\(f(x, y, z) = x^{2} y + 3 y z\)

Step 2

Step 2 - Write the formula.

In this problem: The gradient is the vector of partial derivatives. It points in the direction in which f increases fastest.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3

Step 3 - Find each partial derivative.

In this problem: Each partial derivative is found with the other variables held constant, as in the Partial Derivatives Calculator.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3a

Step 3a - Find the partial derivative with respect to x.

In this problem: Holding \(y\) and \(z\) constant, differentiating \(x^{2} y + 3 y z\) with respect to \(x\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial x} = 2 x y\).

\(\frac{\partial f}{\partial x} = 2 x y\)

Step 3b

Step 3b - Find the partial derivative with respect to y.

In this problem: Holding \(x\) and \(z\) constant, differentiating \(x^{2} y + 3 y z\) with respect to \(y\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial y} = x^{2} + 3 z\).

\(\frac{\partial f}{\partial y} = x^{2} + 3 z\)

Step 3c

Step 3c - Find the partial derivative with respect to z.

In this problem: Holding \(x\) and \(y\) constant, differentiating \(x^{2} y + 3 y z\) with respect to \(z\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial z} = 3 y\).

\(\frac{\partial f}{\partial z} = 3 y\)

Step 4

Step 4 - Collect the partial derivatives into the gradient.

In this problem: Placing the partial derivatives in order gives \(\nabla f = \left\langle 2 x y,\; x^{2} + 3 z,\; 3 y \right\rangle\).

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle = \left\langle 2 x y,\; x^{2} + 3 z,\; 3 y \right\rangle\)

Final Answer

\(\nabla f = \left\langle 2 x y,\; x^{2} + 3 z,\; 3 y \right\rangle\)
See Example 4 Hide Example 4

Problem

\(f(x, y, z) = x y^{2} + z^{3}\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Find each partial derivative.
  4. Collect the partial derivatives into the gradient.

Formula

Formula: Gradient Formula

This formula collects the partial derivatives into one vector. Each component is the partial derivative with respect to one variable.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of \(f(x, y, z) = x y^{2} + z^{3}\).

\(f(x, y, z) = x y^{2} + z^{3}\)

Step 2

Step 2 - Write the formula.

In this problem: The gradient is the vector of partial derivatives. It points in the direction in which f increases fastest.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3

Step 3 - Find each partial derivative.

In this problem: Each partial derivative is found with the other variables held constant, as in the Partial Derivatives Calculator.

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle\)

Step 3a

Step 3a - Find the partial derivative with respect to x.

In this problem: Holding \(y\) and \(z\) constant, differentiating \(x y^{2} + z^{3}\) with respect to \(x\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial x} = y^{2}\).

\(\frac{\partial f}{\partial x} = y^{2}\)

Step 3b

Step 3b - Find the partial derivative with respect to y.

In this problem: Holding \(x\) and \(z\) constant, differentiating \(x y^{2} + z^{3}\) with respect to \(y\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial y} = 2 x y\).

\(\frac{\partial f}{\partial y} = 2 x y\)

Step 3c

Step 3c - Find the partial derivative with respect to z.

In this problem: Holding \(x\) and \(y\) constant, differentiating \(x y^{2} + z^{3}\) with respect to \(z\), covered in the Sum Rule Calculator, gives \(\frac{\partial f}{\partial z} = 3 z^{2}\).

\(\frac{\partial f}{\partial z} = 3 z^{2}\)

Step 4

Step 4 - Collect the partial derivatives into the gradient.

In this problem: Placing the partial derivatives in order gives \(\nabla f = \left\langle y^{2},\; 2 x y,\; 3 z^{2} \right\rangle\).

\(\nabla f = \left\langle \frac{\partial f}{\partial x},\; \frac{\partial f}{\partial y},\; \frac{\partial f}{\partial z} \right\rangle = \left\langle y^{2},\; 2 x y,\; 3 z^{2} \right\rangle\)

Final Answer

\(\nabla f = \left\langle y^{2},\; 2 x y,\; 3 z^{2} \right\rangle\)

Calculator and Practice Mode