Gradients and y = mx + c

On this page

How to work out the gradient of a straight line from a graph or from two points, read the gradient and intercept from an equation, find the equation of a line drawn on a grid, and use the fact that parallel lines have the same gradient.

Gradients and y = mx + c in the exam

The gradient of a straight line tells you how steep it is. The equation y=mx+c tells you the gradient of a line and where it crosses the y-axis, so you can read facts about a line straight from its equation.

In the exam you are usually asked to write down the gradient of a line such as y=2x+5, or the point where it crosses the y-axis, for 1 mark each. Questions worth 2 or 3 marks ask you to work out a gradient from a graph or from two points, or to find an equation for a line drawn on a grid.

Other questions ask about parallel lines, or give you the gradient and ask for a missing coordinate. These come near the end of a paper, and the examiners say some students don't attempt them at all. The steps on this page can win you those marks.

What the gradient means

The gradient is how far a line goes up for every 1 it goes across. A line with gradient 3 goes up 3 for every 1 across. A line with gradient \frac{1}{2} goes up 1 for every 2 across, so it is less steep.

To work out a gradient, pick two points on the line and use

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

The change in y is how far up or down you go. The change in x is how far across you go, from left to right.

A line that goes up from left to right has a positive gradient. A line that goes down from left to right has a negative gradient. A flat line has a gradient of 0, and its equation is y= a number, such as y=-2

On a graph, choose two points where the line goes exactly through a corner of a grid square. Draw a right-angled triangle from one point to the other, then count the squares across and up. Check the scale on each axis first: one square does not always mean 1.

Worked example 1: Gradient from a graph

The diagram shows a straight line. Work out the gradient of the line.

  1. The line goes exactly through (0,-2) and (2,4). Draw a triangle from one point to the other.
  2. From (0,-2) to (2,4) the line goes 2 squares across, so the change in x is 2
  3. Your turn. How far up does the line go, from (0,-2) to (2,4)?

    From -2 up to 4 is 6 squares, so the change in y is 6

  4. \text{gradient}=\frac{6}{2}=3
  5. Answer: the gradient is 3

Gradient from two points

You don't need a graph when you know two points on the line. Subtract the y-coordinates to find the change in y. Subtract the x-coordinates, in the same order, to find the change in x. Then divide.

For (1,3) and (4,9): the change in y is 9-3=6 and the change in x is 4-1=3, so the gradient is 6\div3=2

Keep the same order on the top and the bottom. If the change in y is negative, the gradient is negative and the line goes down. Put a negative coordinate in a bracket: 3-(-1)=3+1=4

The rule also works backwards, to find a missing coordinate. If you know the gradient and the change in x, then

\text{change in }y=\text{gradient}\times\text{change in }x

A gradient of 2 with a change in x of 5 gives a change in y of 2\times5=10. If the missing number is an x-coordinate, divide instead: \text{change in }x=\text{change in }y\div\text{gradient}

Worked example 2: Gradient from two points

A is the point (-1,6) and B is the point (3,-2). Work out the gradient of the line AB.

  1. Go from A to B. The change in x is 3-(-1)=3+1=4
  2. Your turn. Work out the change in y, from A to B.

    -2-6=-8

  3. \text{gradient}=\frac{-8}{4}=-2
  4. Check: y goes down from 6 to -2 as x goes up, so a negative gradient makes sense.
  5. Answer: the gradient of AB is -2

Worked example 3: Finding a missing coordinate

C is the point (2,7) and D is the point (5,t). The gradient of the line CD is -3. Work out the value of t.

  1. The change in x from C to D is 5-2=3
  2. Your turn. \text{change in }y=\text{gradient}\times\text{change in }x. What is the change in y from C to D?

    -3\times3=-9, so the change in y is -9

  3. The gradient is negative, so y goes down by 9 from C to D: t=7-9=-2
  4. Check: \frac{-2-7}{5-2}=\frac{-9}{3}=-3
  5. Answer: t=-2

The equation y = mx + c

The equation of a straight line can usually be written as

y=mx+c

where m is the gradient and c is the intercept: the value of y where the line crosses the y-axis.

For y=4x+1, the gradient is 4 and the line crosses the y-axis at (0,1). A point on the y-axis always has x-coordinate 0, so the line crosses at (0,c)

