James Ashton MathsFREE MATHEMATICS. OPEN TO EVERYONE.
HomeIB DiplomaA levelAbout
IB Diploma › Maths AA HL › Topic 2: Functions › Straight lines

Straight lines

Gradients, the three forms of the equation of a line, parallel and perpendicular lines, and where lines meet.

SL 2.1SL + HL extensionPaper 1Paper 2≈ 45 min to work through
Before you start: gradients and y=mx+c. Shaky on these? See Before you start SL › Straight lines.

1What you need to know

Tick these off as you go. By the end of the page you should be able to do all of them without notes.

  • Find the gradient of a line from two points or from its equationSL 2.1
  • Use the forms y=mx+c, ax+by+d=0 and y−y1=m(x−x1)SL 2.1
  • Use m1=m2 for parallel lines and m1m2=−1 for perpendicular linesSL 2.1
  • Find where two lines intersectSL 2.1
  • Interpret the gradient and intercept in contextSL 2.1

2Notes & worked examples

Each idea is followed by a worked example. Try the question yourself first, then reveal the solution one step at a time.

The big idea

A straight line has the same steepness everywhere. That steepness is its gradient, and once you know the gradient and one point on the line, you can write down its equation.

2.1 Gradient and the three forms

The gradient m measures how much y changes when x increases by 1. It is "rise over run": the change in y divided by the change in x between any two points. A positive gradient slopes up from left to right, a negative gradient slopes down, and a horizontal line has gradient 0.

In context, the gradient is a rate. If a taxi fare is y=1.5x+3, where x is the distance in km, then each extra km costs €1.50 (the gradient), and the fixed charge is €3 (the y-intercept).

Formulae In formula booklet
m=y2−y1x2−x1y=mx+cax+by+d=0y−y1=m(x−x1)

Use y−y1=m(x−x1) when you know a point and the gradient: it saves a step. To find the gradient from ax+by+d=0, rearrange to y=….

Where does point-gradient form come from?

Take any point (x,y) on the line and the known point (x1,y1). The gradient between them must be m, so y−y1x−x1=m. Multiplying both sides by x−x1 gives y−y1=m(x−x1).

The three forms describe the same line. y=mx+c shows the gradient and y-intercept; ax+by+d=0 is the tidy form exam questions often ask for, with integer coefficients; y−y1=m(x−x1) is the quickest to write down.

Worked example 1Paper 1
Find the equation of the line through (2,−1) and (6,7).
m=7−(−1)6−2=2
y+1=2(x−2)
y=2x−5

2.2 Parallel and perpendicular lines

Parallel lines have equal gradients. Perpendicular lines have gradients that multiply to −1: if one gradient is m, the other is −1m.

Why −1m?

Rotate a line through 90°. A step of "1 across, m up" becomes "m across, 1 back", so the new gradient is −1m. For example, a line with gradient 2 is perpendicular to a line with gradient −12. Vertical lines (x= constant) have no gradient, so this rule does not apply to them.

Worked example 2Paper 1
Find the equation of the line perpendicular to 3x−4y+5=0 through (1,2). Give your answer in the form ax+by+d=0.
Rearrange: y=34x+54, so m=34.
Perpendicular gradient: −43.
y−2=−43(x−1)⇒3y−6=−4x+4
4x+3y−10=0

2.3 Intersections

Two lines meet where both equations are true: solve them simultaneously. On Paper 2, graph both and find the intersection.

A pair of lines in 2D either meet at exactly one point, are parallel and never meet (same gradient, different intercept), or are the same line. Solving simultaneously shows which: you get one solution, no solution, or infinitely many.

Worked example 3Paper 1
Find where y=2x−5 meets x+3y=6.
Substitute: x+3(2x−5)=6
7x=21, so x=3.
y=2(3)−5=1. The lines meet at (3,1).
Worked example 4 (faded)Paper 1
Write y=−23x+4 in the form ax+by+d=0, where a,b,d∈ℤ.
Multiply by 3: 3y= −2x + 12  ← you work this out
Rearrange: 2x + 3y − 12 = 0  ← you work this out
On your TI-Nspire Calculator tricks →

On a Graphs page, type each line as y=…. Then menu → 6: Analyze Graph → 4: Intersection and click either side of the crossing point.

3Explore it

Change the gradient and intercept of the navy line. The green line is perpendicular to it through the point P: notice that the two gradients always multiply to −1.

★HL extension

Extra depth for HL: harder worked examples and HL-standard exam questions.

At HL, straight-line questions are usually one part of a longer problem: a parameter that makes two lines parallel or perpendicular, or a line used to build a shape. Lines in three dimensions use vectors: see Vector equation of a line.

Lines with a parameter

Worked example H1Paper 1
The lines kx+2y=5 and 3x+(k−1)y=4 are parallel. Find the possible values of k.
Gradients −k2 and −3k−1
Rearrange each line into the form y=mx+c.
k2=3k−1⇒k2−k−6=0
k=3 or k=−2
Check that the lines are not the same line: for both values the constants differ, so the lines are parallel and distinct.

Lines that build a shape

