How to Find the Slope of a Line from Two Points
Learn the rise over run formula, work through positive, negative, zero, and undefined slopes, and build the equation y = mx + b from two points.
Slope tells you how steep a line is and which way it tilts. Many homework problems give you two points and ask for the slope, then ask you to write the equation of the line. Both steps follow a fixed routine, and this guide works through it with four examples and a word problem.
What slope measures
Slope compares how much a line goes up or down (the rise) with how much it moves left to right (the run). The usual letter for slope is m.
The Common Core grade 8 standards explain why one number is enough to describe a whole line: using similar triangles, students show that the slope m is the same between any two distinct points on a non-vertical line. In other words, it does not matter which two points you pick. If they are on the same straight line, you get the same slope.
The formula
For two points (x1, y1) and (x2, y2):
m = (y2 - y1) / (x2 - x1)
The top is the change in y (the rise). The bottom is the change in x (the run). The one rule you must follow is to subtract in the same order on top and bottom.
Example 1: a positive slope
Find the slope through (2, 3) and (6, 11).
- Change in y: 11 - 3 = 8
- Change in x: 6 - 2 = 4
- Slope: 8 / 4 = 2
A slope of 2 means that every time x goes up by 1, y goes up by 2. The line rises as you read it from left to right.
Check by swapping the order: (3 - 11) / (2 - 6) = -8 / -4 = 2. Same answer, which confirms the order does not matter as long as you are consistent.
Example 2: a negative slope
Find the slope through (-1, 5) and (3, -3).
- Change in y: -3 - 5 = -8
- Change in x: 3 - (-1) = 4
- Slope: -8 / 4 = -2
The line falls as you read it from left to right. Watch the double negative in the run: subtracting -1 is the same as adding 1.
Example 3: zero and undefined slopes
Through (1, 4) and (5, 4), the change in y is 4 - 4 = 0, so the slope is 0 / 4 = 0. The line is horizontal.
Through (3, 1) and (3, 7), the change in x is 3 - 3 = 0, so the formula asks you to divide 6 by 0. Division by zero is not defined, so a vertical line has an undefined slope. This is exactly why the grade 8 standard limits its statement to non-vertical lines.
| Two points | Rise | Run | Slope | Line looks |
|---|---|---|---|---|
| (2, 3), (6, 11) | 8 | 4 | 2 | rising |
| (-1, 5), (3, -3) | -8 | 4 | -2 | falling |
| (1, 4), (5, 4) | 0 | 4 | 0 | flat |
| (3, 1), (3, 7) | 6 | 0 | undefined | vertical |
From slope to the equation y = mx + b
The same grade 8 standard asks students to derive the equation y = mx + b for a line that crosses the vertical axis at b. Once you have m, you only need b, the y-intercept.
Using Example 1: m = 2, and the line passes through (2, 3).
- Start with y = 2x + b.
- Substitute the point: 3 = 2(2) + b, so 3 = 4 + b.
- Solve: b = -1.
The equation is y = 2x - 1.
Check with the other point: at x = 6, y = 2(6) - 1 = 11. That matches (6, 11), so the equation is right.
Using Example 2: m = -2 and the point (-1, 5). Then 5 = -2(-1) + b, so 5 = 2 + b and b = 3. The equation is y = -2x + 3. Check with (3, -3): -2(3) + 3 = -3. It matches.
A word problem: rate of change and starting value
The grade 8 functions standards describe slope in real situations as a rate of change, and the y-intercept as the initial value, found from a description or from two (x, y) values.
Problem: A candle is 20 cm tall after burning for 2 hours and 14 cm tall after 5 hours. It burns at a steady rate. How fast is it burning, and how tall was it at the start?
Treat time as x and height as y, giving the points (2, 20) and (5, 14).
- Slope: (14 - 20) / (5 - 2) = -6 / 3 = -2. The candle loses 2 cm per hour.
- Starting height: 20 = -2(2) + b, so b = 24. The candle started at 24 cm.
The model is height = -2(hours) + 24. The negative slope makes sense, since the candle gets shorter over time, and the units of the slope are centimeters per hour.
Common mistakes
- Mixing the order. Writing (y2 - y1) on top but (x1 - x2) on the bottom flips the sign of your answer. Pick a first point and stick with it.
- Putting x on top. Slope is rise over run: change in y divided by change in x.
- Losing a negative sign. Subtracting a negative coordinate is the most common slip. Write the parentheses: 3 - (-1).
- Calling a vertical line's slope zero. Horizontal lines have slope 0. Vertical lines have an undefined slope.
Key takeaways
- Slope is the change in y divided by the change in x: m = (y2 - y1) / (x2 - x1).
- Any two points on the same non-vertical line give the same slope.
- Positive slopes rise, negative slopes fall, horizontal lines have slope 0, and vertical lines have an undefined slope.
- To write y = mx + b, find m first, then substitute one point to solve for b, and check with the other point.
- In word problems, the slope is the rate of change and b is the starting value.