Understand the equation of a straight line — gradient, y-intercept, plotting, and finding a line's equation
Explanation & Worked Examples
The Equation of a Straight Line
Every straight-line graph can be written in the form:
y = mx + c
This single equation tells you everything about the line:
m = the gradient (slope)
How steep the line is, and which way it tilts. A bigger m is steeper; a negative m slopes downhill.
c = the y-intercept
Where the line crosses the y-axis — the value of y when x = 0.
For example, in y = 2x + 3: the gradient is 2 and the line crosses the y-axis at (0, 3).
Watch the sign: in y = 4x − 5 the intercept is −5, not 5. The number is taken with its sign.
Finding the Gradient & Intercept
Gradient from two points
If a line passes through two points (x₁, y₁) and (x₂, y₂), the gradient is the change in y divided by the change in x:
m = (y₂ − y₁) ÷ (x₂ − x₁) = rise ÷ run
Finding c once you know m
Substitute the gradient and any known point into y = mx + c and solve for c.
Line with gradient 2 through (1, 5): 5 = 2(1) + c → c = 3 → y = 2x + 3
The axis crossings
y-intercept: set x = 0 → y = c
x-intercept: set y = 0 → solve 0 = mx + c for x
Parallel & perpendicular
Parallel lines have the same gradient m.
Perpendicular lines have gradients that multiply to −1, i.e. the gradient is the negative reciprocal (if one is m, the other is −1/m).
Rearranging: if an equation isn't in y = mx + c form (e.g. 2y = 4x + 6), make y the subject first (divide by 2 → y = 2x + 3) before reading off m and c.
Easy Examples
Read the gradient and intercept straight off the equation, or substitute a value.
Example 1 — Read off m and c
For the line y = 3x + 2, state the gradient and the y-intercept.
1Compare with y = mx + c
2Gradient m = 3, y-intercept c = 2 (crosses at (0, 2))
Example 2 — Negative Intercept
For y = 5x − 4, where does the line cross the y-axis?
1The intercept is the constant term, taken with its sign: c = −4
2It crosses the y-axis at (0, −4)
Example 3 — Find a y value
For y = 2x + 1, find y when x = 3.
1Substitute x = 3: y = 2(3) + 1
2y = 6 + 1 = 7
Medium Examples
Find the gradient from two points, find c, or locate where a line crosses an axis.
Example 1 — Gradient from Two Points
Find the gradient of the line through (1, 2) and (3, 8).
1m = (y₂ − y₁) ÷ (x₂ − x₁) = (8 − 2) ÷ (3 − 1)
2m = 6 ÷ 2 = 3
Example 2 — Find c from a Point
A line has gradient 2 and passes through (1, 5). Find its equation.
1Use y = mx + c with m = 2: 5 = 2(1) + c
25 = 2 + c → c = 3
3Equation: y = 2x + 3
Example 3 — Where it Crosses the x-axis
Where does y = 2x − 6 cross the x-axis?
1On the x-axis, y = 0: 0 = 2x − 6
22x = 6 → x = 3, so it crosses at (3, 0)
Rearrange first: for something like 2y = 4x + 6, divide every term by 2 to get y = 2x + 3 before reading off m = 2 and c = 3.
Complex Examples
Parallel and perpendicular lines, the full equation from two points, and where two lines meet.
Example 1 — Parallel Line
Find the equation of the line parallel to y = 3x + 1 that passes through (0, 4).
1Parallel → same gradient, so m = 3
2It passes through (0, 4), so c = 4
3Equation: y = 3x + 4
Example 2 — Perpendicular Gradient
What is the gradient of a line perpendicular to y = 2x + 1?
1Perpendicular gradient = negative reciprocal of 2
2= −1/2 (check: 2 × −1/2 = −1 ✓)
Example 3 — Equation from Two Points
Find the equation of the line through (1, 2) and (3, 8).
1Gradient: m = (8 − 2) ÷ (3 − 1) = 3
2Use a point in y = 3x + c: 2 = 3(1) + c → c = −1
3Equation: y = 3x − 1
Example 4 — Where Two Lines Meet
At what point do y = x + 1 and y = 2x − 1 intersect?
1At the intersection both y values are equal: x + 1 = 2x − 1
21 + 1 = 2x − x → x = 2
3Substitute back: y = 2 + 1 = 3 → they meet at (2, 3)
Remember: parallel lines share a gradient and never meet; perpendicular gradients multiply to −1. A horizontal line has gradient 0 (y = c); a vertical line (x = a) has an undefined gradient and cannot be written as y = mx + c.