Educerie
Level

Educerie · IB Diploma · Mathematics: analysis and approaches

Topic 2 Functions · 2.1 Straight lines

Level
SL and HL. Nothing here is HL only, so every section is examinable for both.
Themes (key concepts)
representation, relationships, equivalence. One straight line can be written three equivalent ways, and each way represents the same relationship between x and y while putting a different feature of it on show.
The question this unit answers
a straight line is the simplest relationship there is, so how do you pin one down, write it in whichever form the question wants, and tell when two lines are parallel or meet at a right angle?
Where it is examined
Paper 1 Section A, as a short 4 to 6 mark question: find a gradient, write an equation in a given form, find where two lines meet. Paper 2, in a context such as a slope, a ramp or a linear cost model. And inside longer questions everywhere else: the tangent and normal lines in calculus are straight lines found with the point-gradient form and the perpendicular rule on this page.

What you must be able to do

You must be able toLevelWhat it looks like in the exam
Find the gradient of a line from two points, or from its equationSL, HL"Find the gradient of AB" (2 marks), Paper 1
Write the equation of a line in gradient-intercept form y = mx + cSL, HL"Find the equation of L₁" (2 to 3 marks)
Write it in general form ax + by + d = 0, usually with integer coefficientsSL, HL"Give your answer in the form ax + by + d = 0, where a, b, d ∈ ℤ" (2 to 3 marks)
Use the point-gradient form y − y₁ = m(x − x₁)SL, HLThe fastest route to any line through a known point; later the tangent and normal
Find the x- and y-intercepts of a lineSL, HL"Write down the coordinates of the point where L crosses the y-axis" (1 mark)
Use m₁ = m₂ for parallel lines and m₁ × m₂ = −1 for perpendicular linesSL, HL"Find the equation of the line through P perpendicular to L" (4 marks)
Calculate gradients of inclines such as roads, ramps and bridgesSL, HLPaper 2 context: a gradient as a decimal, a percentage or an angle (2 to 4 marks)
Interpret gradient and intercept in a linear modelSL, HL"Interpret the value of m in this context" (1 to 2 marks)

Before you start

You need to plot points on a coordinate grid, rearrange a linear equation, and solve two linear equations at once. The midpoint of a line segment is prior learning too, and it turns up in the perpendicular bisector below. The formula booklet gives you the gradient formula and the three forms of a straight line, so the marks here are for using them, not for remembering them. The two rules for parallel and perpendicular lines are not in the booklet; learn them.


1The idea in one paragraph

A straight line is the graph of a relationship that changes at a constant rate: every step of 1 to the right moves the line up or down by the same amount. That fixed amount is the gradient, m. Know the gradient and one point, and the line is fixed; there is exactly one line through that point with that slope. Everything on this page follows from that. The three standard equations are three ways of writing the same line, chosen for what each one shows. Parallel lines share a gradient. Perpendicular lines have gradients that multiply to −1. And a slope in the real world, a road or a ramp, is the same number: vertical rise divided by horizontal distance.

2Gradient: rise over run

The gradient of a line measures how steep it is and which way it slopes. Take any two points on it, (x₁, y₁) and (x₂, y₂). The run is the horizontal change x₂ − x₁, the rise is the vertical change y₂ − y₁, and

m = (y₂ − y₁) ÷ (x₂ − x₁) · rise over run, from the formula booklet.

Figure 1 draws it for A(−2, 5) and B(4, −1).

Figure 1 · Gradient is rise over run Figure 1 · Gradient is rise over run x y −4 −2 2 4 6 −2 2 4 6 run = 4 − (−2) = 6 rise = −1 − 5 = −6 A(−2, 5) B(4, −1) y = −x + 3 From A to B the line runs 6 to the right and falls 6, so m = −6 ÷ 6 = −1.
Figure 1 · Gradient is rise over run
m = (y2 − y1) / (x2 − x1)
= (−1 − 5) / (4 − (−2))B is point 2, A is point 1
= −6 / 6
= −1

