Writing the equation of a line
What this lesson covers
- The form y − y₁ = m(x − x₁) needs one point and a gradient.
- Two points give the gradient first.
- Rearranging to y = mx + c shows the gradient and the y-intercept.
The point and gradient form
- For a line through (x₁, y₁) with gradient m, write y − y₁ = m(x − x₁).
- Expand and tidy to reach y = mx + c, where m is the gradient and c is the y-intercept.
Gradient 3 through (2, 5)
- Put the numbers straight into the form.
- y − 5 = 3(x − 2)
- y − 5 = 3x − 6expand
- y = 3x − 1add 5
Try it: gradient and intercept
Through (1, 4) and (3, 10)
- Two points give the gradient, then either point finishes it.
- m = (10 − 4) ÷ (3 − 1) = 3
- y − 4 = 3(x − 1)
- y = 3x + 1
Reading a line in general form
- Rearrange 2x + 3y = 12 to see its gradient.
- 3y = −2x + 12
- y = −(2/3)x + 4gradient −2/3, y-intercept 4
Reading the line
- In y = 3x − 1, the line crosses the y-axis at −1 and rises 3 for each 1 across.
Graphing calculator
General form
- Write y = x/2 + 2 in the form ax + by + c = 0.
- 2y = x + 4multiply by 2
- x − 2y + 4 = 0
Try it: lines through a point
Common mistakes
- Reading the gradient of 2x + 3y = 12 as 2.Make y the subject first; the gradient is −2/3.
- Forgetting to multiply the negative in y − 5 = −2(x − 3).The bracket expands to −2x + 6.
Try it: build the equation
Your turn
State the gradient of y = −2x + 5.
Find the line with gradient 2 through (1, 3).
Find the gradient of 4x + 2y = 6.
Find the y-intercept of 3x − y = 6.
Find the equation of the line through (2, 1) and (4, 7).
Write y = (3/4)x − 2 in the form ax + by + c = 0 with whole numbers.
A student expands y − 4 = −2(x − 3) as y − 4 = −2x − 6. What is the correct line in y = mx + c form?
A Wellington taxi charges a fixed fee plus a rate per km. 4 km costs $14 and 10 km costs $29. Find the cost C dollars for d km.
Show answer
1. −2 2. y = 2x + 1 3. y = −2x + 3, so −2 4. y = 3x − 6, so −6 5. y = 3x − 5. m = (7 − 1) ÷ (4 − 2) = 3, then y − 1 = 3(x − 2) gives y = 3x − 6 + 1 = 3x − 5. 6. 3x − 4y − 8 = 0. Multiply by 4: 4y = 3x − 8, then move everything to one side. 7. y = −2x + 10. The negative multiplies both terms: −2(x − 3) = −2x + 6, so y = −2x + 6 + 4 = −2x + 10. 8. C = 2.5d + 4. m = (29 − 14) ÷ (10 − 4) = 2.5 per km, and C − 14 = 2.5(d − 4) gives C = 2.5d + 4 (a $4 fixed fee).
Sample question: Achieved
Find the equation of the line through (−2, 7) and (4, −5) in the form y = mx + c.
Hint
Find the gradient from the two points, then put it and one point into y − y₁ = m(x − x₁).
Answer
y = −2x + 3
Step by step
- Two points give the gradient first: m = (y₂ − y₁) ÷ (x₂ − x₁).
- m = (−5 − 7) ÷ (4 − (−2)) = −12 ÷ 6 = −2.
- Use the point and gradient form with (−2, 7): y − 7 = −2(x − (−2)) = −2(x + 2).
- Expand: y − 7 = −2x − 4.
- Add 7 to both sides: y = −2x + 3.
- Classic mistake: x − (−2) written as x − 2. Two minus signs make a plus.
- Check with the other point: x = 4 gives y = −8 + 3 = −5. Correct.
Full working
- m = −5 − 74 + 2 = −2rise over run
- y − 7 = −2(x + 2)point and gradient form
- y − 7 = −2x − 4
- y = −2x + 3
Sample questions: Merit
Line L passes through (3, −1) and has the same y-intercept as the line 2x − 5y = 20. Find L in the form ax + by + c = 0.
Hint
Put x = 0 into 2x − 5y = 20 to find the shared y-intercept. That gives you a second point on L.
Answer
x − y − 4 = 0
Step by step
- The y-intercept is where x = 0. Put x = 0 into 2x − 5y = 20: −5y = 20, so y = −4.
- So L also goes through (0, −4). Now L has two points: (0, −4) and (3, −1).
- Gradient of L: (−1 − (−4)) ÷ (3 − 0) = 3 ÷ 3 = 1.
- The y-intercept is −4 and the gradient is 1, so y = x − 4.
- General form means everything on one side, equal to zero: x − y − 4 = 0.
- Classic mistake: taking the gradient of 2x − 5y = 20 as well. The question only shares the intercept, not the slope.
- Check: (3, −1) gives 3 − (−1) − 4 = 0, and (0, −4) gives 0 + 4 − 4 = 0. Both lie on L.
Full working
- x = 0: −5y = 20, so y = −4y-intercept of the given line
- m = −1 + 43 − 0 = 1through (0, −4) and (3, −1)
- y = x − 4y = mx + c with c = −4
- x − y − 4 = 0
The line through A(1, 5) and B(4, −1) crosses the x-axis at P and the y-axis at Q. Find the exact length PQ.
Hint
Find the equation of AB first. Then P has y = 0 and Q has x = 0.
Answer
PQ = √61.25 = 7√52 ≈ 7.83 units
Step by step
- To find where a line crosses the axes you need its equation, so start there.
- Gradient AB = (−1 − 5) ÷ (4 − 1) = −6 ÷ 3 = −2.
- Through A(1, 5): y − 5 = −2(x − 1), so y = −2x + 7.
- Q is on the y-axis, where x = 0: y = 7. So Q = (0, 7). That is just the y-intercept.
- P is on the x-axis, where y = 0: 0 = −2x + 7, so x = 3.5. So P = (3.5, 0).
- PQ by the distance formula: √(3.5² + 7²) = √(12.25 + 49) = √61.25.
- Exact form: 61.25 = 2454 = 49 × 5 ÷ 4, so √61.25 = 7√52 ≈ 7.83.
- Classic mistake: putting y = 0 in to find Q. The y-axis is where x = 0.
- Check: both A and B fit y = −2x + 7: 5 = −2 + 7 and −1 = −8 + 7.
Full working
- m = −1 − 54 − 1 = −2
- y = −2x + 7through A(1, 5)
- Q = (0, 7), P = (3.5, 0)x = 0, then y = 0
- PQ = √(3.5² + 7²) = √61.25
- PQ = 7√52 ≈ 7.83
Sample questions: Excellence
A line with negative gradient m passes through P(2, 3) and cuts the positive x-axis at A and the positive y-axis at B. Show that the area of triangle OAB is (3 − 2m)²−2m. Hence find the line that makes the area 12.
Hint
Write the line as y − 3 = m(x − 2), find both intercepts in terms of m, and use ½ × base × height.
Answer
Area = (3 − 2m)²−2m; area 12 gives m = −32, so the line is y = −(32)x + 6
Step by step
- Start with the point and gradient form: y − 3 = m(x − 2).
- B is on the y-axis, so put x = 0: y = 3 − 2m. That is the height of the triangle.
- A is on the x-axis, so put y = 0: −3 = m(x − 2), so x = 2 − 3m. That is the base.
- Tidy the base over one denominator: 2 − 3m = 2m − 3m.
- Area = ½ × base × height = ½ × 2m − 3m × (3 − 2m).
- Note 2m − 3 = −(3 − 2m), so the area is −(3 − 2m)²2m = (3 − 2m)²−2m. That is what we had to show.
- "Hence": set it equal to 12: (3 − 2m)² = −24m.
- Expand: 9 − 12m + 4m² = −24m, so 4m² + 12m + 9 = 0.
- This factorises as (2m + 3)² = 0, so m = −32. A repeated root means exactly one line gives area 12.
- The line: y − 3 = −(32)(x − 2), so y = −(32)x + 6.
- Check: it cuts the axes at A(4, 0) and B(0, 6), and ½ × 4 × 6 = 12. Correct.
Full working
- y − 3 = m(x − 2)point and gradient form
- x = 0: OB = 3 − 2mheight
- y = 0: OA = 2 − 3m = 2m − 3mbase
- area = ½ × 2m − 3m × (3 − 2m) = (3 − 2m)²−2mshown
- (3 − 2m)² = −24m, so 4m² + 12m + 9 = 0set the area to 12
- (2m + 3)² = 0, so m = −32one repeated root
- y = −(32)x + 6
Triangle ABC has A(0, 0), B(8, 0) and C(2, 6). A median joins a corner to the midpoint of the opposite side. Find the equations of the medians from C and from A, find where they meet, and prove that the third median also passes through that point.
Hint
Find each midpoint, then each line. Solve two of the lines together, then substitute the point into the third.
Answer
Medians y = −3x + 12 and y = (35)x meet at (103, 2); the median from B, y = −(37)(x − 8), also passes through (103, 2)
Step by step
- A median needs a corner and the midpoint of the opposite side. So find the midpoints first.
- Midpoint of AB is (4, 0). Midpoint of BC is (5, 3). Midpoint of AC is (1, 3).
- Median from C(2, 6) to (4, 0): gradient (0 − 6) ÷ (4 − 2) = −3, so y − 0 = −3(x − 4), which is y = −3x + 12.
- Median from A(0, 0) to (5, 3): gradient 35 through the origin, so y = (35)x.
- They meet where the y values agree: (35)x = −3x + 12. Multiply by 5: 3x = −15x + 60, so 18x = 60 and x = 103.
- Then y = (35) × (103) = 2. They meet at (103, 2).
- Median from B(8, 0) to (1, 3): gradient (3 − 0) ÷ (1 − 8) = −37, so y = −(37)(x − 8).
- Test the point: x = 103 gives x − 8 = −143, and −(37) × (−143) = 2. So y = 2, and the third median passes through (103, 2) too.
- All three medians meet at one point. Notice it is the average of the corners: ((0 + 8 + 2) ÷ 3, (0 + 0 + 6) ÷ 3) = (103, 2).
- Classic mistake: drawing the median to a corner instead of to a midpoint. A median always ends at a midpoint.
Full working
- midpoints: AB (4, 0), BC (5, 3), AC (1, 3)
- median from C: m = −3, y = −3x + 12
- median from A: y = (35)x
- (35)x = −3x + 12, so x = 103, y = 2solve together
- median from B: y = −(37)(x − 8)through (8, 0) and (1, 3)
- x = 103: y = −(37) × (−143) = 2the point fits
- all three medians meet at (103, 2)
What to take away
- One point and a gradient fix a line.
- Make y the subject before reading the gradient.
Challenge
Three straight paths in a park follow x − 3y + 3 = 0, x + y = 9 and y = 3x + 1. They enclose a triangular lawn. Find the three corners of the lawn and its area.
Hint
Put each line in y = mx + c form and solve the pairs. For the area, draw the smallest rectangle around the triangle and take away the right-angled triangles in its corners.
Answer
Corners (0, 1), (6, 3) and (2, 7); area 16 square units
Step by step
- Rearrange: x − 3y + 3 = 0 is y = (13)x + 1, and x + y = 9 is y = −x + 9.
- (13)x + 1 = −x + 9 gives (43)x = 8, so x = 6, y = 3.
- −x + 9 = 3x + 1 gives x = 2, y = 7. And (13)x + 1 = 3x + 1 gives x = 0, y = 1.
- No two lines here are perpendicular, so there is no easy base and height. Box the triangle instead: x from 0 to 6 and y from 1 to 7 gives a 6 by 6 square, area 36.
- The three corner triangles have areas ½ × 6 × 2 = 6, ½ × 4 × 4 = 8 and ½ × 2 × 6 = 6.
- Lawn area = 36 − 6 − 8 − 6 = 16.
Full working
- y = (13)x + 1, y = −x + 9, y = 3x + 1gradient and intercept form
- (13)x + 1 = −x + 9, so (6, 3)
- −x + 9 = 3x + 1, so (2, 7)
- (13)x + 1 = 3x + 1, so (0, 1)
- box 6 × 6 = 36; corners 6 + 8 + 6 = 20rectangle minus corner triangles
- corners (0, 1), (6, 3), (2, 7); area 16 square units
For which values of k do the points A(0, k), B(k, 6) and C(6, 9) lie on one straight line? Give the equation of the line for each value.
Hint
On one line, the gradient of AB must equal the gradient of BC. That gives an equation in k.
Answer
k = 3, giving y = x + 3; or k = 12, giving y = −(12)x + 12 (x + 2y − 24 = 0)
Step by step
- Three points are on one line exactly when the gradient from A to B equals the gradient from B to C.
- Gradient AB = (6 − k) ÷ k. Gradient BC = 3 ÷ (6 − k).
- Set them equal and cross-multiply: (6 − k)² = 3k, so k² − 15k + 36 = 0.
- Factorise: (k − 3)(k − 12) = 0, so k = 3 or k = 12. (k = 0 and k = 6 would make a gradient undefined, but neither is a solution, and neither gives three points in a line.)
- k = 3: A(0, 3), B(3, 6), C(6, 9) have gradient 1 and y-intercept 3, so y = x + 3.
- k = 12: A(0, 12), B(12, 6), C(6, 9) have gradient −12 and y-intercept 12, so y = −(12)x + 12. Check C: −3 + 12 = 9.
Full working
- m(AB) = 6 − kk, m(BC) = 36 − krise over run
- (6 − k)² = 3kequal gradients
- k² − 15k + 36 = 0, so (k − 3)(k − 12) = 0
- k = 3: y = x + 3through (0, 3), gradient 1
- k = 12: y = −(12)x + 12through (0, 12), gradient −12
- k = 3, y = x + 3; or k = 12, y = −(12)x + 12
For each number k, the line L(k) is (k + 2)x + (1 − k)y = 4 − k. Show that every line L(k) passes through the same fixed point, and find it. Then find the line in this family that is perpendicular to 2x − 6y = 5, giving it in the form y = mx + c.
Hint
Try two values of k that make a term vanish, such as k = 1 and k = −2, and solve the two lines together. Then check that point works for every k.
Answer
Every line passes through (1, 2); the perpendicular member is k = 14, which is y = −3x + 5
Step by step
- k = 1 gives 3x = 3, so x = 1. k = −2 gives 3y = 6, so y = 2. These two lines meet at (1, 2).
- Test (1, 2) in the general line: (k + 2)(1) + (1 − k)(2) = k + 2 + 2 − 2k = 4 − k. That is the right-hand side for every k, so all the lines pass through (1, 2).
- 2x − 6y = 5 rearranges to y = (13)x − 56, gradient 13. A perpendicular line has gradient −3.
- Make y the subject of L(k): gradient = −(k + 2) ÷ (1 − k). Set this to −3: k + 2 = 3 − 3k, so 4k = 1 and k = 14.
- k = 14 gives (94)x + (34)y = 154. Multiply by 4 and divide by 3: 3x + y = 5, so y = −3x + 5.
- Check: it passes through (1, 2), since −3 + 5 = 2, and (−3) × (13) = −1.
Full working
- k = 1: x = 1; k = −2: y = 2two easy members
- (k + 2)(1) + (1 − k)(2) = 4 − k for all k(1, 2) is on every line
- 2x − 6y = 5 has gradient 13, so the perpendicular gradient is −3
- −k + 21 − k = −3, so k = 14gradient of L(k)
- (94)x + (34)y = 154, so 3x + y = 5
- fixed point (1, 2); perpendicular line y = −3x + 5
Practise this
Report a mistake
More in AS 91256
Is your child on track?
Take the free placement test