Sub topic 3
Slope as Rise Over Run
This chapter defines slope and shows how to find it by counting or by subtraction. It assumes you can plot points on the coordinate plane, work with signed numbers and fractions, and evaluate simple expressions. The chapters after this one cover the full slope formula and the sign of the slope, so here the focus is on what slope means.
What slope measures
A line on a coordinate plane has a steepness, and slope is the number that records it. A steep hill and a gentle ramp both go up. Slope tells you how much they go up for the same distance traveled forward.
Slope compares two changes:
- The run is how far you move horizontally, along the x-direction.
- The rise is how far you move vertically, along the y-direction.
The slope of a line, written m, is the rise divided by the run:
m = rise / run
Slope is a ratio, so it is one number whatever units the axes use. A slope of 2 means that for every 1 unit you move right, the line goes up 2 units.
Rise and run have signs
Rise and run are signed numbers, and the signs carry information.
| Movement | Sign |
|---|---|
| Right | run is positive |
| Left | run is negative |
| Up | rise is positive |
| Down | rise is negative |
Pick two points on a line and call them A and B. To get from A to B, you change x by the run and y by the rise. The run is the new x minus the old x. The rise is the new y minus the old y.
A worked example
Take the points A = (1, 2) and B = (4, 8).
- Run: x goes from 1 to 4, so the run is 4 − 1 = 3.
- Rise: y goes from 2 to 8, so the rise is 8 − 2 = 6.
- Slope: m = 6 / 3 = 2.
The line goes up 2 units for every 1 unit to the right. You can check this by walking from A. Right 1 and up 2 gives (2, 4). Repeat to get (3, 6), then (4, 8), which is B.
Slope is the same everywhere on a line
You can choose any two points on a line and get the same slope. This is the property that makes slope a useful description of the whole line. The line y = 2x has these points:
| Point | x | y |
|---|---|---|
| P | 0 | 0 |
| Q | 1 | 2 |
| R | 2 | 4 |
| S | 3 | 6 |
Compute the slope for several pairs:
| Pair | Rise | Run | Rise / run |
|---|---|---|---|
| P to Q | 2 | 1 | 2 |
| Q to R | 2 | 1 | 2 |
| P to S | 6 | 3 | 2 |
| Q to S | 4 | 2 | 2 |
Every pair gives 2. The reason is geometry. The rise and run between two points on a line form the legs of a right triangle. Triangles built on different parts of the same line are similar, because they have the same angles. Similar triangles have equal ratios between corresponding sides, so rise / run does not change.
The converse is also useful. If two points give a different slope than a third pair, the three points do not all lie on one line.
Counting slope from a graph
You can often read the slope from a drawn line without any subtraction:
- Find two points where the line crosses grid intersections exactly. Using exact points avoids rounding errors.
- Starting from the left point, count the squares you move to the right. This is the run.
- Count the squares you then move up or down to reach the second point. This is the rise.
- Write rise / run and simplify.
Suppose a line passes through (0, 1) and (4, 4). From the left point, move 4 squares right and 3 squares up. The slope is 3/4. Read this as "up 3 for every 4 to the right".
Always read left to right, so the run is positive. Then the sign of the rise alone gives the sign of the slope.
Fractions as steps
A slope that is a fraction gives you a recipe for stepping along the line.
- m = 3/4: go right 4, up 3.
- m = −2/3: go right 3, down 2. You can also go left 3 and up 2, which lands on the same line.
- m = 5 is the fraction 5/1: go right 1, up 5.
The negative sign can be attached to the rise or to the run, and the result is the same, because −2/3, 2/(−3), and −(2/3) are equal. Do not put a negative on both. Moving down 2 and left 3 gives the slope (−2)/(−3) = 2/3, which is positive.
The order of the points does not matter
Go from B to A instead of A to B in the earlier example. The run is 1 − 4 = −3 and the rise is 2 − 8 = −6. The slope is (−6)/(−3) = 2. You walked the line backward, so both rise and run flipped sign, and the signs cancel in the ratio.
The rule is to keep the same order for both subtractions. Whichever point you call the start, subtract its y from the other y, and subtract its x from the other x.
Computing rise, run, and slope in code
This program computes rise and run for any two points. It uses Fraction so that the slope is exact, such as 3/2, and not a rounded decimal. It then checks that every pair of points on one line gives the same slope.
from fractions import Fraction
def rise_run(p, q):
"""Return (rise, run) for moving from point p to point q."""
(x1, y1), (x2, y2) = p, q
return y2 - y1, x2 - x1
def slope(p, q):
rise, run = rise_run(p, q)
if run == 0:
raise ValueError("The run is 0, so the slope is undefined")
return Fraction(rise, run)
# Four points on the line that rises 3 for every 2 units of run
line = [(0, 1), (2, 4), (4, 7), (6, 10)]
for i in range(len(line)):
for j in range(i + 1, len(line)):
print(line[i], "to", line[j], "->", slope(line[i], line[j]))
# Reversing the direction flips both signs, so the slope is unchanged
print(slope((6, 10), (0, 1))) # 3/2All six pairs print 3/2, and the reversed pair does too. The check for run == 0 guards against dividing by zero, which happens when both points have the same x-value.
Slope as a rate
Slope is a rate of change, which is the change in one quantity per one unit of another. If a line shows distance in kilometers against time in hours, then rise is kilometers, run is hours, and the slope is kilometers per hour. A slope of 60 means 60 km for each hour.
The units of the slope are always the units of the vertical axis divided by the units of the horizontal axis. Writing the units next to your numbers helps you catch swapped values.
Common errors
- Run over rise. The ratio is vertical over horizontal. A quick check: a steep line should have a large number. A slope of 5 is steep and a slope of 1/5 is shallow. If your answer disagrees with how the line looks, you probably flipped the fraction.
- Mixed subtraction order. Computing y2 − y1 for the rise and x1 − x2 for the run gives the wrong sign. Keep the order consistent.
- Counting from the wrong point. On a graph, count the squares between points, not the numbers of the points themselves. Moving from x = 1 to x = 4 is a run of 3, not 4.
- Doubling the negative. Moving down and left together gives a positive slope, not a negative one.
- Not simplifying. The slope 6/4 is correct but 3/2 is the standard form. Simplify when you can.
- Using points that are not on the line. A point read between grid lines gives an unreliable slope. Use exact intersections.
Practice
Exercise
Find the slope of the line through (2, 3) and (6, 11). Give the rise, the run, and the simplified slope.
Show answer
The rise is 11 − 3 = 8 and the run is 6 − 2 = 4. The slope is 8/4 = 2.
Exercise
A line passes through (1, 7) and (4, 1). Find the slope by moving from the first point to the second, then again by moving from the second point to the first. Explain why the two answers agree.
Show answer
First to second: rise = 1 − 7 = −6 and run = 4 − 1 = 3, so m = −6/3 = −2. Second to first: rise = 7 − 1 = 6 and run = 1 − 4 = −3, so m = 6/(−3) = −2. Reversing the direction changes the sign of both the rise and the run, and the two sign changes cancel in the ratio.
Exercise
A line has slope −3/5 and passes through (0, 4). Starting at that point, find two more points on the line, one to the right and one to the left.
Show answer
A slope of −3/5 means that for a run of 5 to the right, the rise is −3. Moving right 5 and down 3 from (0, 4) gives (5, 1). Moving left 5 and up 3 gives (−5, 7). Both points lie on the same line, because moving the opposite way flips both signs.
Exercise
A taxi charges according to a line through the points (2 km, 9 dollars) and (6 km, 17 dollars). Find the slope and state its units.
Show answer
The rise is 17 − 9 = 8 dollars and the run is 6 − 2 = 4 km. The slope is 8/4 = 2 dollars per kilometer.