Straight line graphs, explained with examples
Every straight line can be written as y = mx + c, where m is the gradient and c is where the line crosses the y-axis. Once you can read and use those two numbers, a whole family of GCSE questions becomes straightforward.
On this page
Gradient: how steep a line is
The gradient measures steepness: how much y changes for each 1 unit increase in x.
gradient = change in y / change in x = (y2 − y1) / (x2 − x1), often remembered as “rise over run”.
- A positive gradient slopes upwards from left to right.
- A negative gradient slopes downwards.
- A horizontal line has gradient 0; its equation is y = a number.
- A vertical line has an undefined gradient; its equation is x = a number.
y = mx + c
In y = mx + c, m is the gradient and c is the y-intercept, the value of y where the line crosses the y-axis (when x = 0). For y = 3x − 2, the gradient is 3 and the line crosses the y-axis at (0, −2). If an equation is not in this form, rearrange it to make y the subject before reading off m and c.
Worked examples
Example 1: gradient from two points
Find the gradient of the line through (1, 3) and (4, 12).
- Change in y = 12 − 3 = 9. Change in x = 4 − 1 = 3.
- Gradient = 9/3 = 3.
Example 2: a negative gradient
Find the gradient of the line through (−2, 5) and (2, −3).
- (−3 − 5)/(2 − (−2)) = −8/4.
- Gradient = −2. Keep the points in the same order on top and bottom.
Example 3: reading m and c
Find the gradient and y-intercept of 2y + 4x = 10.
- Rearrange: 2y = −4x + 10, so y = −2x + 5.
- Gradient −2, y-intercept 5.
Example 4: equation from a point and gradient
Find the equation of the line with gradient 4 through (2, 7).
- y = 4x + c. Substitute (2, 7): 7 = 8 + c, so c = −1.
- y = 4x − 1.
Example 5: equation from two points
Find the equation of the line through (1, 5) and (3, 11).
- Gradient = (11 − 5)/(3 − 1) = 3.
- y = 3x + c; substitute (1, 5): 5 = 3 + c, so c = 2. y = 3x + 2. Check with (3, 11): 9 + 2 = 11.
Plotting a straight line
Make a table of values: choose three or more x-values, such as −2, 0 and 2, work out y for each, plot the points and join them with a ruler. If the points do not lie on a straight line, recheck your arithmetic; a line through only two points gives no check. Alternatively, plot the y-intercept and use the gradient to step along: for gradient 2, go 1 right and 2 up.
Parallel and perpendicular lines (Higher)
- Parallel lines have the same gradient. y = 2x + 1 and y = 2x − 7 are parallel.
- Perpendicular lines meet at right angles. Their gradients multiply to −1: if one gradient is m, the other is −1/m, the negative reciprocal. A gradient of 2 is perpendicular to −½; a gradient of −3/4 is perpendicular to 4/3.
Example 6: a parallel line
Find the equation of the line parallel to y = 5x − 2 that passes through (1, 9).
- Same gradient: y = 5x + c. 9 = 5 + c, so c = 4.
- y = 5x + 4.
Example 7: a perpendicular line
Find the equation of the line perpendicular to y = 2x + 3 that passes through (4, 1).
- Perpendicular gradient = −1/2. y = −½x + c; 1 = −2 + c, so c = 3.
- y = −½x + 3.
Midpoints and lengths
The midpoint of the segment joining (x1, y1) and (x2, y2) is the average of the coordinates: ((x1 + x2)/2, (y1 + y2)/2). Its length comes from Pythagoras: √((x2 − x1)² + (y2 − y1)²). For (2, 3) and (8, 11), the midpoint is (5, 7) and the length is √(36 + 64) = 10.
Where two lines meet
The point where two straight lines cross is the solution of their simultaneous equations. To find it, set the two expressions for y equal. For y = 2x + 1 and y = −x + 7: 2x + 1 = −x + 7, so 3x = 6 and x = 2, giving y = 5. The lines meet at (2, 5). Parallel lines have no intersection, which matches simultaneous equations with no solution.
Gradients in real life
On real-life graphs, the gradient is a rate of change, with units. On a distance-time graph, the gradient is speed. On a graph of cost against number of items, the gradient is the price per item and the y-intercept is a fixed charge. For example, a taxi fare graph with equation C = 1.5d + 3 means a £3 fixed charge plus £1.50 per mile. Interpreting m and c in context is a common exam question.
Common mistakes
- Dividing change in x by change in y instead of the other way round.
- Mixing the order of points, so the signs come out wrong.
- Reading m and c before rearranging into y = mx + c.
- Using the reciprocal without changing the sign for a perpendicular gradient.
- Confusing x = 3 (vertical) with y = 3 (horizontal).
Practice questions
Try each one before opening the answer.
Q1. Find the gradient through (0, 2) and (5, 17).
Show answer
Q2. Write the gradient and y-intercept of y = 7 − 4x.
Show answer
Q3. Find the equation of the line through (2, 1) and (6, 9).
Show answer
Q4. What is the gradient of a line perpendicular to y = −⅓x + 2?
Show answer
Q5. Find the midpoint of (−4, 6) and (2, −2).
Show answer
Frequently asked questions
Is y = mx + c on the Foundation paper?
Yes. Plotting lines, gradients and y = mx + c are on both tiers. Perpendicular lines are Higher tier.
How does this connect to A level?
A level Maths uses y − y1 = m(x − x1) to write equations quickly, and the same gradient rules for tangents, normals and coordinate geometry.
Key takeaways
- Gradient = change in y ÷ change in x.
- y = mx + c: m is the gradient, c is the y-intercept.
- Substitute a point to find c.
- Parallel lines share a gradient; perpendicular gradients multiply to −1.
- In context, the gradient is a rate of change with units.