Two things make this reliable. First, subtract in the same order on top and bottom: B minus A in both, or A minus B in both. Swapping the order in one place only flips the sign and gives +1, which is wrong. Second, it does not matter which two points on the line you pick; a straight line has the same gradient everywhere, which is exactly what makes it straight.

The sign of m tells you the direction, as Figure 2 shows. Reading from left to right, a line with m > 0 rises and a line with m < 0 falls. A horizontal line has m = 0: the rise is zero whatever the run. A vertical line has no gradient at all (the gradient is undefined), because the run is zero and you cannot divide by zero. A vertical line is written x = k and a horizontal line y = k.

Figure 2 · What the sign of the gradient tells you Figure 2 · What the sign of the gradient tells you m > 0 · rises x y m < 0 · falls x y m = 0 · horizontal x y undefined · vertical x y Read left to right. Up is positive, down is negative, flat is zero, and a vertical line has no gradient.
Figure 2 · What the sign of the gradient tells you

The size of m tells you the steepness. A gradient of 3 means up 3 for every 1 across. A gradient of 0.2 means up 0.2 for every 1 across, a gentle slope. Gradients of 3 and −3 are equally steep; one rises and one falls.

3Gradient in the real world: roads, ramps and rates

The guide asks you to calculate gradients of inclines. A road, a ramp or a bridge has a gradient in exactly the sense above, with one care point: the run is the horizontal distance, not the distance along the slope.

A mountain road climbs 84 m while covering a horizontal distance of 1.2 km. Put both in metres first.

m = rise / run = 84 / 12001.2 km = 1200 m, same units top and bottom
= 0.07
= 7%a gradient as a percentage is m × 100

Figure 3 shows that triangle. A road sign reading 7% means exactly this: 7 m up for every 100 m across.

Figure 3 · A mountain road as a gradient Figure 3 · A mountain road as a gradient horizontal distance 1.2 km = 1200 m rise 84 m road θ m = 84 ÷ 1200 = 0.07, a 7% gradient, and tan θ = 0.07 so θ ≈ 4.00° Gradient = vertical rise ÷ horizontal distance. Vertical scale stretched so the rise can be seen.
Figure 3 · A mountain road as a gradient

The gradient is also the tangent of the angle of inclination θ, the angle the slope makes with the horizontal, because tan θ = opposite ÷ adjacent = rise ÷ run. So tan θ = 0.07 and θ = arctan 0.07 ≈ 4.00°. That uses the right-angled trigonometry you already know, and Paper 2 likes to ask for it.

An access ramp works the same way. Suppose a design rule says the gradient of a wheelchair ramp may not exceed 1/12, and a ramp rises 0.45 m over a horizontal run of 5.4 m. Its gradient is 0.45 ÷ 5.4 = 0.0833…, which is exactly 1/12. It meets the rule, just.

A gradient is also a rate of change, and that is how it appears in models. A taxi firm charges a fixed €3.50 plus €2.40 per kilometre, so the cost of a journey of d km is C(d) = 2.4d + 3.5. The gradient 2.4 is the extra cost for each extra kilometre, in euros per km. The intercept 3.5 is the cost when d = 0, the fixed charge. A 12 km journey costs 2.4 × 12 + 3.5 = €32.30. When a question says interpret the gradient, the answer always has this shape: "for each extra one unit of x, y increases by m units", with the real units named.

4Three forms of one line

The formula booklet gives three forms. They are equivalent: each describes exactly the same set of points. Learn what each one is good for.

FormWrittenWhat it shows at a glanceUse it when
Gradient-intercepty = mx + cgradient m, y-intercept (0, c)you need to read off the gradient or sketch the line
Point-gradienty − y₁ = m(x − x₁)gradient m and one point (x₁, y₁) on the lineyou know a point and a gradient: the fastest way to write the equation
Generalax + by + d = 0nothing directly, but it has no fractionsthe question asks for it, usually with a, b, d integers

Work one line through all three. The line passes through (6, 1) with gradient −2/3.

