Straight Lines AA SL

A straight line is fixed by its gradient and one point on it. This page shows how to find the equation of a line from two points or from a gradient and a point, how to move between the three forms of an equation, and how to use the gradient conditions for parallel and perpendicular lines, with worked examples and exam-style questions.

Formulas at a glance

The three forms of the equation of a line, and the gradient formula are in the formula booklet. The conditions for parallel and perpendicular lines are not, so learn them. The midpoint and distance formulas are in its prior learning section.

Gradient-intercept form

y=mx+cy=mx+c

In the booklet

General form

ax+by+d=0ax+by+d=0

In the booklet

Point-gradient form

y−y1=m(x−x1)y-y_1=m(x-x_1)

In the booklet

Parallel line condition

m1=m2m_1=m_2

Not in the booklet

Perpendicular line condition

m1×m2=−1m_1\times m_2=-1

Not in the booklet

Gradient between two points

m=y2−y1x2−x1m=\dfrac{y_2-y_1}{x_2-x_1}

In the booklet

Which form to use

Pick the form of the equation from the information you are given and the form the answer needs.

You are given or asked forUseNotes
The gradient and the yy-intercepty=mx+cy=mx+cThe gradient and the intercept can be read off directly
The gradient and one pointy−y1=m(x−x1)y-y_1=m(x-x_1)Substitute the gradient and the coordinates of the point, then rearrange if the answer needs another form
Two pointsThe gradient m=y2−y1x2−x1m=\dfrac{y_2-y_1}{x_2-x_1}, then the point-gradient formTake the differences in the same order on the top and the bottom. Either point gives the same line
The answer in the form ax+by+d=0ax+by+d=0Rearrange so that all the terms are on one sideMultiply through to clear fractions so that aa, bb and dd are integers
The intercepts of a linePut x=0x=0 for the yy-intercept and y=0y=0 for the xx-interceptWorks from any form of the equation, including ax+by+d=0ax+by+d=0
The gradient from ax+by+d=0ax+by+d=0Rearrange into y=mx+cy=mx+cThe gradient is −ab-\dfrac{a}{b}, not ab\dfrac{a}{b}
A line parallel to a given lineThe same gradient, m1=m2m_1=m_2Then use the point-gradient form with the point the new line must pass through
A line perpendicular to a given lineThe negative reciprocal gradient, m1×m2=−1m_1\times m_2=-1Find the gradient of the given line first, rearranging if necessary
The perpendicular bisector of a segmentThe midpoint, then the perpendicular gradientIt passes through the midpoint of the segment at right angles to it

Section 1 of 2 SL2.1

Equation of a straight line

A straight line has a constant gradient mm, and its equation can be written as y=mx+cy=mx+c, y−y1=m(x−x1)y-y_1=m(x-x_1) or ax+by+d=0ax+by+d=0. To find an equation, work out the gradient from two points or use the one given, then substitute a point to complete it. Rearranging between forms lets you read off the gradient and the intercepts.

The forms you need

None of these need memorising as such - they're really the same line, written three ways.

Key terms

How do you calculate a gradient from two points?

Divide the change in yy by the change in xx: m=y2−y1x2−x1m=\dfrac{y_2-y_1}{x_2-x_1}. Subtract the coordinates in the same order on the top and the bottom.

e.g. For (1,3)(1,3) and (5,11)(5,11), m=11−35−1=2m=\dfrac{11-3}{5-1}=2.

What does the yy-intercept tell you?

In y=mx+cy=mx+c, the constant cc is the value of yy where the line crosses the yy-axis, at the point (0,c)(0,c). It is the value of yy when x=0x=0.

e.g. y=−2x+7y=-2x+7 crosses the yy-axis at (0,7)(0,7).

How do you use point-gradient form?

Substitute the gradient and the coordinates of one point into y−y1=m(x−x1)y-y_1=m(x-x_1), then rearrange if a different form is required.

e.g. A line with gradient 33 through (2,5)(2,5) has y−5=3(x−2)y-5=3(x-2), which rearranges to y=3x−1y=3x-1.

How do you find the intercepts from general form?

Put x=0x=0 to find the yy-intercept, and put y=0y=0 to find the xx-intercept.

e.g. For 2x+3y−12=02x+3y-12=0, x=0x=0 gives y=4y=4 and y=0y=0 gives x=6x=6, so the intercepts are (0,4)(0,4) and (6,0)(6,0).

Worked example, step by step

The question No calculator needed [5 marks]

A line passes through the points A(−2,7)A(-2,\,7) and B(4,−5)B(4,\,-5). Find the equation of the line, giving your answer in the form ax+by+d=0ax+by+d=0, where aa, bb and dd are integers.

Worked solution: worked example

