Equation of a straight line: y = kx + m
In Swedish schools the equation of a straight line is written y = kx + m. k is the gradient: how much y changes when x increases by 1. m is where the line crosses the y-axis. Two points give k = (y₂ − y₁) / (x₂ − x₁), and one point gives m.
Watch Fox work it out on the board
Fox works one step at a time. Press play.
What do k and m mean?
y = kx + m
| x | y = 2x + 1 | y |
|---|---|---|
| 0 | 2 · 0 + 1 | 1 |
| 1 | 2 · 1 + 1 | 3 |
| 2 | 2 · 2 + 1 | 5 |
| 3 | 2 · 3 + 1 | 7 |
When x increases by 1, y increases by 2, so k = 2. When x = 0, y = 1, so m = 1.
- Positive k: the line rises to the right. Negative k: the line falls.
- k = 0: the line is horizontal, for example y = 4.
- On a graph: m is where the line crosses the y-axis, and k is steps up divided by steps to the right.
The gradient k from two points
We want to know how much y changes when x increases by 1.
k = (y₂ − y₁) / (x₂ − x₁)
We take the points in the same order on the top and the bottom of the fraction.
Find m using one point
We put k and one point into y = kx + m. Then m is the only unknown.
Parallel lines have the same k, for example y = 3x − 1 and y = 3x + 5.
Example
Example 1: the line through (1, 5) and (4, 11)
We want to find k and m in y = kx + m. We start with k.
y changes by 11 − 5 = 6 and x changes by 4 − 1 = 3.
k = (11 − 5) / (4 − 1) =
We put the point (1, 5) into y = 2x + m.
5 = 2 · 1 + m
We want m on its own, so we subtract 2 from both sides.
5 − 2 = 2 − 2 + m, so m = 3
Now we know both k and m.
y = 2x + 3
We try the other point (4, 11): 2 · 4 + 3 = 11. That is correct.
Example 2: the line through (−2, 7) and (2, −1)
We want to find y = kx + m. We take care with the negative signs.
y changes by −1 − 7 = −8 and x changes by 2 − (−2) = 4.
k = (−1 − 7) / (2 − (−2)) = − = −2
k is negative, so the line falls. We put (−2, 7) into y = −2x + m.
7 = −2 · (−2) + m
−2 · (−2) = 4. We subtract 4 from both sides.
7 = 4 + m, so m = 3
The equation of the line is:
y = −2x + 3
We try (2, −1): −2 · 2 + 3 = −1. That is correct.
Pitfalls
Taking the points in different orders, so that (11 − 5) / (1 − 4) = −2.
The same point first on both the top and the bottom: (11 − 5) / (4 − 1) = 2. Both x and y increase, so k must be positive.
Thinking that m is where the line crosses the x-axis.
m is the y-value when x = 0, so it is on the y-axis.
Practise on your own
0 of 4 correct1A line passes through the points (2, 3) and (5, 12). Find the gradient k.
2The line y = 2x + m passes through the point (3, 4). Find m.
3Find the equation of the straight line that passes through (1, 6) and (3, 2).
4Find the equation of the line that is parallel to y = 0.5x + 4 and passes through the point (6, 1).
More walkthroughs with Fox
Common questions
How do you find where the line crosses the x-axis?
On the x-axis, y = 0. For y = 2x + 3 we get 0 = 2x + 3, so x = −1.5.
Can every straight line be written as y = kx + m?
All except the vertical ones. A vertical line is written, for example, x = 2.
How can you tell if two lines are perpendicular?
The product of their gradients is −1. y = 2x + 1 and y = −0.5x + 3 are perpendicular, because 2 · (−0.5) = −1.
Read also
- Years 6–9Solving equations step by stepHow do you solve an equation?
- Year 9 and upper secondarySimultaneous equations (systems of equations)How do you solve simultaneous equations?
- Maths 3Derivatives and differentiation rulesWhat is a derivative, and how do you differentiate?
- Years 6–9Negative numbersHow do you calculate with negative numbers?
Keep practising with Somokai
Free to start. Hints and explanations when you get stuck.
Start practising for freeFound a mistake? Get in touch