Finding the Equation from a Graph
Every straight-line graph has a hidden equation. Learn to find it in two steps: read the y-intercept, calculate the gradient, then write $y = mx + c$.
Printable Worksheets
Print or save as PDF — or build a custom worksheet from any module's questions.
Look at the line on the graph below. Can you figure out its equation without being told? What two things do you need to find?
Finding the equation of a straight line from its graph always follows the same process:
- Find $c$: the line crosses the y-axis at $(0, 2)$, so $c = 2$.
- Calculate $m$: gradient triangle gives run $= 2$, rise $= 4$. $m = \frac{4}{2} = 2$.
- Substitute: $y = 2x + 2$.
- Verify with $(3, 8)$: $y = 2(3) + 2 = 8$. ✓ Answer: $y = 2x + 2$.
- Find $c$: crosses at $(0, 5)$, so $c = 5$.
- Calculate $m$: using $(0, 5)$ and $(4, 1)$: $m = \frac{1-5}{4-0} = \frac{-4}{4} = -1$.
- Substitute: $y = -x + 5$.
- Verify: $(4, 1)$: $y = -(4) + 5 = 1$. ✓
- Find $c$: the line passes through the origin $(0, 0)$, so $c = 0$.
- Calculate $m$: using $(0, 0)$ and $(3, 6)$: $m = \frac{6-0}{3-0} = 2$.
- Substitute: $y = 2x + 0$, so $y = 2x$.
- Verify: $(3, 6)$: $y = 2(3) = 6$. ✓
After finding an equation, always verify by substituting another point from the graph.
Four common straight-line graph types — learn to recognise them at a glance:
Type 1: $m > 0$, $c > 0$ — e.g. $y = 2x + 3$
Type 2: $m < 0$, $c > 0$ — e.g. $y = -x + 4$
Type 3: $m > 0$, $c = 0$ — e.g. $y = 3x$
Type 4: $m < 0$, $c < 0$ — e.g. $y = -2x - 1$
Race the clock! Find the equation for each set of information.
?
$y = 2x + 3$?
$y = 3x - 1$?
$y = -2x + 4$?
$m = 3$, $c = 0$, so $y = 3x$?
$c = -2$, $m = 2$, so $y = 2x - 2$?
$y = \frac{1}{2}x + 3$?
$c = 5$, $m = -2$, so $y = -2x + 5$?
$c = -3$, $m = 2$, so $y = 2x - 3$?
$c = 0$, so $y = -\frac{3}{2}x$?
$m = 3$; $4 = 3(1)+c$, $c = 1$, so $y = 3x + 1$Multiple Choice
Q1. A line crosses the y-axis at $(0, 3)$ and has gradient $2$. What is its equation?
Q2. From the graph below, what is the equation of the line?
Q3. A line passes through $(0, -1)$ and $(2, 3)$. What is its equation?
Q4. The equation of a line through the origin with gradient $-2$ is:
Q5. A line goes through $(0, 4)$ and $(3, 0)$. What is its equation?
Short Answer
SAQ 1. Find the equation of the line shown on the graph below. Show all steps.
Show answer
Step 1: Line crosses y-axis at $(0, 3)$, so $c = 3$.
Step 2: Gradient triangle: run $= 1$, rise $= 2$. $m = \frac{2}{1} = 2$.
Step 3: $y = 2x + 3$.
Verify: $(2, 7)$: $2(2)+3 = 7$. ✓
SAQ 2. A line has y-intercept $2$ and passes through $(4, 10)$. Find its equation step by step.
Show answer
Step 1: $c = 2$ (given).
Step 2: $m = \frac{10-2}{4-0} = \frac{8}{4} = 2$.
Step 3: $y = 2x + 2$.
Verify: $(4, 10)$: $2(4)+2 = 10$. ✓
SAQ 3. A line passes through $(2, 5)$ and $(4, 9)$. Find its equation. Hint: find $m$ first, then use a point to find $c$.
Show answer
Step 1: $m = \frac{9-5}{4-2} = \frac{4}{2} = 2$.
Step 2: Use $(2, 5)$ in $y = 2x + c$: $5 = 2(2) + c$, so $c = 1$.
Step 3: $y = 2x + 1$.
Verify: $(4, 9)$: $2(4)+1 = 9$. ✓
Stretch Challenges
Challenge 1 — Points not on y-axis
A line passes through $(1, 1)$ and $(5, -7)$. Find its equation.
Solution
$m = \frac{-7-1}{5-1} = \frac{-8}{4} = -2$.
Using $(1, 1)$: $1 = -2(1) + c \Rightarrow c = 3$.
$y = -2x + 3$. Verify: $(5, -7)$: $-2(5)+3 = -7$. ✓
Challenge 2 — Parallel lines
$y = 3x - 2$ and a second line parallel to it pass through $(0, 5)$. Find the second line's equation.
Solution
Parallel lines have the same gradient: $m = 3$.
Through $(0, 5)$ means $c = 5$.
Answer: $y = 3x + 5$.
- Find $c$: y-coordinate where the line crosses the y-axis.
- Find $m$: gradient triangle $\frac{\text{rise}}{\text{run}}$, or $\frac{y_2-y_1}{x_2-x_1}$.
- Write: substitute $m$ and $c$ into $y = mx + c$.
- Verify: substitute another point — if both sides match, your equation is correct.
- Uphill line $\Rightarrow$ $m > 0$. Downhill line $\Rightarrow$ $m < 0$. Through origin $\Rightarrow$ $c = 0$.
- Always simplify $m$ — e.g. $\frac{4}{2} = 2$, $\frac{-6}{3} = -2$.
Lesson Complete!
You can now find the equation of any straight line from its graph. Next: build on this to sketch and compare linear relationships.