Answer: 2x+y−3=02x+y-3=0.

Step 1 - Find the gradient.

m=y2−y1x2−x1=−5−74−(−2)=−126=−2.m=\dfrac{y_2-y_1}{x_2-x_1}=\dfrac{-5-7}{4-(-2)}=\dfrac{-12}{6}=-2. M1 - Substitute into the gradient formula −5−74−(−2)\dfrac{-5-7}{4-(-2)} A1 - m=−2m=-2

Why? Two points give you the gradient first. Subtract the coordinates in the same order on the top and the bottom, and put the negative xx-coordinate in brackets so the sign is not lost.

Step 2 - Use the point-gradient form.

Use the point A(−2,7)A(-2,7) and m=−2m=-2: y−7=−2(x−(−2))=−2(x+2).y-7=-2\big(x-(-2)\big)=-2(x+2). M1 - Use the point-gradient form with a point and the gradient

Why? Once you have the gradient and one point, y−y1=m(x−x1)y-y_1=m(x-x_1) gives the equation straight away. You can use either point, so choose the one with the easier numbers.

Step 3 - Rearrange into gradient-intercept form.

Expand the bracket: y−7=−2x−4y-7=-2x-4, so y=−2x+3.y=-2x+3. A1 - y=−2x+3y=-2x+3

Why? Writing y=mx+cy=mx+c first makes the gradient and the yy-intercept easy to see, and it is a safe midway point before you reach the form the question asks for.

Step 4 - Write the answer in the required form.

Move every term to one side: 2x+y−3=0.2x+y-3=0. The coefficients 22, 11 and −3-3 are integers, so this is in the form ax+by+d=0ax+by+d=0. A1 - 2x+y−3=02x+y-3=0, with integer coefficients

Why? The question asked for ax+by+d=0ax+by+d=0 with integer coefficients, so do not leave the answer as y=−2x+3y=-2x+3. If the equation had fractions, multiply every term by the same number to clear them.

Step 5 - Check.

Substitute the other point B(4,−5)B(4,-5): 2(4)+(−5)−3=02(4)+(-5)-3=0. The point lies on the line.

Why? A line through two points must contain both of them. Substituting the point you did not use in step 2 checks the gradient and the rearranging in one go.

Marks (5):
M1 Substitute into the gradient formula −5−74−(−2)\dfrac{-5-7}{4-(-2)}
A1 m=−2m=-2
M1 Use the point-gradient form with a point and the gradient
A1 y=−2x+3y=-2x+3
A1 2x+y−3=02x+y-3=0, with integer coefficients

Now you try: enter your answers to be marked

These are real practice questions. Type your answer in each box and press Mark it. The worked solution and mark scheme appear straight away, and your first attempt is the one that counts. Use the keyboard for powers, roots and trig, and the working box for your notes.

1
Medium
No calc
[4 marks]
Find the equation of the line through (1,4)(1,4) and (5,−2)(5,-2), giving your answer in the form ax+by+c=0ax+by+c=0 where a,b,ca,b,c are integers.
[4]
Fractions & powers
Other

Worked solution: practice question 1

2
Easy
No calc
[3 marks]
Find the coordinates of the points where the line 2x+3y=122x+3y=12 crosses the xx-axis and the yy-axis.
(a) xx-axis.
[2]
(b) yy-axis.
[1]
Fractions & powers
Other

Worked solution: practice question 2

3
Medium
No calc
[4 marks]
A line passes through (4,−1)(4,-1) and is perpendicular to y=12x+3.y=\dfrac12x+3.

Determine the equation of this line.
[4]
Fractions & powers
Other

Worked solution: practice question 3

Your score so far: 0 out of 11 marks

Common mistakes

  • Reading the gradient straight off general form without rearranging. In ax+by+d=0ax+by+d=0, the gradient is −ab-\tfrac{a}{b}, not ab\tfrac{a}{b} - the minus sign only appears once you rearrange into y=mx+cy=mx+c.
  • Forgetting to expand the bracket in point-gradient form. y−y1=m(x−x1)y-y_1=m(x-x_1) is only a finished answer if the question asks for that form specifically - most of the time you still need to multiply out and collect terms to reach y=mx+cy=mx+c.
  • Mixing up which coordinate is x1x_1 and which is y1y_1. Substituting a point (3,−2)(3,-2) as x1=−2, y1=3x_1=-2,\ y_1=3 instead of the other way round silently flips the whole equation.

Try some questions on equation of a straight line

Section 2 of 2 SL2.1

Parallel and perpendicular lines

Two lines are parallel when their gradients are equal, m1=m2m_1=m_2, and perpendicular when the product of their gradients is −1-1, m1×m2=−1m_1\times m_2=-1. To use these conditions, rearrange each equation into y=mx+cy=mx+c, read off the gradients and compare them. Then build a new line from the required gradient and a given point.

