A table of x and y values can describe a straight line just as well as a graph. To find the slope, compare how much y changes with how much x changes.
Equal steps in x
| x | 0 | 2 | 4 | 6 |
|---|---|---|---|---|
| y | 5 | 8 | 11 | 14 |
Each time x goes up by 2, y goes up by 3. So the slope is m = 3 ÷ 2 = 3/2.
The table includes x = 0, and there y = 5. That is the y-intercept, so the equation is y = 3/2 x + 5.
Is it really a straight line?
A table only describes a straight line if the change in y divided by the change in x is the same between every pair of neighbouring columns. Check before you write an equation.
| x | 1 | 2 | 3 | 4 |
|---|---|---|---|---|
| y | 1 | 4 | 9 | 16 |
Here y goes up by 3, then 5, then 7. The changes are not equal, so these points do not lie on a straight line. (They are y = x², a curve.)
Uneven steps in x
When x doesn’t go up by the same amount each time, work out the slope separately for each pair of columns.
| x | −1 | 1 | 4 | 5 |
|---|---|---|---|---|
| y | 7 | 3 | −3 | −5 |
- From x = −1 to x = 1: (3 − 7) ÷ (1 − (−1)) = −4 ÷ 2 = −2
- From x = 1 to x = 4: (−3 − 3) ÷ (4 − 1) = −6 ÷ 3 = −2
- From x = 4 to x = 5: (−5 − (−3)) ÷ (5 − 4) = −2 ÷ 1 = −2
Every pair gives −2, so it is a straight line with m = −2. Find b from any column, for example (1, 3): 3 = −2 × 1 + b, so b = 5. The equation is y = −2x + 5.
See this line in Slope Finder →
A real-life table
| Miles | 2 | 4 | 6 |
|---|---|---|---|
| Fare (£) | 6 | 9 | 12 |
Every 2 extra miles cost £3 more, so the slope is 3 ÷ 2 = 1.5. The taxi charges £1.50 per mile. Working back from 2 miles: 6 = 1.5 × 2 + b, so b = 3. That is a fixed starting charge of £3, and the rule is fare = 1.5 × miles + 3.
In real-life problems, the slope is a rate (pounds per mile, metres per second) and the intercept is a starting amount.