y − 1 = −(2/3)(x − 6)point-gradient: substitute m and (x1, y1) directly
y − 1 = −(2/3)x + 4expand: −(2/3) × (−6) = +4
y = −(2/3)x + 5gradient-intercept: m = −2/3, c = 5
3y = −2x + 15multiply by 3 to clear the fraction
2x + 3y − 15 = 0general form, a = 2, b = 3, d = −15

Check with the known point: 2(6) + 3(1) − 15 = 12 + 3 − 15 = 0. It lies on the line, so the equation is right. That check takes five seconds and catches most sign slips. Figure 4 draws the line with all three forms beside it.

Figure 4 · One line, three ways to write it Figure 4 · One line, three ways to write it x y 2 4 6 2 4 6 (0, 5) (7.5, 0) (6, 1) point-gradient y − 1 = −⅔(x − 6) gradient-intercept y = −⅔x + 5 general 2x + 3y − 15 = 0 Every form describes the same set of points. Each one puts a different fact on show.
Figure 4 · One line, three ways to write it

Going back from general form. Rearrange for y. From ax + by + d = 0 you get y = −(a/b)x − d/b, so the gradient is −a/b. Take 3x − 4y + 12 = 0: then 4y = 3x + 12, so y = (3/4)x + 3, with gradient 3/4 and y-intercept (0, 3). Do the rearrangement each time rather than memorising −a/b; the rearrangement is where the method mark lives.

A line through two points. Find the gradient first, then use either point in the point-gradient form. For P(1, 4) and Q(5, −4):

m = (−4 − 4) / (5 − 1) = −8 / 4 = −2
y − 4 = −2(x − 1)use P
y = −2x + 6
2x + y − 6 = 0check with Q: 2(5) + (−4) − 6 = 0

Using Q instead of P gives y + 4 = −2(x − 5), which simplifies to the same line. Check with the point you did not use.

5Intercepts

An intercept is where a line crosses an axis, and it is a point, so write it as coordinates.

  • The y-intercept is where x = 0. Put x = 0 into the equation.
  • The x-intercept is where y = 0. Put y = 0 into the equation.

For 2x + 3y − 15 = 0: with x = 0, 3y = 15 so y = 5, giving (0, 5). With y = 0, 2x = 15 so x = 7.5, giving (7.5, 0). Both are marked on Figure 4. For 3x − 4y + 12 = 0: the y-intercept is (0, 3) and the x-intercept, from 3x + 12 = 0, is (−4, 0).

In y = mx + c the y-intercept can be read straight off as (0, c). No other form hands you an intercept for free.

6Parallel and perpendicular lines

Two lines with gradients m₁ and m₂ are:

Parallel when m₁ = m₂. Perpendicular when m₁ × m₂ = −1, so m₂ = −1 ÷ m₁, the negative reciprocal.

Parallel lines rise at the same rate, so they never meet. That is the whole reason: same gradient, different intercept.

The perpendicular rule needs a picture, and Figure 5 gives it. Take a gradient triangle with run 4 and rise 3, so m₁ = 3/4. Turn the whole triangle a quarter turn about the origin. The run of 4 becomes a rise of 4, and the rise of 3 becomes a run of −3, pointing left. The new gradient is 4 ÷ (−3) = −4/3. The two numbers have swapped places (the reciprocal) and one sign has flipped (the negative). Multiply them: (3/4) × (−4/3) = −1. That works for any gradient, because turning through 90° always swaps run and rise and flips one sign.

Figure 5 · Turn a gradient triangle through 90° Figure 5 · Turn a gradient triangle through 90° x y run 4 rise 3 m₁ = 3/4 run −3 rise 4 m₂ = 4/(−3) = −4/3 90° Rotating a quarter turn swaps run and rise and flips one sign: 3/4 becomes −4/3. m₁ × m₂ = (3/4) × (−4/3) = −1.
Figure 5 · Turn a gradient triangle through 90°

The rule has one exception you must know. A horizontal line (m = 0) and a vertical line (no gradient) are perpendicular, but you cannot multiply an undefined gradient by anything. Treat that pair by eye: y = 3 and x = −1 meet at a right angle.