The two gradient conditions

Neither condition is in the formula booklet, so learn both. The job in an exam is spotting which one a question actually wants and applying it to the right gradient.

Key terms

What is a negative reciprocal?

To find the negative reciprocal of a number, turn it upside down and change its sign. A line perpendicular to a line with gradient mm has gradient equal to the negative reciprocal of mm.

e.g. The negative reciprocal of 22 is −12-\tfrac12, since 2×(−12)=−12\times\left(-\tfrac12\right)=-1. The negative reciprocal of −35-\tfrac35 is 53\tfrac53.

How do you find the gradient of a line from its equation?

Rearrange the equation into y=mx+cy=mx+c form. The gradient is the coefficient of xx.

e.g. 4x+2y−6=04x+2y-6=0 rearranges to y=−2x+3y=-2x+3, so the gradient is −2-2.

How do you find a line parallel to a given line?

Use the same gradient as the given line, then substitute the coordinates of the required point to find the rest of the equation.

e.g. A line parallel to y=3x+1y=3x+1 through (2,−1)(2,-1) has y+1=3(x−2)y+1=3(x-2), so y=3x−7y=3x-7.

What is a perpendicular bisector?

The perpendicular bisector of a line segment passes through its midpoint at right angles. Its gradient is the negative reciprocal of the gradient of the segment.

e.g. For the segment from (0,0)(0,0) to (4,2)(4,2), the midpoint is (2,1)(2,1) and the gradient is 12\tfrac12. The bisector has gradient −2-2, so y−1=−2(x−2)y-1=-2(x-2), which gives y=−2x+5y=-2x+5.

Worked example, step by step

The question No calculator needed [6 marks]

The line L1L_1 has equation 3x−4y+8=03x-4y+8=0. The line L2L_2 is perpendicular to L1L_1 and passes through the point (6,−1)(6,\,-1). Find the equation of L2L_2, giving your answer in the form y=mx+cy=mx+c.

Worked solution: worked example

Answer: y=−43x+7y=-\dfrac43x+7.

Step 1 - Find the gradient of the first line.

Rearrange 3x−4y+8=03x-4y+8=0 to make yy the subject: 4y=3x+84y=3x+8, so y=34x+2.y=\dfrac34x+2. The gradient of L1L_1 is m1=34m_1=\dfrac34. M1 - Rearrange 3x−4y+8=03x-4y+8=0 to find the gradient A1 - m1=34m_1=\dfrac34

Why? You can only read a gradient from y=mx+cy=mx+c. In general form it is −ab-\dfrac ab, which here is −3−4=34-\dfrac{3}{-4}=\dfrac34, but rearranging is the safer route.

Step 2 - Find the perpendicular gradient.

For perpendicular lines m1×m2=−1m_1\times m_2=-1, so m2=−1m1=−43.m_2=-\dfrac{1}{m_1}=-\dfrac43. M1 - Use m1×m2=−1m_1\times m_2=-1 (negative reciprocal) A1 - m2=−43m_2=-\dfrac43

Why? Perpendicular gradients are negative reciprocals: turn the fraction upside down and change the sign. Check that 34×(−43)=−1\dfrac34\times\left(-\dfrac43\right)=-1.

Step 3 - Use the point-gradient form.

L2L_2 has gradient −43-\dfrac43 and passes through (6,−1)(6,-1): y−(−1)=−43(x−6).y-(-1)=-\dfrac43(x-6). M1 - Use the point-gradient form with (6,−1)(6,-1) and the perpendicular gradient

Why? A gradient and a point are all you need for the point-gradient form. Take care with the double negative: y−(−1)y-(-1) is y+1y+1.

Step 4 - Rearrange into gradient-intercept form.

y+1=−43x+8y+1=-\dfrac43x+8, so y=−43x+7.y=-\dfrac43x+7. A1 - y=−43x+7y=-\dfrac43x+7

Why? Multiplying out gives −43×(−6)=+8-\dfrac43\times(-6)=+8. Then subtract 11 from both sides to finish. The question asked for y=mx+cy=mx+c, so stop here.

Step 5 - Check.

Put x=6x=6 into the answer: y=−43(6)+7=−8+7=−1y=-\dfrac43(6)+7=-8+7=-1. The line passes through (6,−1)(6,-1).

Why? Checking that the line goes through the given point catches a sign slip in the last two steps. The perpendicular gradient was checked in step 2.

Marks (6):
M1 Rearrange 3x−4y+8=03x-4y+8=0 to find the gradient
A1 m1=34m_1=\dfrac34
M1 Use m1×m2=−1m_1\times m_2=-1 (negative reciprocal)
A1 m2=−43m_2=-\dfrac43
M1 Use the point-gradient form with (6,−1)(6,-1) and the perpendicular gradient
A1 y=−43x+7y=-\dfrac43x+7

