The slope of a line is its rise divided by its run: the change in y divided by the change in x between any two points on the line. A slope of 3 means the line goes up 3 units for every 1 unit it moves to the right.
Slope from two points
- Label the points (x₁, y₁) and (x₂, y₂). Either point can be first.
- Subtract the y-values to get the rise.
- Subtract the x-values in the same order to get the run.
- Divide rise by run.
Example 1. Find the slope through (1, 2) and (4, 11).
- Rise: 11 − 2 = 9
- Run: 4 − 1 = 3
- Slope: 9 ÷ 3 = 3
Example 2. Find the slope through (−2, 5) and (6, 1).
- Rise: 1 − 5 = −4
- Run: 6 − (−2) = 8
- Slope: −4 ÷ 8 = −0.5, or −1/2
The line falls half a unit for every unit to the right. You can check any pair of points with the slope calculator, which also gives the equation of the line.
The four kinds of slope
| Slope | Line looks like | Example |
|---|---|---|
| Positive | Rises from left to right | m = 3 |
| Negative | Falls from left to right | m = −0.5 |
| Zero | Horizontal | y = 4 |
| Undefined | Vertical | x = 2 |
A horizontal line has a rise of 0, so its slope is 0 ÷ run = 0. A vertical line has a run of 0, and dividing by zero is undefined, so a vertical line has no slope value.
Slope-intercept form
The most common equation of a line shows the slope directly:
Here m is the slope and b is the y-intercept, the y-value where the line crosses the y-axis. In y = 2x − 7, the slope is 2 and the y-intercept is −7.
Writing the equation from two points
Once you have the slope, substitute one point into y = mx + b and solve for b.
Example 1 continued. The slope is 3 and the line passes through (1, 2).
- Substitute: 2 = 3 × 1 + b.
- Solve: b = 2 − 3 = −1.
- Equation: y = 3x − 1.
Check with the other point: 3 × 4 − 1 = 11. Correct.
Example 2 continued. The slope is −0.5 and the line passes through (−2, 5). Then 5 = (−0.5)(−2) + b = 1 + b, so b = 4 and the equation is y = −0.5x + 4. Check with (6, 1): −3 + 4 = 1. Correct.
Reading slope from other forms
If the equation is not solved for y, rearrange it. For 2x + 3y = 12, subtract 2x and divide by 3 to get y = −(2/3)x + 4. The slope is −2/3. In general, the line Ax + By = C has slope −A ÷ B.
Parallel and perpendicular lines
- Parallel lines have equal slopes. y = 2x + 1 and y = 2x − 5 never meet.
- Perpendicular lines have slopes that are negative reciprocals, so their product is −1. A line perpendicular to one with slope 2 has slope −1/2.
Slope as a rate of change
In real problems the slope tells you how fast one quantity changes compared with another, and its units are the y-units per x-unit.
Example 3. You have earned $150 after 10 hours and $240 after 16 hours. The slope is (240 − 150) ÷ (16 − 10) = 90 ÷ 6 = 15, meaning $15 per hour.
Slope also describes steepness in construction and roads:
- Grade is slope written as a percentage. A road that climbs 6 ft over 100 ft of horizontal distance has a slope of 0.06, a 6% grade, which is an angle of about 3.4°.
- Roof pitch is rise per 12 units of run. A 4-in-12 roof has a slope of 4/12 = 1/3, an angle of about 18.4°.
To turn a slope into an angle, take the inverse tangent of the slope. A slope of 1 is a 45° angle. To find the actual length of the sloped surface from its rise and run, use the Pythagorean theorem calculator.
Common mistakes
- Run over rise. The change in y goes on top. Dividing the wrong way gives the reciprocal.
- Subtracting in different orders. Using y₂ − y₁ on top and x₁ − x₂ on the bottom flips the sign. Start from the same point both times.
- Confusing zero and undefined. Horizontal lines have slope 0. Vertical lines have undefined slope.
- Reading the slope from an unsolved equation. In 2x + 3y = 12, the slope is not 2. Solve for y first.
Run the numbers yourself
Common questions
What is the slope formula?
Slope m = (y₂ − y₁) ÷ (x₂ − x₁), the change in y divided by the change in x between two points on the line.
What is the slope of a horizontal or vertical line?
A horizontal line has a slope of 0 because it has no rise. A vertical line has an undefined slope because its run is 0 and division by zero is not defined.
How do I find the slope from an equation?
Rearrange the equation into the form y = mx + b. The number multiplying x is the slope, and b is the y-intercept.