Now use both rules on the same line. Start from L: 3x − 4y + 12 = 0, whose gradient is 3/4 (section 4), and the point (2, −1). Figure 6 draws the results.

Parallel to L through (2, −1). Same gradient, 3/4. A quick route in general form: a parallel line has the same a and b, so it is 3x − 4y + d = 0 for some d. Substitute the point: 3(2) − 4(−1) + d = 0, so 6 + 4 + d = 0 and d = −10. The line is 3x − 4y − 10 = 0.

Perpendicular to L through (2, −1). Gradient −4/3.

m2 = −1 / (3/4) = −4/3negative reciprocal
y − (−1) = −(4/3)(x − 2)
3(y + 1) = −4(x − 2)multiply by 3
3y + 3 = −4x + 8
4x + 3y − 5 = 0check: 4(2) + 3(−1) − 5 = 0
Figure 6 · Parallel and perpendicular to the same line Figure 6 · Parallel and perpendicular to the same line x y −4 −2 2 4 −4 −2 2 4 3x − 4y + 12 = 0 (2, −1) 3x − 4y − 10 = 0 x y −4 −2 2 4 −4 −2 2 4 3x − 4y + 12 = 0 (2, −1) 4x + 3y − 5 = 0 Parallel keeps the gradient ¾. Perpendicular turns it into its negative reciprocal, −4/3.
Figure 6 · Parallel and perpendicular to the same line

Notice in general form that the perpendicular line swapped a and b and changed one sign: 3x − 4y became 4x + 3y. That is the negative reciprocal in disguise, and it makes a quick check.

The perpendicular bisector. The perpendicular bisector of a segment AB is the line through its midpoint at right angles to it. Every point on it is the same distance from A as from B, which is why it turns up in questions about the point equidistant from two towns or two masts. Figure 7 draws it for A(−1, 2) and B(5, 6).

M = ((−1 + 5)/2, (2 + 6)/2) = (2, 4)midpoint
mAB = (6 − 2) / (5 − (−1)) = 4/6 = 2/3
m⊥ = −3/2negative reciprocal
y − 4 = −(3/2)(x − 2)
2y − 8 = −3x + 6
3x + 2y − 14 = 0check M: 6 + 8 − 14 = 0
Figure 7 · The perpendicular bisector of AB Figure 7 · The perpendicular bisector of AB x y 2 4 6 2 4 6 8 A(−1, 2) B(5, 6) M(2, 4) 3x + 2y − 14 = 0 It passes through the midpoint M and meets AB at a right angle. Every point on it is the same distance from A as from B.
Figure 7 · The perpendicular bisector of AB

7Where two lines meet

Two lines that are not parallel meet at exactly one point, and that point satisfies both equations at once. So finding it means solving the two equations simultaneously, which is prior learning.

Where do y = 2x − 1 and x + 3y = 11 meet? Substitute the first into the second.

x + 3(2x − 1) = 11
x + 6x − 3 = 11
7x = 14, so x = 2
y = 2(2) − 1 = 3intersection (2, 3)
check in line 2: 2 + 3(3) = 11 ✓

On Paper 1 you do this by hand, and the numbers will be kind. On Paper 2 you may use your GDC, either its simultaneous-equation solver or by graphing both lines and using the intersect tool, which is the method 2.4 develops for curves too. Either way, give the answer as a point, (2, 3), not as two separate numbers.

If two lines have the same gradient and different intercepts they never meet: the equations have no solution. If they have the same gradient and the same intercept they are the same line, and every point is a solution.

8Where marks are lost

Subtracting in a different order on the top and the bottom. (−1 − 5) ÷ (−2 − 4) mixes B-minus-A with A-minus-B and gives +1 instead of −1. Pick an order and keep it.

Run over rise. The gradient is vertical change over horizontal change. Writing (x₂ − x₁) ÷ (y₂ − y₁) gives the reciprocal, and a steep line comes out gentle.

Using the slope length as the run. For a road or ramp, the run is the horizontal distance. If a question gives the length along the slope, find the horizontal distance first with Pythagoras.

