GCSE Maths · Foundation & Higher

Straight Line Graphs

A complete guide to $y = mx + c$, gradients, and finding the equation of a line — with step-by-step methods, worked examples and practice questions.

Ages 15–16
6 Worked Examples
10 Practice Questions
Full Solutions

The Equation $y = mx + c$

Every straight line on a coordinate grid can be described by the equation $y = mx + c$. This is the most important formula in this topic, and once you understand what $m$ and $c$ mean, you can read almost everything about a line directly from its equation.

The Straight Line Equation
$y = mx + c$
$m$ = gradient (steepness & direction)
$c$ = $y$-intercept (where line crosses $y$-axis)
$x$, $y$ = coordinates of any point on the line
📌 Reading off $m$ and $c$
From $y = 3x + 5$:
• Gradient $m = 3$ (line goes up $3$ for every $1$ across)
• $y$-intercept $c = 5$ (crosses $y$-axis at $(0, 5)$)
📌 Another example
From $y = -2x + 1$:
• Gradient $m = -2$ (line slopes downward)
• $y$-intercept $c = 1$ (crosses $y$-axis at $(0, 1)$)
⚠ Equations not in standard form
Sometimes equations are given in a different form, like $2y = 4x + 6$ or $3x + y = 7$. Always rearrange to $y = mx + c$ first by making $y$ the subject:

$2y = 4x + 6 \;\Rightarrow\; y = 2x + 3$   (divide everything by 2)
$3x + y = 7 \;\Rightarrow\; y = -3x + 7$   (subtract $3x$ from both sides)

Gradient

The gradient tells you how steep a line is and which direction it slopes. It is defined as how much the line goes up (or down) for every one unit it moves across.

Gradient Formula
$$m = \frac{\text{rise}}{\text{run}} = \frac{y_2 - y_1}{x_2 - x_1}$$
where $(x_1, y_1)$ and $(x_2, y_2)$ are any two points on the line

What does the gradient tell you?

Positive gradient
$m > 0$
Slopes upward (left to right)
Negative gradient
$m < 0$
Slopes downward
Zero gradient
$m = 0$
Horizontal line
Steep gradient
$|m|$ large
Very steep

Calculating the gradient from two points

Always subtract in the same order: $(x_2 - x_1)$ on the bottom and $(y_2 - y_1)$ on the top. It doesn't matter which point you call "1" and which you call "2", as long as you're consistent.

🔑 Step by step: gradient from two points
Given points $(1, 3)$ and $(5, 11)$:
Label: $x_1 = 1,\; y_1 = 3,\; x_2 = 5,\; y_2 = 11$
Apply formula: $m = \dfrac{y_2 - y_1}{x_2 - x_1} = \dfrac{11 - 3}{5 - 1} = \dfrac{8}{4} = 2$
⚠ Don't mix up the order!
$\dfrac{y_2 - y_1}{x_2 - x_1}$ is correct.   $\dfrac{y_2 - y_1}{x_1 - x_2}$ is wrong (gives the wrong sign). Make sure $x$ and $y$ are subtracted in the same order — both "2 minus 1" or both "1 minus 2".

Reading gradient from a graph

Pick two points on the line where it crosses grid intersections (so you can read off exact values). Draw a right-angled triangle and count the squares:

  • Rise = vertical distance (count squares up or down)
  • Run = horizontal distance (count squares across)
  • $m = \dfrac{\text{rise}}{\text{run}}$ — remember to make it negative if the line goes downward left-to-right.
run=1 rise=2 m=2 x y 0 1 2 3 1 2 3

The right-angle triangle shows rise = 2, run = 1, so $m = \frac{2}{1} = 2$.

The $y$-intercept

The $y$-intercept is the value of $c$ in $y = mx + c$. It is the point where the line crosses the $y$-axis. At this point, $x = 0$, so you can always find it by substituting $x = 0$ into the equation.