Worked example H2Paper 1
A(1,2) and B(7,4). The point C lies on the y-axis and AC is perpendicular to AB. Find C and the area of triangle ABC.
Gradient AB=13, so gradient AC=−3: y−2=−3(x−1)
At x=0: C(0,5)
Right angle at A: area =12|AB||AC|=124010=10
The perpendicular sides are the base and height.

HL exam-style questions

Question 1Paper 1[5 marks]

Consider the lines L1:kx+2y=5 and L2:3x+(k−1)y=4, where k∈ℝ, k≠1.

  • (a)Find the values of k for which L1 and L2 are parallel.[3]
  • (b)Find the value of k for which L1 and L2 are perpendicular.[2]
(a)
−k2=−3k−1M1
k2−k−6=0A1
k=3, k=−2A1
(b)
k2·3k−1=−1M1
k=25A1
Question 2Paper 1[6 marks]

The points A(1,2) and B(7,4) are given. The point C lies on the y-axis and ∠BAC=90∘.

  • (a)Find the equation of the line AC.[3]
  • (b)Find the coordinates of C.[1]
  • (c)Find the area of triangle ABC.[2]
(a)
gradient AB=13A1
gradient AC=−3M1
y=−3x+5A1
(b)
(0,5)A1
(c)
124010M1
10A1

4Common mistakes & exam tips

Common mistakes

  • Subtracting the coordinates in a different order on the top and bottom of the gradient formula.
  • Reading the gradient of ax+by+d=0 as a: rearrange first.
  • Using −m or 1m for the perpendicular gradient instead of −1m.
  • Leaving fractions in ax+by+d=0 when integers are asked for.

Exam tips

  • If a question says "give your answer in the form ax+by+d=0", the final mark depends on it.
  • In context, the gradient is a rate (e.g. cost per km) and the intercept is a starting value.
  • Check an intersection by substituting into both equations.

5Practice

Fluency questions build the basics. Problem-solving questions make you think about which method to use.

FluencyP1
Find the gradient of the line through (−3,4) and (5,0).
0−45−(−3)=−12
FluencyP2
Find the equation of the line with gradient 3 through (−1,2).
y−2=3(x+1), so y=3x+5.
FluencyP3
Find the gradient of 5x−2y=7.
y=52x−72, so m=52.
FluencyP4
Write down the gradient of a line perpendicular to y=−4x+1.
14
Problem solvingP5
A(1,3) and B(5,11). Find the equation of the perpendicular bisector of AB in the form ax+by+d=0.
Midpoint (3,7); gradient of AB is 2, so the bisector has gradient −12: y−7=−12(x−3), which gives x+2y−17=0.
Problem solvingP6
The lines kx+2y=5 and 3x−y=1 are perpendicular. Find k.
Gradients −k2 and 3: −3k2=−1, so k=23.

6Exam-style questions

Original questions in the style of the IB exam, with full markschemes. Give yourself about 1 minute per mark.

Question 1Paper 1[6 marks]

The line L1 passes through A(−2,5) and B(4,−1).

  • (a)Find the gradient of L1.[2]
  • (b)Find the equation of L1.[2]
  • (c)The line L2 is perpendicular to L1 and passes through B. Find the equation of L2 in the form ax+by+d=0.[2]
(a)
−1−54−(−2)M1
−1A1
(b)
y−5=−1(x+2)M1
y=−x+3A1
(c)
Gradient 1: y+1=x−4M1
x−y−5=0A1
Question 2Paper 1[6 marks]

L1 has equation 2x+y=7 and L2 has equation x−3y=7.

  • (a)Find the coordinates of the point where L1 and L2 intersect.[3]
  • (b)Find the area of the triangle formed by L1, L2 and the y-axis.[3]
(a)
Attempt to solve simultaneously, e.g. x=7+3y⇒14+7y=7M1
y=−1A1
x=4: (4,−1)A1
(b)
y-intercepts 7 and −73A1
Area =12×283×4M1
563A1
Question 3Paper 2[5 marks]

A taxi charges C=3.5+1.2d euros for a journey of d km.

  • (a)Interpret the numbers 3.5 and 1.2 in this context.[2]
  • (b)Find the cost of a 12 km journey.[1]
  • (c)A second company charges C=5+1.05d. Find the distance for which both companies charge the same.[2]
(a)
3.5: fixed charge (€3.50) at the startA1
1.2: cost per kilometre (€1.20)A1
(b)
€17.90A1
(c)
3.5+1.2d=5+1.05dM1
d=10 kmA1

7Check yourself

Six quick questions, marked instantly. Aim for 6/6 before moving on. Fractions like 3/2 are accepted.

8Past-paper practice

Once you're scoring well above, try real IB questions. Your school or teacher will have these papers.

PaperQuestionFocusDifficulty
SL · May 2023 · TZ1 · Paper 1Q1Midpoint of PQ, gradient of perpendicular line, equation of that line★☆☆
SL · May 2024 · TZ2 · Paper 1Q4Symmetric quadrilateral: midpoint, line OB equation, exact area★★☆
SL · Nov 2024 · TZ1 · Paper 2Q5Roof cross section: angle from gradient 4/15, then lengths CE and BA★★☆
Spotted a mistake on this page?Tell me and I'll fix it. The button opens an email with this page already named, or write to jamesashtonmaths@gmail.com.
Report a mistake