Move the c slider and the whole line slides up or down, keeping the same steepness, with P always at (0,c). Move the m slider and the line turns about P. A bigger positive m makes it steeper, a negative m makes it go down from left to right, and m=0 makes it flat.

Under the graph, the rise from P to Q is divided by the run of 2. Whatever you choose, this gradient always comes out as m. The graph writes 1.5 as the fraction \frac{3}{2}, which is the same number.

The x term doesn't have to come first. In y=5-2x the number in front of x is -2, so the gradient is -2 and the intercept is 5. Take the sign in front of the x term with it.

Parallel lines and rearranging

Parallel lines go in the same direction and never meet. Parallel lines have the same gradient. So y=3x+1, y=3x-4 and y=3x are all parallel: each has gradient 3, with a different intercept.

To read m and c, the equation must start y=, with y on its own. If it starts 2y=, divide every term by 2 first. Dividing 2y=6x+4 by 2 gives y=3x+2, so the gradient is 3, not 6.

If the x term is on the same side as y, move it first. Subtracting 2x from both sides of y+2x=7 gives y=7-2x, so the gradient is -2.

Worked example 4: Checking whether lines are parallel

Line L has equation y=5-3x. Line M has equation 2y=8-6x. Show that lines L and M are parallel.

  1. Read each gradient from an equation that starts y=. The equation of L already does.
  2. Your turn. What is the gradient of line L?

    The number in front of x is -3, so the gradient of L is -3

  3. The equation of M starts 2y, so divide every term by 2: y=4-3x. The gradient of M is also -3
  4. The intercepts are 5 and 4, so these are two different lines with the same gradient.
  5. Answer: both lines have gradient -3, so L and M are parallel.

Writing the equation of a line

  • Intercept: find where the line crosses the y-axis. That value of y is c.
  • Gradient: pick two points on the line and work out \text{change in }y\div\text{change in }x. That is m.
  • Equation: put both numbers into y=mx+c.

Your answer must be an equation that starts y=, such as y=2x-3. Coordinates such as (0,-3) are not an equation, so they score nothing. Writing the line's name in place of y, such as L=2x-3, loses the final mark.

Worked example 5: Finding an equation from a graph

The diagram shows a straight line. Find an equation for the line. Give your answer in the form y=mx+c

  1. The line crosses the y-axis at (0,1), so c=1
  2. The line also goes exactly through (4,-1). From (0,1) to (4,-1) the change in x is 4
  3. Your turn. What is the change in y, from (0,1) to (4,-1)?

    The line goes down 2, so the change in y is -2

  4. m=\frac{-2}{4}=-\frac{1}{2}. The line goes down from left to right, so the gradient must be negative.
  5. Answer: y=-\frac{1}{2}x+1

Worked example 6: A line parallel to another line

Line L passes through the points (-2,7) and (1,-2). Line M is parallel to line L. Line M crosses the y-axis at the point (0,-1). Find an equation for line M.

  1. Parallel lines have the same gradient, so first work out the gradient of L. From (-2,7) to (1,-2) the change in x is 1-(-2)=1+2=3
  2. Your turn. Work out the gradient of line L.

    The change in y is -2-7=-9, so the gradient of L is \frac{-9}{3}=-3

  3. Check: y goes down from 7 to -2 as x goes up, so a negative gradient makes sense.
  4. Line M is parallel to line L, so line M also has gradient -3. That is m.
  5. Your turn. Line M crosses the y-axis at (0,-1). Write down an equation for line M.

    Type powers with ^ and fractions with /, for example x^2 or (x+1)/3

    The intercept is -1, so c=-1 and line M is y=-3x-1

  6. Answer: y=-3x-1

Common mistakes

  • Giving coordinates instead of an equation. An equation of a line starts y=, such as y=-2x+3.
  • Missing the minus sign. A line that goes down from left to right has a negative gradient.
  • Reading the wrong number from the equation. In y=3-4x the gradient is -4, the number in front of x.
  • Not getting y on its own first. For 2y=6x+4, divide every term by 2, so the gradient is 3.
  • Stopping after drawing the triangle. Count the change in y and the change in x, then divide.
  • Counting squares without checking the scale. If one square is 2 on an axis, double the number of squares.

Practice questions