🔑 Finding the $y$-intercept
Given $y = 4x - 3$:
Set $x = 0$: $y = 4(0) - 3 = -3$
$y$-intercept is $(0, -3)$.
🔑 The $x$-intercept too
The $x$-intercept is where the line crosses the $x$-axis. At that point $y = 0$:
$0 = 4x - 3 \Rightarrow x = \tfrac{3}{4}$
$x$-intercept is $\!\left(\tfrac{3}{4}, 0\right)$.

A quick way to sketch any line is to find these two intercepts and join them with a straight line. This is especially useful when $m$ is a fraction.

Plotting a Straight Line Graph

There are two main methods for plotting a line from its equation.

Method 1: Table of values

Choose 3 or more values of $x$ (e.g. $-2,\; 0,\; 2$).
Substitute each into the equation to find the corresponding $y$ value.
Write the $(x, y)$ pairs in a table, plot each point, and draw a straight line through them.
Always extend the line slightly beyond your plotted points and label it with its equation.
Example: plot $y = 2x + 1$
$x$$-2$$0$$2$
$y = 2x+1$$2(-2)+1=-3$$2(0)+1=1$$2(2)+1=5$
Plot $(-2,-3)$, $(0,1)$, $(2,5)$ and draw a straight line through them.

Method 2: Gradient and $y$-intercept

Mark the $y$-intercept — plot the point $(0, c)$ on the $y$-axis.
Use the gradient to find the next point: from $(0,c)$, go across 1 and up $m$ (or down if $m$ is negative). Plot this new point.
Draw a straight line through your two points. Extend and label it.
💡 Tip: fractional gradients
If $m = \dfrac{3}{4}$, go across 4 and up 3 to find your next point — this avoids fractions and keeps everything on grid points.
Worked Example 1 Plotting a line using the gradient and intercept
Draw the graph of $y = \dfrac{1}{2}x - 2$ for $-4 \leq x \leq 6$.
Intercept
$c = -2$, so the line crosses the $y$-axis at $(0, -2)$. Plot this point.
Gradient
$m = \dfrac{1}{2}$. From $(0,-2)$, go right 2 and up 1 to reach $(2, -1)$. Plot this point. Repeat to get $(4, 0)$.
Check
Verify with a table: $x=-4 \Rightarrow y=\frac{1}{2}(-4)-2=-4$ and $x=6 \Rightarrow y=\frac{1}{2}(6)-2=1$. Plot $(-4,-4)$ and $(6,1)$.
Draw
Draw a straight line through all plotted points and label it $y = \frac{1}{2}x - 2$.
Key points to plot
$(-4,\,-4)$, $(0,\,-2)$, $(2,\,-1)$, $(4,\,0)$, $(6,\,1)$ — all lie on a straight line.

Finding the Equation of a Line

From a graph

Read off the $y$-intercept. This is where the line crosses the $y$-axis — this gives you $c$.
Find the gradient. Choose two clear grid-crossing points, draw a right-angle triangle, and calculate $m = \dfrac{\text{rise}}{\text{run}}$. Make it negative if the line slopes downward.
Write the equation as $y = mx + c$.
Worked Example 2 Finding the equation from a graph
A straight line passes through $(0, 3)$ and $(4, 1)$. Find its equation.
$c$
The line crosses the $y$-axis at $(0, 3)$, so $c = 3$.
$m$
Using $(x_1,y_1)=(0,3)$ and $(x_2,y_2)=(4,1)$: $$m = \frac{1-3}{4-0} = \frac{-2}{4} = -\frac{1}{2}$$
Equation
$y = -\dfrac{1}{2}x + 3$
Answer
$y = -\dfrac{1}{2}x + 3$

From two points (neither on the $y$-axis)

When neither point is the $y$-intercept, calculate the gradient first, then use one of the points to find $c$.

