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

ExaminerPrep › IB Maths AA › Notes

IB Maths AA · Topic 2 · 2.1 · SL and HL

Equations of straight lines, parallel and perpendicular lines

This note covers the different ways to write the equation of a straight line, how to find a gradient, and how the gradients of parallel and perpendicular lines are related. Straight lines appear in almost every later topic, from tangents in calculus to modelling with linear functions, so fluency here saves time everywhere.

Key ideas

A straight line has a constant gradient. The gradient measures how much \(y\) changes for each 1 unit increase in \(x\). A line is fixed by two points, or by one point and its gradient.

Three forms of the equation are in common use:

  • Gradient-intercept form, \(y = mx + c\). The gradient is \(m\) and the line crosses the \(y\)-axis at \((0, c)\).
  • Point-gradient form, \(y - y_1 = m(x - x_1)\). This is the quickest way to write an equation when you know one point \((x_1, y_1)\) and the gradient.
  • General form, \(ax + by + d = 0\), where \(a\), \(b\) and \(d\) are usually integers. Many questions ask for the answer in this form.

To find the gradient from two points \((x_1, y_1)\) and \((x_2, y_2)\), divide the change in \(y\) by the change in \(x\). If you start with the general form, rearrange it into \(y = mx + c\) to read off the gradient. For \(ax + by + d = 0\), the gradient is \(-\dfrac{a}{b}\).

Parallel lines never meet, so they slope at the same rate: \(m_1 = m_2\). Perpendicular lines meet at a right angle, and their gradients multiply to \(-1\): \(m_1 \times m_2 = -1\). To find a perpendicular gradient, flip the fraction and change the sign. A gradient of \(\dfrac{2}{5}\) becomes \(-\dfrac{5}{2}\).

Two special cases need care. A horizontal line has gradient 0 and equation \(y = k\). A vertical line has an undefined gradient and equation \(x = k\). A horizontal line and a vertical line are perpendicular, even though the rule \(m_1 m_2 = -1\) cannot be applied to them.

Other useful tools that go with these ideas:

  • The midpoint of \((x_1, y_1)\) and \((x_2, y_2)\) is \(\left(\dfrac{x_1 + x_2}{2}, \dfrac{y_1 + y_2}{2}\right)\).
  • The perpendicular bisector of a segment passes through its midpoint and is perpendicular to the segment.
  • A point lies on a line if its coordinates make the equation true. To find where a line meets an axis, set the other variable to zero.
  • To find where two lines meet, solve their equations simultaneously.

Definitions and formulae

Term or formulaMeaning / when to use
\(m = \dfrac{y_2 - y_1}{x_2 - x_1}\)Gradient from two points on the line.
\(y = mx + c\)Gradient \(m\), \(y\)-intercept \(c\). Good for reading off features and for graphing.
\(y - y_1 = m(x - x_1)\)Line with gradient \(m\) through \((x_1, y_1)\).
\(ax + by + d = 0\)General form. Gradient is \(-\dfrac{a}{b}\); \(y\)-intercept is \(-\dfrac{d}{b}\).
\(m_1 = m_2\)Condition for two lines to be parallel.
\(m_1 m_2 = -1\)Condition for two lines (neither vertical nor horizontal) to be perpendicular.
MidpointAverage of the \(x\)-coordinates and average of the \(y\)-coordinates.

Worked examples

Example 1 A drone flies in a straight line from \(A(-2, 5)\) to \(B(4, -1)\) on a map grid. Find the equation of the line \(AB\) in the form \(y = mx + c\).

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

Step 2: use point-gradient form with point \(A\). \(y - 5 = -1(x - (-2))\), so \(y - 5 = -(x + 2)\).

Step 3: expand and rearrange. \(y - 5 = -x - 2\), so \(y = -x + 3\).

Check with \(B\): when \(x = 4\), \(y = -4 + 3 = -1\). This matches.

Answer: \(y = -x + 3\)

Example 2 Find the equation of the line that passes through \((4, -1)\) and is parallel to \(3x - 2y + 8 = 0\). Give your answer in the form \(ax + by + d = 0\) with integer coefficients.

