The slope formula
Slope measures how steep a line is: how far it rises or falls for every step to the right. Pick any two points on the line, subtract their y values to get the rise and their x values to get the run, then divide. The letter m is the usual symbol for it.
Example: the slope through (1, 2) and (5, 5)
- Rise: 5 − 2 = 3
- Run: 5 − 1 = 4
- m = 3 ÷ 4 = 3/4 = 0.75
The line climbs 3 units for every 4 units to the right.
Keep the points in the same order on the top and the bottom. Subtracting the other way round, 2 − 5 over 1 − 5, gives −3 ÷ −4, which is still 3/4. Mixing the order, such as 5 − 2 over 1 − 5, flips the sign and gives a wrong answer of −3/4.
Finding the equation of a line from two points
Once you have the slope, the y-intercept b is where the line crosses the y-axis. Put either point into y = mx + b and solve for b. That gives the slope-intercept form, the version most textbooks ask for.
Example: the line through (1, 2) and (5, 5)
- m = 3/4, found above
- b = 2 − 3/4 × 1 = 5/4 = 1.25
- Slope-intercept form: y = (3/4)x + 5/4
- Point-slope form: y − 2 = (3/4)(x − 1)
- Standard form: 3x − 4y = −5
Check with the other point: 3 × 5 − 4 × 5 = 15 − 20 = −5, so (5, 5) is on the line.
All three forms describe the same line. Slope-intercept form is best for graphing, point-slope form is the quickest to write straight from a point and a slope, and standard form, with whole-number coefficients, is handy for solving two equations together. The calculator keeps fractions exact, so you see 5/4 rather than a rounded decimal.
Positive, negative, zero and undefined slopes
| Points | Slope | What the line does | Equation |
|---|---|---|---|
| (1, 2) and (5, 5) | 3/4 | Rises from left to right | y = (3/4)x + 5/4 |
| (−2, 4) and (4, 0) | −2/3 | Falls from left to right | y = (−2/3)x + 8/3 |
| (−3, 2) and (5, 2) | 0 | Flat (horizontal) | y = 2 |
| (3, −1) and (3, 7) | Undefined | Straight up and down (vertical) | x = 3 |
A vertical line has a run of zero, and division by zero has no answer, so its slope is undefined rather than zero or infinity. It can't be written as y = mx + b at all. Instead its equation is x equals a constant, because every point on it shares the same x value. A horizontal line is the mirror case: every point shares the same y value, and its slope is exactly 0.
Distance and midpoint between two points
The rise and the run are the two short sides of a right triangle, and the segment joining the points is its longest side. The Pythagorean theorem gives that length. The midpoint is simply the average of the x values and the average of the y values.
Example: from (−2, 4) to (4, 0)
- Run: 4 − (−2) = 6, and rise: 0 − 4 = −4
- d = √(6² + (−4)²) = √(36 + 16) = √52
- √52 = √(4 × 13) = 2√13, about 7.211
- Midpoint: ((−2 + 4) ÷ 2, (4 + 0) ÷ 2) = (1, 2)
The points are 2√13, or about 7.211 units, apart, and halfway between them is (1, 2).
Points with a run of 4 and a rise of 3, like (1, 2) and (5, 5), are exactly 5 apart. That's the 3-4-5 triangle carpenters use to check that a corner is square.
Slope as an angle and a percent grade
Road signs, ramps and roofs often give steepness as a percent grade or an angle instead of a fraction. The grade is the slope times 100. The angle comes from the inverse tangent, angle = tan⁻¹(m), measured up from the horizontal.
| Slope | Grade | Angle |
|---|---|---|
| 1/12 | 8.33% | 4.76° |
| 1/10 | 10% | 5.71° |
| 1/2 | 50% | 26.57° |
| 3/4 | 75% | 36.87° |
| 1 | 100% | 45° |
| 2 | 200% | 63.43° |
A 100% grade is a 45 degree slope, not a vertical wall: it rises one unit for every unit forward. The 1:12 limit for wheelchair ramps in the ADA Standards works out to about 8.33%, under 5 degrees, which shows how gentle a usable ramp has to be. To find an angle by hand, use tan⁻¹ on the Scientific Calculator in degree mode.
Parallel and perpendicular lines
Parallel lines have the same slope, so they never meet. Perpendicular lines cross at a right angle, and their slopes are negative reciprocals of each other: flip the fraction and change the sign. Multiply the two slopes together and you always get −1.
Example: a line perpendicular to y = (3/4)x + 5/4
- Flip 3/4 to get 4/3
- Change the sign: −4/3
- Check: 3/4 × (−4/3) = −1
Any line with slope −4/3 meets the original at a right angle.
The rule only breaks down for horizontal and vertical lines. A horizontal line, with slope 0, is perpendicular to every vertical line, whose slope is undefined, since zero has no reciprocal. If your slope starts life as a ratio such as 1:12, the Ratio Calculator can simplify or scale it first, and the Fraction Calculator helps with the arithmetic.