📐 Method: find $c$ by substituting a known point
Once you have $m$, substitute one of the given points $(x_1, y_1)$ into $y = mx + c$ and solve for $c$: $$c = y_1 - m x_1$$
Worked Example 3 Finding the equation given two points
Find the equation of the line passing through $(2, 5)$ and $(6, 13)$.
Gradient
$$m = \frac{13 - 5}{6 - 2} = \frac{8}{4} = 2$$
Find $c$
Substitute $(2, 5)$ and $m = 2$ into $y = mx + c$:
$5 = 2(2) + c \;\Rightarrow\; 5 = 4 + c \;\Rightarrow\; c = 1$
Check
Check with the other point $(6, 13)$: $y = 2(6)+1 = 13$ ✓
Answer
$y = 2x + 1$

Given the gradient and one point

If you are told the gradient $m$ and one point $(x_1, y_1)$ on the line, you can use the point-gradient form:

📐 Point-gradient form
$$y - y_1 = m(x - x_1)$$ Expand and rearrange to get $y = mx + c$.
Worked Example 4 Using gradient and one point
Find the equation of the line with gradient $3$ passing through $(1, -2)$.
Substitute
$m = 3$, $(x_1, y_1) = (1, -2)$.
$y - (-2) = 3(x - 1)$
$y + 2 = 3x - 3$
Rearrange
$y = 3x - 3 - 2 = 3x - 5$
Check
Substitute $(1, -2)$: $y = 3(1) - 5 = -2$ ✓
Answer
$y = 3x - 5$

Parallel and Perpendicular Lines

Parallel lines

Two lines are parallel if they never meet — they go in exactly the same direction. Parallel lines have equal gradients.

🔑 Parallel lines rule
If line 1 has equation $y = m_1 x + c_1$ and line 2 has equation $y = m_2 x + c_2$, then:
Lines are parallel $\;\Longleftrightarrow\; m_1 = m_2$ (and $c_1 \neq c_2$)
📌 Example
$y = 4x + 7$ and $y = 4x - 3$ are parallel (both have gradient $4$, different intercepts).
$y = 4x + 7$ and $y = 2x + 7$ are not parallel (different gradients).

Perpendicular lines

Two lines are perpendicular if they meet at a right angle (90°). Their gradients multiply to give $-1$.

🔑 Perpendicular lines rule
$$m_1 \times m_2 = -1 \quad\Longleftrightarrow\quad m_2 = -\frac{1}{m_1}$$ To find the perpendicular gradient: flip the fraction and change the sign.
📌 Perpendicular gradient examples
If $m = 2$, perpendicular gradient $= -\dfrac{1}{2}$
If $m = -3$, perpendicular gradient $= +\dfrac{1}{3}$
If $m = \dfrac{3}{4}$, perpendicular gradient $= -\dfrac{4}{3}$
⚠ Check: horizontal & vertical
A horizontal line ($m = 0$) is perpendicular to a vertical line ($x = k$, undefined gradient) — this is the one exception to the $m_1 \times m_2 = -1$ rule.
Worked Example 5 Finding a perpendicular line
Find the equation of the line perpendicular to $y = 3x - 1$ that passes through $(6, 2)$.
Gradient
Gradient of $y = 3x - 1$ is $m_1 = 3$.
Perpendicular gradient: $m_2 = -\dfrac{1}{3}$
Equation
Use point-gradient form with $(6, 2)$ and $m = -\dfrac{1}{3}$:
$y - 2 = -\dfrac{1}{3}(x - 6)$
$y - 2 = -\dfrac{1}{3}x + 2$
$y = -\dfrac{1}{3}x + 4$
Check
At $x=6$: $y = -2 + 4 = 2$ ✓   Also: $3 \times \left(-\dfrac{1}{3}\right) = -1$ ✓
Answer
$y = -\dfrac{1}{3}x + 4$

Special Lines & Extra Skills

Horizontal and vertical lines

