Gradient of a line

By Martin McBride, 2022-05-30
Tags: straight line graphs sloping lines gradient
Categories: gcse graphs


The gradient measures the slope of a line.

Finding the gradient

To find the gradient of a line, we need to know two points on the line. We can then work out the gradient from the formula:

$$ gradient = \frac{change\ in\ y}{change\ in\ x} $$

We will find the gradient of this line:

We have marked two points on the line:

  • A (2, 2)
  • B (5, 8)

It is important to use accurate points, otherwise, the gradient will not be accurate. We have chosen two points where the line passes through the grid of the graph paper, so the coordinates are exact whole numbers.

We find the change in x by subtracting the x-coordinate of A (which is 2) from the x-coordinate of B (which is 5):

$$ {change\ in\ x} = 5 - 2 = 3 $$

We find the change in y by subtracting the y-coordinate of A (which is 2) from the y-coordinate of B (which is 8):

$$ {change\ in\ y} = 8 - 2 = 6 $$

So we can calculate the gradient using the formula:

$$ gradient = \frac{change\ in\ y}{change\ in\ x} = \frac{6}{3} = 2 $$

The gradient is positive, which means that the line goes uphill.

Negative gradients

This line goes downhill, so we would expect it to have a negative gradient:

Here are two points on the line:

  • A (2, 6)
  • B (6, 3)

Again we find the change in x by subtracting the x-coordinate of A (which is 2) from the x-coordinate of B (which is 6):

$$ {change\ in\ x} = 6 - 2 = 4 $$

And we find the change in y by subtracting the y-coordinate of A (which is 6) from the y-coordinate of B (which is 3):

$$ {change\ in\ y} = 3 - 6 = -3 $$

We must subtract A from B. Don't make the mistake of always subtracting the smallest from the largest! These values give a gradient of:

$$ gradient = \frac{change\ in\ y}{change\ in\ x} = \frac{-3}{4} = -0.75 $$

This time the gradient is negative, which means that the line goes downhill.

Check that the sign is correct

If you always subtract A from B for both x and y, you should always find that the value is positive for uphill curves, and negative for downhill curves.

But it is always worth checking. For example, if you calculate a positive gradient when the curve has a downhill slope, then you have made a mistake. Check that you have done the subtractions the right way round.

What does the gradient measure?

The gradient tells us how much y changes if we change x by one.

Special cases

We previously looked at horizontal and vertical lines. What gradients do those lines have?

Here is a horizontal line:

If we apply the formula to two of the points, (1, 3) and (3, 3), the result is:

$$ gradient = \frac{change\ in\ y}{change\ in\ x} = \frac{3-3}{3-1} = 0 $$

The gradient is zero. The line is neither uphill nor downhill, and zero is neither positive nor negative.

Here is a vertical line:

If we apply the formula to two of the points, (2, 1) and (2, 3), the result is:

$$ gradient = \frac{change\ in\ y}{change\ in\ x} = \frac{3-1}{2-2} = \frac{2}{0} $$

We can't divide 2 by 0, so the gradient of a vertical line is undefined.

Run and rise

The change in x is sometimes called the run, and the change in y is sometimes called the rise:

These are just different names for the change in x and y. The gradient is then given by:

$$ gradient = \frac{rise}{run} $$

For negative gradients, the change in y is usually called the fall.

See also



Join the GraphicMaths Newletter

Sign up using this form to receive an email when new content is added:

Popular tags

adder adjacency matrix alu and gate angle area argand diagram binary maths cartesian equation chain rule chord circle cofactor combinations complex polygon complex power complex root cosh cosine cosine rule cpu cube decagon demorgans law derivative determinant diagonal directrix dodecagon ellipse equilateral triangle eulers formula exponent exponential exterior angle first principles flip-flop focus gabriels horn gradient graph hendecagon heptagon hexagon horizontal hyperbola hyperbolic function infinity integration by substitution interior angle inverse hyperbolic function inverse matrix irregular polygon isosceles trapezium isosceles triangle kite koch curve l system locus maclaurin series major axis matrix matrix algebra minor axis nand gate newton raphson method nonagon nor gate normal not gate octagon or gate parabola parallelogram parametric equation pentagon perimeter permutations polar coordinates polynomial power probability probability distribution product rule pythagoras proof quadrilateral radians radius rectangle regular polygon rhombus root set set-reset flip-flop sine sine rule sinh sloping lines solving equations solving triangles square standard curves star polygon straight line graphs surface of revolution symmetry tangent tanh transformations trapezium triangle turtle graphics vertical volume of revolution xnor gate xor gate