Free access until 31 December 2026 · Physics and Maths questions and notes, updated continuously · Build a test

ExaminerPrep › Cambridge IGCSE Maths › Notes

Cambridge IGCSE Maths · Topic 3 · 3.2 · Core and Extended

Equation of a straight line, parallel and perpendicular lines

This note shows how to find the equation of a straight line from a gradient and a point, or from two points, and how to use gradients to decide whether two lines are parallel or perpendicular. These skills let you describe any straight-line relationship, from the slope of a ramp to a cost that rises steadily with time. Perpendicular gradients are used at Extended level.

Key ideas

Every straight line that is not vertical can be written in the form \(y = mx + c\). The number \(m\) is the gradient (how steeply the line rises) and \(c\) is the \(y\)-intercept (where the line crosses the \(y\)-axis).

  • A positive gradient means the line goes up from left to right. A negative gradient means it goes down. A horizontal line has gradient 0 and equation \(y = \text{number}\). A vertical line has no gradient and equation \(x = \text{number}\).
  • To find the gradient from two points, divide the change in \(y\) by the change in \(x\). Always subtract in the same order on the top and the bottom.
  • To find \(c\), substitute the coordinates of any point on the line into \(y = mx + c\) and solve.
  • If the equation is not already in the form \(y = mx + c\), rearrange it first. For example \(3x + 2y = 12\) becomes \(y = -\tfrac{3}{2}x + 6\), so the gradient is \(-\tfrac{3}{2}\) and the \(y\)-intercept is 6.

Parallel lines never meet, so they slope in exactly the same way. They have equal gradients.

Perpendicular lines meet at a right angle. If one line has gradient \(m\), a line perpendicular to it has gradient \(-\dfrac{1}{m}\). In other words, flip the fraction and change the sign. Multiplying the two gradients always gives \(-1\).

A useful second way to write a line through the point \((x_1, y_1)\) with gradient \(m\) is \(y - y_1 = m(x - x_1)\). It saves you finding \(c\) separately, but you can rearrange it to \(y = mx + c\) afterwards.

You also need the midpoint of a segment. For points \((x_1, y_1)\) and \((x_2, y_2)\), the midpoint is the average of the \(x\)-values and the average of the \(y\)-values. This is used for perpendicular bisectors, which pass through the midpoint at a right angle.

Real situations often give you a straight line without saying so. A taxi fare of a fixed charge plus a price per kilometre is a line: the fixed charge is \(c\) and the price per kilometre is \(m\). Thinking this way helps you check that your gradient and intercept have sensible meanings and signs.

To check whether a point lies on a line, substitute its coordinates into the equation. If both sides are equal, the point is on the line. If you are asked where two lines meet, set the two expressions for \(y\) equal and solve for \(x\).

Definitions and formulae

Term or formulaMeaning / when to use
\(y = mx + c\)Equation of a straight line with gradient \(m\) and \(y\)-intercept \(c\).
\(m = \dfrac{y_2 - y_1}{x_2 - x_1}\)Gradient of the line through two points.
\(y - y_1 = m(x - x_1)\)Line with gradient \(m\) through the point \((x_1, y_1)\).
Parallel lines\(m_1 = m_2\).
Perpendicular lines\(m_1 \times m_2 = -1\), so \(m_2 = -\dfrac{1}{m_1}\).
Midpoint\(\left(\dfrac{x_1 + x_2}{2}, \dfrac{y_1 + y_2}{2}\right)\).
Horizontal and vertical lines\(y = k\) is horizontal with gradient 0. \(x = k\) is vertical with undefined gradient.

Worked examples

Example 1 A drone flies in a straight line on a map grid, passing through \(A(2, 5)\) and \(B(6, 13)\). Find the equation of the line \(AB\).

Step 1: find the gradient. \(m = \dfrac{13 - 5}{6 - 2} = \dfrac{8}{4} = 2\).

Step 2: write \(y = 2x + c\) and substitute \(A(2, 5)\). \(5 = 2(2) + c\), so \(c = 1\).

Step 3: check with \(B\). \(2(6) + 1 = 13\), which matches.

Answer: \(y = 2x + 1\)

Example 2 Find the equation of the line that is parallel to \(3x + 2y = 12\) and passes through \((4, -1)\).

Step 1: rearrange the given line. \(2y = -3x + 12\), so \(y = -\tfrac{3}{2}x + 6\). Its gradient is \(-\tfrac{3}{2}\).

Step 2: a parallel line has the same gradient, so \(y = -\tfrac{3}{2}x + c\).

Step 3: substitute \((4, -1)\). \(-1 = -\tfrac{3}{2}(4) + c = -6 + c\), so \(c = 5\).

Answer: \(y = -\tfrac{3}{2}x + 5\)

Example 3 (Extended) The points \(P(-1, 2)\) and \(Q(5, 6)\) are the ends of a segment. Find the equation of the perpendicular bisector of \(PQ\).

Step 1: the bisector passes through the midpoint of \(PQ\). Midpoint \(= \left(\dfrac{-1 + 5}{2}, \dfrac{2 + 6}{2}\right) = (2, 4)\).

Step 2: gradient of \(PQ = \dfrac{6 - 2}{5 - (-1)} = \dfrac{4}{6} = \dfrac{2}{3}\).

Step 3: the perpendicular gradient is \(-\dfrac{3}{2}\).

Step 4: use \(y - 4 = -\tfrac{3}{2}(x - 2)\). Expanding gives \(y = -\tfrac{3}{2}x + 3 + 4 = -\tfrac{3}{2}x + 7\).

Step 5: check the midpoint. \(-\tfrac{3}{2}(2) + 7 = 4\), which matches.

Answer: \(y = -\tfrac{3}{2}x + 7\)

Common errors

  • subtracting in different orders, such as \(\dfrac{13 - 5}{2 - 6}\). This gives the wrong sign. Keep the order the same on top and bottom.
  • reading the gradient from \(3x + 2y = 12\) as 3. You must make \(y\) the subject first, which here gives \(-\tfrac{3}{2}\).
  • for a perpendicular gradient, only flipping the fraction or only changing the sign. You must do both.
  • calling a vertical line \(y = k\). A vertical line is \(x = k\) and a horizontal line is \(y = k\).
  • when comparing two lines for parallelism, comparing the numbers in front of \(x\) without first rearranging into \(y = mx + c\).

Exam tip: when you find \(c\), substitute the other point too, if you have one. It takes ten seconds and catches arithmetic slips. Write the final equation as \(y = mx + c\) unless the question asks for another form.

Check yourself

  1. Find the gradient of the line through \((1, 3)\) and \((4, 12)\), and write its equation.
    Answer\(m = \dfrac{12 - 3}{4 - 1} = 3\). Then \(3 = 3(1) + c\), so \(c = 0\). The line is \(y = 3x\).
  2. Are the lines \(y = 2x + 5\) and \(4x - 2y = 7\) parallel?
    AnswerRearrange the second: \(2y = 4x - 7\), so \(y = 2x - 3.5\). Both gradients are 2, so the lines are parallel. They are different lines because the intercepts differ.
  3. Find the equation of the line through \((0, 6)\) that is perpendicular to \(y = \tfrac{1}{4}x + 3\).
    AnswerThe perpendicular gradient is \(-4\). The point \((0, 6)\) is on the \(y\)-axis, so \(c = 6\). The line is \(y = -4x + 6\).
  4. Find the gradient of a line perpendicular to \(2y = 5 - x\).
    AnswerRearrange: \(y = -\tfrac{1}{2}x + 2.5\), so \(m = -\tfrac{1}{2}\). The perpendicular gradient is 2.