Taking the reciprocal but not the negative. Perpendicular to gradient 2/5 is −5/2, not 5/2. A quick check: the two gradients must have opposite signs.

Leaving fractions in "general form" when integers were asked for. (2/3)x + y − 5 = 0 is not in the form ax + by + d = 0 with a, b, d ∈ ℤ. Multiply through by the common denominator.

Writing an intercept as a number. "The y-intercept is 5" usually gets the mark, but "the line meets the y-axis at (0, 5)" is what the question means by coordinates, and "(5, 0)" for the y-intercept is wrong. Put x = 0 for the y-intercept, y = 0 for the x-intercept, and write the point.

Reading the gradient off general form without rearranging. In 3x − 4y + 12 = 0 the gradient is not 3 and not −3. It is 3/4. Rearrange to y = … first.

Calling a vertical line's gradient zero. Horizontal lines have gradient zero. Vertical lines have no gradient; their equation is x = k.

9Work it right

  1. Label your two points (x₁, y₁) and (x₂, y₂) before substituting into the gradient formula, and subtract in the same order top and bottom.
  2. Get the gradient first; every equation question starts there.
  3. With a gradient and a point, write the point-gradient form straight away: it earns the method mark before any algebra.
  4. For a perpendicular line, write m₂ = −1 ÷ m₁ as a line of working, then its value.
  5. Rearrange into the form the question names, and if it says a, b, d ∈ ℤ, clear every fraction.
  6. Check the finished equation by substituting a point you know is on it.
  7. For a context, keep units consistent (metres with metres), then interpret the gradient in words with units.
  8. Give intersections and intercepts as coordinates.

10Try it

Marks in brackets. Q1 to Q3 are Paper 1 style, no calculator. Q4 and Q5 are Paper 2 style, with a GDC.

Q1. The line L₁ passes through A(−3, 7) and B(3, −2).

(a) Find the gradient of L₁. 2 marks

(b) Find the equation of L₁, giving your answer in the form ax + by + d = 0, where a, b, d ∈ ℤ. 2 marks

(c) The line L₂ is perpendicular to L₁ and passes through C(4, 3). Find the equation of L₂ in the form y = mx + c. 3 marks

(d) Find the coordinates of the point where L₁ and L₂ meet. 3 marks

Q2. The line L has equation 5x − 2y + 8 = 0. Find the gradient of L and the coordinates of both of its intercepts. 4 marks

Q3. The points A(2, k) and B(6, 1) lie on a line that is perpendicular to the line 2x − y + 7 = 0. Find the value of k. 4 marks

Q4. A mountain road climbs from an altitude of 640 m to an altitude of 1015 m over a horizontal distance of 4.8 km.

(a) Find the average gradient of the road, giving your answer as a percentage. 2 marks

(b) Find the angle the road makes with the horizontal. 2 marks

(c) A steeper section of the road has a gradient of 12%. Find the horizontal distance over which this section rises 90 m. 2 marks

Q5. A print shop's cost for an order is a linear function of the number of copies, n. An order of 250 copies costs $400 and an order of 1000 copies costs $850. The cost is modelled by C(n) = mn + c.

(a) Find the value of m and the value of c. 3 marks

(b) Interpret, in context, the value of m and the value of c. 2 marks

(c) A school has a budget of $1300. Find the largest order it can afford. 2 marks

11In one breath

A straight line changes at a constant rate, and that rate is the gradient, rise over run, m = (y₂ − y₁) ÷ (x₂ − x₁), subtracted in the same order top and bottom: positive rises, negative falls, zero is horizontal, and a vertical line has no gradient. The same line can be written y = mx + c to read off the gradient and y-intercept, y − y₁ = m(x − x₁) to build it from a point and a gradient, or ax + by + d = 0 with integers when the question asks. Intercepts come from putting x = 0 or y = 0, and they are points. Parallel lines share a gradient; perpendicular gradients multiply to −1, so take the negative reciprocal. A road or ramp's gradient is vertical rise over horizontal distance, times 100 for a percentage, and its angle has tan θ = m. Two lines meet where both equations hold, so solve them together and give the point.