Horizontal lines: $y = k$
The equation $y = k$ (where $k$ is a constant) describes a horizontal line at height $k$. Gradient $= 0$.   Example: $y = -3$ is a horizontal line crossing the $y$-axis at $-3$.
Vertical lines: $x = k$
The equation $x = k$ (where $k$ is a constant) describes a vertical line at position $k$. Gradient is undefined (infinite).   Example: $x = 4$ is a vertical line crossing the $x$-axis at $4$. Note: vertical lines cannot be written in $y = mx + c$ form.

Midpoint of a line segment

The midpoint of the segment joining $(x_1, y_1)$ and $(x_2, y_2)$ is:

📐 Midpoint formula
$$\text{Midpoint} = \left(\frac{x_1 + x_2}{2},\; \frac{y_1 + y_2}{2}\right)$$ Simply average the $x$-values and average the $y$-values.
📌 Example
Midpoint of $(2, 1)$ and $(8, 5)$: $$\left(\frac{2+8}{2},\; \frac{1+5}{2}\right) = (5,\; 3)$$

Checking whether a point lies on a line

To check if point $(a, b)$ lies on the line $y = mx + c$, substitute $x = a$ and check if the result equals $b$.

📌 Example: does $(3, 7)$ lie on $y = 2x + 1$?
Substitute $x = 3$: $y = 2(3) + 1 = 7$.   Since $y = 7$ matches, yes — $(3, 7)$ is on the line. ✓
Worked Example 6 Mixed skills — midpoint, gradient, and equation
Points $A = (-2, 1)$ and $B = (4, 9)$. Find: (a) the gradient of $AB$, (b) the midpoint $M$ of $AB$, (c) the equation of $AB$.
Part (a)
$$m = \frac{9-1}{4-(-2)} = \frac{8}{6} = \frac{4}{3}$$
Part (b)
$$M = \left(\frac{-2+4}{2},\; \frac{1+9}{2}\right) = \left(1,\; 5\right)$$
Part (c)
Use $m = \dfrac{4}{3}$ and point $A(-2, 1)$:
$y - 1 = \dfrac{4}{3}(x - (-2)) = \dfrac{4}{3}(x + 2)$
$y - 1 = \dfrac{4}{3}x + \dfrac{8}{3}$
$y = \dfrac{4}{3}x + \dfrac{8}{3} + 1 = \dfrac{4}{3}x + \dfrac{11}{3}$
Check
At $x=4$: $y = \dfrac{16}{3} + \dfrac{11}{3} = \dfrac{27}{3} = 9$ ✓
Answers
(a) $m = \dfrac{4}{3}$   (b) $M = (1, 5)$   (c) $y = \dfrac{4}{3}x + \dfrac{11}{3}$

Quick Reference Summary

SkillFormula / RuleNotes
Gradient from two points $m = \dfrac{y_2 - y_1}{x_2 - x_1}$ Subtract in the same order top and bottom
$y$-intercept Set $x = 0$ in the equation Gives the point $(0, c)$
$x$-intercept Set $y = 0$ in the equation and solve Gives the point $(k, 0)$
Equation from graph Read $c$, then calculate $m = \frac{\text{rise}}{\text{run}}$ Use clearly visible grid points
Equation from gradient + point $y - y_1 = m(x - x_1)$ Rearrange to $y = mx + c$
Parallel lines Equal gradients: $m_1 = m_2$ Different $y$-intercepts
Perpendicular lines $m_1 \times m_2 = -1$, so $m_2 = -\dfrac{1}{m_1}$ Flip and negate the gradient
Midpoint $\left(\dfrac{x_1+x_2}{2},\; \dfrac{y_1+y_2}{2}\right)$ Average the coordinates
Horizontal line $y = k$, gradient $= 0$ All points have the same $y$-value
Vertical line $x = k$, gradient undefined Cannot be written as $y = mx + c$
⚠ Watch-outs to remember
  • Rearrange to $y = mx + c$ before reading off $m$ and $c$.
  • Negative gradient → line slopes downward from left to right.
  • Perpendicular means flip and negate the gradient — not just negate.
  • The gradient is the same everywhere on a straight line — it doesn't change.

