Slope Formula: How to Calculate the Slope Between Two Points
Calculate rise over run, including negative, horizontal and vertical cases, through five worked examples.
TL;DR
The slope formula is m = (y₂ − y₁)/(x₂ − x₁), provided x₂ ≠ x₁. Subtract the coordinates in the same point order.
Key Points
- The numerator is the change in y and the denominator is the change in x.
- Swapping the two points changes both signs and preserves slope when the denominator is nonzero.
- Horizontal lines have slope zero and vertical lines have undefined slope.
How do you use the slope formula?
Label two distinct points. Choose a direction from the first point to the second. Subtract y-values and x-values in that direction, divide and simplify. For a line on a graph, use exact grid intersections when possible. Slope is a rate, such as dollars per hour, when axes have units. OpenStax — College Algebra 2e: Linear Functions
Worked examples
Positive slope
From (1, 2) to (5, 10), m = 8/4 = 2.
Negative slope
From (−2, 6) to (2, 2), m = −4/4 = −1.
Fractional slope
From (0, 1) to (6, 5), m = 4/6 = 2/3.
Zero versus undefined
The points (1, 4) and (7, 4) give 0/6 = 0. The points (3, 1) and (3, 9) give 8/0, so a finite slope is undefined.
A subtraction mistake
For (−1, 5) and (3, 7), using 7 − 5 over −1 − 3 gives the wrong sign. Keep both differences second minus first to obtain 2/4 = 1/2.
How do you calculate slope from a table or a graph?
Take any two rows if the data represent a straight line. In a table with x-values 1, 3 and 7 and y-values 4, 7 and 13, the first pair gives (7 − 4)/(3 − 1) = 3/2. The next gives (13 − 7)/(7 − 3) = 6/4 = 3/2. The different run lengths give the same rate. Check a second pair before treating an arbitrary set of points as linear.
On a graph, choose two intersections you can read exactly. If each horizontal grid square represents two units and each vertical square represents five, moving two squares right and one square up gives slope 5/4. Use axis units rather than counting square marks as though both scales matched. Interpret slope on a plotted line
Reverse the formula to find a missing value
A line through (2, 3) and (6, y) has slope −2. Substitute to get −2 = (y − 3)/4. Multiply by four, so y − 3 = −8 and y = −5. Check the sign on a sketch: moving four units right on a line with negative slope must move down, so the missing y-value should be below 3.
Practice problem
Find the slope through (−3, 5) and (3, −4), then reverse the order.
Solution. Second minus first gives −9/6 = −3/2. First minus second gives 9/(−6), which is also −3/2. Changing only one subtraction direction would flip the sign incorrectly.
Frequently Asked Questions
Can the same point be used twice?
No. The calculation gives 0/0 and supplies no information about a line’s direction.
Conclusion
- Use two distinct points.
- Keep both subtractions in the same direction.
- Check whether the result agrees with the visual trend.
Read More
- Slope of a Line: What Positive, Negative and Zero Slope Mean
- Perpendicular Lines: Definition, Slope and Examples
- Browse math formulas
Research Behind This Article
- OpenStax, College Algebra 2e: Linear Functions. openstax.org
- OpenStax, College Algebra 2e: Key Equations for Functions. openstax.org