Now you try: enter your answers to be marked

1
Medium
No calc
[3 marks]
The line y=kx+1y=kx+1 is perpendicular to y=2x.y=2x.

Find k.k.
[3]
Fractions & powers
Other

Worked solution: practice question 1

2
Medium
No calc
[3 marks]
The line kx+2y=3kx+2y=3 is parallel to y=−3x.y=-3x.

Find k.k.
[3]
Fractions & powers
Other

Worked solution: practice question 2

3
Medium
No calc
[3 marks]
The line through (1,2)(1,2) and (5,k)(5,k) is perpendicular to a line of gradient 4.

Find k.k.
[3]
Fractions & powers
Other

Worked solution: practice question 3

Your score so far: 0 out of 9 marks

Common mistakes

  • Assuming parallel lines are identical. m1=m2m_1=m_2 only guarantees the lines never meet - they can still have different yy-intercepts and so be distinct, non-overlapping lines.
  • Forgetting the negative reciprocal for perpendicular gradients. A gradient of 34\tfrac34 gives a perpendicular gradient of −43-\tfrac43, not 43\tfrac43 - both the sign and the flip matter.
  • Comparing gradients before rearranging into y=mx+cy=mx+c. If a line is given as 2x+y=52x+y=5, its gradient is −2-2, not 22 - always isolate yy before reading off mm and applying either condition.

Try some questions on parallel and perpendicular lines

Syllabus content covered

CodeSyllabus content
SL2.1Different forms of the equation of a straight line. y=mx+cy=mx+c (gradient-intercept form). ax+by+d=0ax+by+d=0 (general form). y−y1=m(x−x1)y-y_1=m(x-x_1) (point-gradient form). Gradient; intercepts. Parallel lines m1=m2m_1=m_2. Perpendicular lines m1×m2=−1m_1\times m_2=-1.

Official IB source: Mathematics: analysis and approaches subject brief (PDF, ibo.org).

Quick questions

What forms can the equation of a straight line take?

Gradient-intercept form y=mx+cy=mx+c, general form ax+by+d=0ax+by+d=0, and point-gradient form y−y1=m(x−x1)y-y_1=m(x-x_1) when you know the gradient and one point on the line.

How do I know if two lines are parallel?

Two lines are parallel exactly when their gradients are equal, m1=m2m_1=m_2. They can still have different yy-intercepts and so never actually touch.

How do I find the gradient from the general form ax+by+d=0ax+by+d=0?

Rearrange into y=mx+cy=mx+c first. The gradient is −ab-\tfrac{a}{b}, not ab\tfrac{a}{b} - the sign flips because you divide the −a-a term by bb when isolating yy.

How do I find the gradient of a line perpendicular to a given one?

Take the negative reciprocal of the given gradient, since perpendicular gradients satisfy m1×m2=−1m_1\times m_2=-1. A gradient of 34\tfrac34 gives a perpendicular gradient of −43-\tfrac43.

How do I find the equation of a line through two points?

Find the gradient first, then substitute it and one of the points into y−y1=m(x−x1)y-y_1=m(x-x_1). For (1,3)(1,3) and (5,11)(5,11), m=2m=2 and y−3=2(x−1)y-3=2(x-1), so y=2x+1y=2x+1.

How do I show that two lines are perpendicular?

Find both gradients and multiply them. If the product is −1-1, the lines are perpendicular. For y=2x+1y=2x+1 and x+2y=6x+2y=6, the gradients are 22 and −12-\tfrac12, and their product is −1-1.

How do I write y=2x+1y=2x+1 in general form?

Move every term to one side, which gives 2x−y+1=02x-y+1=0. Multiplying every term by the same non-zero number gives an equivalent equation, such as 4x−2y+2=04x-2y+2=0.

How do the gradient rules work for horizontal and vertical lines?

A horizontal line has gradient 00 and a vertical line has no defined gradient, so the product rule cannot be used. Every vertical line is perpendicular to every horizontal line.

How do I check whether a point lies on a line?

Substitute its coordinates into the equation. If both sides are equal, the point lies on the line. For y=2x+1y=2x+1, the point (3,7)(3,7) lies on the line because 2(3)+1=72(3)+1=7.

How do I find the line through (4,3)(4,3) perpendicular to y=2x+1y=2x+1?

The perpendicular gradient is −12-\tfrac12, so y−3=−12(x−4)y-3=-\tfrac12(x-4). Expanding gives y=−12x+5y=-\tfrac12x+5.

Ready to practise properly?

Practice questions on every section, marked instantly like the real exam.