How Slope and Distance Work (Rise Over Run)
Slope = rise ÷ run = (y₂ − y₁) ÷ (x₂ − x₁), and distance = √((x₂ − x₁)² + (y₂ − y₁)²). For (1, 2) and (4, 6), the slope is 4 ÷ 3 = 1.333, the line is y = 1.333x + 0.667, and the distance between the points is 5.
Slope: how steep a line is
Slope compares how far a line goes up with how far it goes across. Take the points (1, 2) and (4, 6). The rise is 6 − 2 = 4 and the run is 4 − 1 = 3, so m = 4 ÷ 3 = 1.3333. Whichever point you call first, you get the same answer, as long as you subtract in the same order in the top and the bottom.
What the sign tells you
| Slope | Line |
|---|---|
| Positive | Goes up from left to right |
| Negative | Goes down from left to right |
| Zero | Horizontal |
| Undefined | Vertical, because the run is 0 |
The equation of the line
In slope-intercept form, y = mx + b. Use one point to find b: b = y₁ − m × x₁ = 2 − 1.3333 × 1 = 0.6667. So the line is y = 1.333x + 0.667. Parallel lines have the same slope, and perpendicular lines have slopes that multiply to −1.
Slope as angle and percent grade
The angle with the horizontal is arctan(slope). A slope of 1 is 45°. For m = 4/3 the angle is 53.13°. Roads, ramps and roofs use percent grade = slope × 100. A road that rises 6 metres over 100 metres has a grade of 6%.
The distance formula
The distance between two points is the hypotenuse of a right triangle whose legs are the differences in x and y: d = √((x₂ − x₁)² + (y₂ − y₁)²). For (1, 2) and (4, 6) that is √(9 + 16) = 5. Add (z₂ − z₁)² under the root for three dimensions.
The midpoint
The midpoint is the average of the coordinates: ((1 + 4) ÷ 2, (2 + 6) ÷ 2) = (2.5, 4). It is the point halfway along the segment, and it is also the centre of the circle that has the segment as a diameter.
Straight-line and grid distance
The straight-line distance is the shortest path. If you can only travel along a grid of streets, the Manhattan distance |Δx| + |Δy| is the length of the route: 3 + 4 = 7 for these points.
Everyday uses
- Rates of change in graphs, such as speed from a distance-time graph.
- Gradients of roads, drains, stairs and wheelchair ramps.
- Trend lines in spreadsheets and statistics.
- Game design, maps and computer graphics.
Check your work with the slope calculator, the distance calculator and the Pythagorean theorem calculator.
Key terms
- Rise: The vertical change between points.
- Run: The horizontal change between points.
- Intercept: Where a line crosses an axis.
- Hypotenuse: The longest side of a right triangle.
- Midpoint: The point halfway between two points.
Practice questions
Try each one before you read the answer.
- Slope through (0, 0) and (2, 6)?
Answer: 3. - Distance between (1, 1) and (4, 5)?
Answer: 5. - Midpoint of (2, 4) and (8, 10)?
Answer: (5, 7).
A quick example to remember
Picture a hill road that climbs 12 metres over a horizontal distance of 200 metres. The slope is 12 ÷ 200 = 0.06, a 6% grade, and the angle is about 3.4°. The road itself is slightly longer than 200 metres: √(200² + 12²) = 200.36 metres.
Frequently asked questions
What is the slope of a horizontal line?
It is 0, because the rise is 0 however far you move across.
How do I convert slope to a percent grade?
Multiply the slope by 100. A slope of 0.05 is a 5% grade.
Why is the distance formula the Pythagorean theorem?
The horizontal and vertical differences form the legs of a right triangle, and the distance is its hypotenuse.