Answers

Q1. (a) m = (−2 − 7) ÷ (3 − (−3)) = −9 ÷ 6 = −3/2. M1 for substituting both points into the gradient formula in a consistent order, A1 for −3/2. An answer of +3/2 or −2/3 scores M1 A0 at most if the substitution is shown.

(b) y − 7 = −(3/2)(x + 3), so 2y − 14 = −3x − 9, giving 3x + 2y − 5 = 0. Check with B: 9 − 4 − 5 = 0. M1 for a correct point-gradient or gradient-intercept equation using their m, A1 for the integer general form. Any non-zero integer multiple, such as −6x − 4y + 10 = 0, is accepted.

(c) Gradient of L₂ = −1 ÷ (−3/2) = 2/3. y − 3 = (2/3)(x − 4), so y = (2/3)x + 1/3. M1 for using the negative reciprocal of their gradient, M1 for substituting C into a line equation, A1 for the answer in the form asked.

(d) Substitute y = (2/3)x + 1/3 into 3x + 2y − 5 = 0: 3x + (4/3)x + 2/3 − 5 = 0, so (13/3)x = 13/3 and x = 1. Then y = 2/3 + 1/3 = 1. The lines meet at (1, 1). M1 for attempting to solve their two equations simultaneously, A1 for x = 1, A1 for the point (1, 1). Follow-through from their equations in (b) and (c).

Q2. 2y = 5x + 8, so y = (5/2)x + 4. The gradient is 5/2. The y-intercept is (0, 4). With y = 0: 5x + 8 = 0, so x = −8/5, and the x-intercept is (−8/5, 0), that is (−1.6, 0). M1 for rearranging to y = …, A1 for the gradient 5/2, A1 for (0, 4), A1 for (−8/5, 0). A gradient of 5 or −5/2, read off without rearranging, scores 0 for that mark.

Q3. From 2x − y + 7 = 0, y = 2x + 7, so its gradient is 2. The gradient of AB is therefore −1/2. So (1 − k) ÷ (6 − 2) = −1/2, giving 1 − k = −2 and k = 3. A1 for the gradient 2, M1 for the perpendicular gradient −1/2, M1 for setting their gradient of AB equal to it, A1 for k = 3.

Q4. (a) Rise = 1015 − 640 = 375 m and run = 4800 m, so m = 375 ÷ 4800 = 0.078125, which is 7.81% (3 s.f.). M1 for rise over run with both in metres, A1 for 7.81%. Using 4.8 with 375 gives 78.1, which scores M0.

(b) tan θ = 0.078125, so θ = 4.47° (3 s.f.). M1 for tan θ = their gradient, A1 for 4.47°. Using sin θ is M0, because 4.8 km is the horizontal distance, not the length of road.

(c) 0.12 = 90 ÷ d, so d = 90 ÷ 0.12 = 750 m. M1 for setting 0.12 equal to 90 over the distance, A1 for 750 m.

Q5. (a) m = (850 − 400) ÷ (1000 − 250) = 450 ÷ 750 = 0.6. Then 400 = 0.6(250) + c, so c = 400 − 150 = 250. M1 for the gradient from the two data points, A1 for m = 0.6, A1 for c = 250.

(b) m = 0.6: each extra copy adds $0.60 to the cost. c = 250: there is a fixed charge of $250 for any order, whatever its size. A1 for each interpretation, which must be in context and name the units. "m is the gradient" scores 0.

(c) 0.6n + 250 = 1300, so 0.6n = 1050 and n = 1750 copies. M1 for setting C(n) = 1300, A1 for 1750. Because 1750 is a whole number, no rounding is needed; if it were not, the answer would round down, since the school cannot overspend.


Educerie · written from the published IB Diploma Programme Mathematics: analysis and approaches guide, first assessment 2021, section 2.1 Straight lines. Original text, examples and questions. Diagrams drawn by Educerie. Last reviewed 25 September 2026.

Mocks: in the future, hold tight!