Practice Questions

Try each question before clicking "Show worked solution".

Question 1
Write down the gradient and $y$-intercept of each line:
(a) $y = 5x - 3$    (b) $y = -2x + 7$    (c) $y = \dfrac{3}{4}x$    (d) $2y = 8x + 6$
[4 marks]
(a)
$y = 5x - 3$: gradient $m = 5$, $y$-intercept $c = -3$, point $(0,-3)$.
(b)
$y = -2x + 7$: gradient $m = -2$, $y$-intercept $c = 7$, point $(0,7)$.
(c)
$y = \frac{3}{4}x = \frac{3}{4}x + 0$: gradient $m = \frac{3}{4}$, $y$-intercept $c = 0$, point $(0,0)$.
(d)
Divide both sides by 2: $y = 4x + 3$. Gradient $m = 4$, $y$-intercept $c = 3$, point $(0,3)$.
Answers
(a) $m=5$, $(0,-3)$   (b) $m=-2$, $(0,7)$   (c) $m=\frac{3}{4}$, $(0,0)$   (d) $m=4$, $(0,3)$
Question 2
Calculate the gradient of the line segment joining each pair of points:
(a) $(1, 4)$ and $(5, 12)$    (b) $(0, 6)$ and $(3, 0)$    (c) $(-2, -1)$ and $(4, 2)$
[3 marks]
(a)
$m = \dfrac{12-4}{5-1} = \dfrac{8}{4} = 2$
(b)
$m = \dfrac{0-6}{3-0} = \dfrac{-6}{3} = -2$
(c)
$m = \dfrac{2-(-1)}{4-(-2)} = \dfrac{3}{6} = \dfrac{1}{2}$
Answers
(a) $m=2$   (b) $m=-2$   (c) $m=\dfrac{1}{2}$
Question 3
Complete a table of values and draw the graph of $y = 3x - 2$ for $x = -2, -1, 0, 1, 2$.
[3 marks]
Table
Substitute each $x$ into $y = 3x - 2$:
$x=-2$: $y=3(-2)-2=-8$   $x=-1$: $y=-5$   $x=0$: $y=-2$   $x=1$: $y=1$   $x=2$: $y=4$
Draw
Plot $(-2,-8)$, $(-1,-5)$, $(0,-2)$, $(1,1)$, $(2,4)$ and draw a straight line through them. Label it $y=3x-2$.
Key values
$x$$-2$$-1$$0$$1$$2$
$y$$-8$$-5$$-2$$1$$4$
The gradient is $3$ (steep, upward) and the line crosses the $y$-axis at $(0,-2)$.
Question 4
A straight line has the equation $y = -\dfrac{1}{3}x + 4$. Find the coordinates of the points where it crosses the $x$-axis and the $y$-axis.
[3 marks]
$y$-intercept
Set $x=0$: $y = -\frac{1}{3}(0)+4 = 4$. Crosses $y$-axis at $(0, 4)$.
$x$-intercept
Set $y=0$: $0 = -\frac{1}{3}x+4 \Rightarrow \frac{1}{3}x=4 \Rightarrow x=12$. Crosses $x$-axis at $(12, 0)$.
Answer
Crosses the $y$-axis at $(0, 4)$ and the $x$-axis at $(12, 0)$.
Question 5
Find the equation of the straight line that passes through $(0, -1)$ and $(4, 7)$.
[3 marks]
$c$
The line passes through $(0,-1)$, which is on the $y$-axis. So $c = -1$.
$m$
$m = \dfrac{7-(-1)}{4-0} = \dfrac{8}{4} = 2$
Equation
$y = 2x - 1$
Answer
$y = 2x - 1$
Question 6
Find the equation of the line passing through $(3, 4)$ and $(7, 12)$.
Hint: neither point is on the $y$-axis, so find $m$ first, then substitute to get $c$.
[3 marks]
Gradient
$m = \dfrac{12-4}{7-3} = \dfrac{8}{4} = 2$
Find $c$
Substitute $(3, 4)$ into $y = 2x + c$:
$4 = 2(3) + c = 6 + c \;\Rightarrow\; c = -2$
Check
At $(7,12)$: $y = 2(7) - 2 = 12$ ✓
Answer
$y = 2x - 2$
Question 7
Line $L_1$ has equation $y = 4x - 5$.
(a) Write down the equation of a line parallel to $L_1$ that crosses the $y$-axis at $(0, 3)$.
(b) Does the point $(2, 3)$ lie on $L_1$? Show your working.
[3 marks]
(a)
Parallel lines have the same gradient. Gradient of $L_1 = 4$. New $y$-intercept $= 3$. Equation: $y = 4x + 3$.
(b)
Substitute $(2,3)$ into $y = 4x - 5$: $y = 4(2)-5 = 3$. This gives $y=3$, which matches. Yes, $(2,3)$ lies on $L_1$. ✓
Answers
(a) $y = 4x + 3$   (b) Yes — substituting $x=2$ gives $y=3$.
Question 8
Find the equation of the line perpendicular to $y = 2x + 5$ that passes through the point $(4, 1)$.
[4 marks]
Gradient
Gradient of $y = 2x+5$ is $2$. Perpendicular gradient $= -\dfrac{1}{2}$.
Equation
Using point-gradient form with $(4,1)$ and $m=-\frac{1}{2}$:
$y - 1 = -\frac{1}{2}(x-4)$
$y - 1 = -\frac{1}{2}x + 2$
$y = -\frac{1}{2}x + 3$
Check
At $x=4$: $y = -2+3=1$ ✓   Also: $2 \times (-\frac{1}{2}) = -1$ ✓
Answer
$y = -\dfrac{1}{2}x + 3$
Question 9
Points $P = (1, -3)$ and $Q = (7, 9)$.
(a) Find the midpoint $M$ of $PQ$.
(b) Find the gradient of $PQ$.
(c) Find the equation of the perpendicular bisector of $PQ$ (the line perpendicular to $PQ$ passing through $M$).
[5 marks]
(a) Midpoint
$M = \left(\dfrac{1+7}{2},\; \dfrac{-3+9}{2}\right) = (4,\; 3)$
(b) Gradient
$m_{PQ} = \dfrac{9-(-3)}{7-1} = \dfrac{12}{6} = 2$
(c) Perp. grad.
Perpendicular gradient $= -\dfrac{1}{2}$
(c) Equation
Line through $M(4,3)$ with $m=-\frac{1}{2}$:
$y - 3 = -\frac{1}{2}(x-4) = -\frac{1}{2}x + 2$
$y = -\frac{1}{2}x + 5$
Answers
(a) $M = (4, 3)$   (b) $m=2$   (c) $y = -\dfrac{1}{2}x + 5$
Question 10
Line $L_1$: $3x + y = 9$.   Line $L_2$ passes through $(-1, 5)$ and is parallel to $L_1$.
(a) Rearrange $L_1$ into the form $y = mx + c$.
(b) Find the equation of $L_2$.
(c) Find the coordinates where $L_2$ crosses the $x$-axis.
[5 marks]
(a)
$3x + y = 9 \;\Rightarrow\; y = -3x + 9$. So $m = -3$, $c = 9$.
(b) Gradient
$L_2$ is parallel to $L_1$, so it also has gradient $m = -3$.
(b) Equation
Through $(-1, 5)$ with $m=-3$:
$y - 5 = -3(x-(-1)) = -3(x+1) = -3x - 3$
$y = -3x - 3 + 5 = -3x + 2$
(c)
Set $y=0$ in $L_2$: $0 = -3x + 2 \;\Rightarrow\; 3x = 2 \;\Rightarrow\; x = \dfrac{2}{3}$.
Answers
(a) $y = -3x + 9$   (b) $y = -3x + 2$   (c) $\left(\dfrac{2}{3},\; 0\right)$