Step 1: find the gradient of the given line. Rearrange: \(2y = 3x + 8\), so \(y = \dfrac{3}{2}x + 4\). The gradient is \(\dfrac{3}{2}\).

Step 2: a parallel line has the same gradient, \(m = \dfrac{3}{2}\).

Step 3: use point-gradient form. \(y - (-1) = \dfrac{3}{2}(x - 4)\), so \(y + 1 = \dfrac{3}{2}x - 6\).

Step 4: multiply by 2 to clear the fraction. \(2y + 2 = 3x - 12\).

Step 5: move everything to one side. \(3x - 2y - 14 = 0\).

Check: substituting \((4, -1)\) gives \(12 + 2 - 14 = 0\). This is true.

Answer: \(3x - 2y - 14 = 0\)

Example 3 Two radio masts are at \(P(1, 2)\) and \(Q(7, 6)\). A relay station is to be placed on the line that is equidistant from both masts. Find the equation of the perpendicular bisector of \(PQ\).

Step 1: find the midpoint of \(PQ\). \(\left(\dfrac{1 + 7}{2}, \dfrac{2 + 6}{2}\right) = (4, 4)\).

Step 2: find the gradient of \(PQ\). \(m_{PQ} = \dfrac{6 - 2}{7 - 1} = \dfrac{4}{6} = \dfrac{2}{3}\).

Step 3: find the perpendicular gradient. Flip and change sign: \(m = -\dfrac{3}{2}\).

Step 4: write the line through \((4, 4)\). \(y - 4 = -\dfrac{3}{2}(x - 4)\), so \(y = -\dfrac{3}{2}x + 6 + 4 = -\dfrac{3}{2}x + 10\).

Step 5: general form. Multiply by 2: \(2y = -3x + 20\), so \(3x + 2y - 20 = 0\).

Check: the midpoint gives \(12 + 8 - 20 = 0\). This is true.

Answer: \(y = -\dfrac{3}{2}x + 10\), or \(3x + 2y - 20 = 0\)

Common errors

  • Common error: reading the gradient of \(3x - 2y + 8 = 0\) as 3 or \(-3\). The gradient is only the coefficient of \(x\) when the equation is written as \(y = \dots\). Rearrange first.
  • Common error: finding the perpendicular gradient by only changing the sign, or only flipping the fraction. You must do both.
  • Common error: mixing up the order of subtraction, for example \(\dfrac{y_2 - y_1}{x_1 - x_2}\). Use the same order on top and bottom.
  • Common error: writing \(y - y_1 = m(x + x_1)\). The sign inside the bracket is a minus, so a point with \(x_1 = -2\) gives \(x - (-2) = x + 2\).
  • Common error: forgetting that a vertical line has the equation \(x = k\), not \(y = k\).

Exam tip: if a question asks for a particular form, such as integer coefficients in \(ax + by + d = 0\), finish by converting to it. Substitute a known point into your final equation as a quick check.

Check yourself

  1. Find the gradient of the line \(4x + 5y = 20\).
    AnswerRearrange: \(5y = -4x + 20\), so \(y = -\dfrac{4}{5}x + 4\). The gradient is \(-\dfrac{4}{5}\).
  2. Are the lines \(y = 2x + 1\) and \(x + 2y = 7\) perpendicular?
    AnswerThe first gradient is 2. For the second, \(2y = -x + 7\), so \(y = -\dfrac{1}{2}x + \dfrac{7}{2}\), with gradient \(-\dfrac{1}{2}\). The product is \(2 \times \left(-\dfrac{1}{2}\right) = -1\), so yes, they are perpendicular.
  3. Find the equation of the line through \((0, 6)\) that is perpendicular to \(y = \dfrac{1}{3}x - 2\).
    AnswerThe perpendicular gradient is \(-3\). The line crosses the \(y\)-axis at 6, so \(y = -3x + 6\).
  4. Find the value of \(k\) for which \(kx + 3y = 7\) is parallel to \(2x - y = 5\).
    AnswerThe line \(2x - y = 5\) has \(y = 2x - 5\), so the gradient is 2. The line \(kx + 3y = 7\) has gradient \(-\dfrac{k}{3}\). Set \(-\dfrac{k}{3} = 2\), so \(k = -6\).