Gradient of a Line Notes

Published on: November 19, 2026

This Gradient of a Line Calculator finds how steep a straight line is from two points on it, and shows the working line by line. The gradient is the rise, the change in y, divided by the run, the change in x. The answer is simplified and given as a fraction and a decimal. A positive gradient goes up from left to right, a negative one goes down, 0 is flat, and a vertical line has no gradient.

run rise (x₁, y₁) (x₂, y₂)

In the diagram, the rise is how far the line goes up between the two points and the run is how far it goes across.

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)
See Example 1 Hide Example 1

Problem

\((x_{1}, y_{1}) = (1, 2), (x_{2}, y_{2}) = (5, 4)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((1, 2)\) and \((5, 4)\).

\((x_{1}, y_{1}) = (1, 2),\; (x_{2}, y_{2}) = (5, 4)\)
run rise (1, 2) (5, 4)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(1\), \(2\), \(5\) and \(4\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{4 - 2}{5 - 1}\).

\(m = \frac{4 - 2}{5 - 1}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(4 - 2 = 2\) and the run is \(5 - 1 = 4\). \(\frac{2}{4}\) simplifies to \(\frac{1}{2}\) by dividing the top and the bottom by \(2\). As a decimal, \(\frac{1}{2} = 0.5\). The gradient is positive, so the line goes up from left to right.

\(\begin{aligned} m &= \frac{4 - 2}{5 - 1} \\[8pt] &= \frac{2}{4} \\[8pt] &= \frac{1}{2} \\[8pt] &= 0.5 \end{aligned}\)

Final Answer

\(m = \frac{1}{2} = 0.5\)
See Example 2 Hide Example 2

Problem

\((x_{1}, y_{1}) = (-3, 1), (x_{2}, y_{2}) = (3, -2)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((-3, 1)\) and \((3, -2)\).

\((x_{1}, y_{1}) = (-3, 1),\; (x_{2}, y_{2}) = (3, -2)\)
run rise (−3, 1) (3, −2)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(-3\), \(1\), \(3\) and \(-2\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{-2 - 1}{3 - \left(-3\right)}\).

\(m = \frac{-2 - 1}{3 - \left(-3\right)}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(-2 - 1 = -3\) and the run is \(3 - \left(-3\right) = 6\). \(\frac{-3}{6}\) simplifies to \(-\frac{1}{2}\) by dividing the top and the bottom by \(3\). As a decimal, \(-\frac{1}{2} = -0.5\). The gradient is negative, so the line goes down from left to right.

\(\begin{aligned} m &= \frac{-2 - 1}{3 - \left(-3\right)} \\[8pt] &= \frac{-3}{6} \\[8pt] &= -\frac{1}{2} \\[8pt] &= -0.5 \end{aligned}\)

Final Answer

\(m = -\frac{1}{2} = -0.5\)
See Example 3 Hide Example 3

Problem

\((x_{1}, y_{1}) = (0, 0), (x_{2}, y_{2}) = (4, 6)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((0, 0)\) and \((4, 6)\).

\((x_{1}, y_{1}) = (0, 0),\; (x_{2}, y_{2}) = (4, 6)\)
run rise (0, 0) (4, 6)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(0\), \(0\), \(4\) and \(6\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{6 - 0}{4 - 0}\).

\(m = \frac{6 - 0}{4 - 0}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(6 - 0 = 6\) and the run is \(4 - 0 = 4\). \(\frac{6}{4}\) simplifies to \(\frac{3}{2}\) by dividing the top and the bottom by \(2\). As a decimal, \(\frac{3}{2} = 1.5\). The gradient is positive, so the line goes up from left to right.

\(\begin{aligned} m &= \frac{6 - 0}{4 - 0} \\[8pt] &= \frac{6}{4} \\[8pt] &= \frac{3}{2} \\[8pt] &= 1.5 \end{aligned}\)

Final Answer

\(m = \frac{3}{2} = 1.5\)
See Example 4 Hide Example 4

Problem

\((x_{1}, y_{1}) = (2, 5), (x_{2}, y_{2}) = (7, 5)\)

Approach

Step-by-step method

  1. Set up the problem.
  2. Write the formula.
  3. Substitute the two pairs of coordinates into the formula.
  4. Work out the gradient.

Formula

Formula: Gradient Formula

This formula gives how steep a line is. Divide the change in y, the rise, by the change in x, the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 1

Step 1 - Set up the problem.

In this problem: We are finding the gradient of the straight line through the points \((2, 5)\) and \((7, 5)\).

\((x_{1}, y_{1}) = (2, 5),\; (x_{2}, y_{2}) = (7, 5)\)
run rise (2, 5) (7, 5)

Step 2

Step 2 - Write the formula.

In this problem: The gradient says how steep a line is: how far it goes up, the rise, for every step it goes across, the run. The rise is the change in \(y\) and the run is the change in \(x\), so the gradient is the rise divided by the run.

\(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\)

Step 3

Step 3 - Substitute the two pairs of coordinates into the formula.

In this problem: Replacing \(x_{1}\), \(y_{1}\), \(x_{2}\) and \(y_{2}\) with \(2\), \(5\), \(7\) and \(5\) in \(m = \frac{y_{2} - y_{1}}{x_{2} - x_{1}}\) gives \(m = \frac{5 - 5}{7 - 2}\).

\(m = \frac{5 - 5}{7 - 2}\)

Step 4

Step 4 - Work out the gradient.

In this problem: The rise is \(5 - 5 = 0\) and the run is \(7 - 2 = 5\). Dividing the rise by the run gives \(\frac{0}{5} = 0\). The gradient is 0, so the line is flat.

\(\begin{aligned} m &= \frac{5 - 5}{7 - 2} \\[8pt] &= \frac{0}{5} \\[8pt] &= 0 \end{aligned}\)

Final Answer

\(m = 0\)