Slope of a Line - Formula, Calculation, Examples
Book A Free Math Class
Slope of a Line - Formula, Calculation, Examples
TL;DR
The slope of a line - sometimes called the gradient — measures the line's steepness as the ratio of vertical change to horizontal change between any two points: m=\frac{y_2 - y_1}{x_2 - x_1}, or "rise over run."
BT
Last updated on June 9, 2022 9 min read
What Is the Slope of a Line?
The slope of a line is a number that describes its steepness and direction. Geometrically, it's the ratio of rise (vertical change) to run (horizontal change) between any two points on the line.
The formula, given two points (x1,y1) and (x2,y2):
m=\frac{y_2 - y_1}{x_2 - x_1} = \frac{\text{rise}}{\text{run}} = \frac{\Delta y}{\Delta x}
The Greek letter Δ (delta) is shorthand for "change in." The slope is the change in y per unit change in x — what mathematicians and physicists call the rate of change.
What Is the Slope Formula?
Given any two points (x1,y1) and (x2,y2) on a line:
m=\frac{y_2 - y_1}{x_2 - x_1}
Worked example. Find the slope of the line through (2,3) and (6,7).
m=\frac{7 - 3}{6 - 2} = \frac{4}{4} = 1
The slope is 1 — the line rises 1 unit for every 1 unit right.
Worked example. Find the slope through (2,3) and (5,11).
m=\frac{11 - 3}{5 - 2} = \frac{8}{3}
The slope is \frac{8}{3} — the line rises 8 units for every 3 units right (a steep climb).
What Are the Four Types of Slope?
The sign and form of the slope tell you the line's direction at a glance.
| Type | Slope Value | What the Line Does |
|---|---|---|
| Positive | m > 0 | Rises from left to right |
| Negative | m < 0 | Falls from left to right |
| Zero | m = 0 | Horizontal line (y = constant) |
| Undefined | Δx = 0 | Vertical line (x = constant) |
Positive Slope
Line goes up as you move right. Example: m=2, m=\frac{1}{3}.
Negative Slope
Line goes down as you move right. Example: m=-3, m=-\frac{2}{5}.
Zero Slope (Horizontal Line)
Horizontal line. y=5 has slope 0 because there's no vertical change as x varies.
Undefined Slope (Vertical Line)
Vertical line. x=3 has undefined slope because the denominator x2−x1=0, and division by zero is undefined.
How Do You Find Slope From a Graph?
Pick any two clearly-marked points on the line. Count vertical units between them (the rise) and horizontal units (the run). Slope is rise divided by run.
Tip. Choose points with integer coordinates whenever possible — they make the arithmetic cleaner.
Tip. The slope is the same between any two points on the line. Pick the easiest two.
What Is the Slope of Parallel Lines?
Two non-vertical lines are parallel if and only if they have equal slopes.
m1=m2
The reason is geometric: parallel lines have the same direction — they never meet — so the rise-per-run ratio is identical for both.
Worked example. The line y=3x+4 is parallel to y=3x−7. Both have slope 3. They tilt up at the same rate; only the y-intercept differs.
Worked example. Is the line through (1,2) and (4,11) parallel to y=3x+1?
Slope through the two points: m=\frac{11 - 2}{4 - 1} = \frac{9}{3} = 3.
Slope of y=3x+1: m=3.
Equal slopes ✓ — the lines are parallel.
Edge case. Two vertical lines (each with undefined slope) are parallel to each other — but the rule "equal slopes" can't be checked because the slope value doesn't exist. Treat parallel vertical lines as a separate case.
What Is the Slope of Perpendicular Lines?
Two non-vertical lines are perpendicular if and only if the product of their slopes is −1 — that is, their slopes are negative reciprocals of each other.
m1⋅m2=−1
Geometrically, rotating a line 90° flips its rise-and-run and inverts the ratio with a sign change — that's where the negative reciprocal comes from.
Worked example. A line has slope 2. The slope of any line perpendicular to it is −\frac{1}{2}. Check: 2×−\frac{1}{2}=−1 ✓.
Worked example. A line has slope −\frac{3}{4}. The slope of any line perpendicular to it is \frac{4}{3}. Check: −\frac{3}{4}×\frac{4}{3}=−1 ✓.
Worked example. Is the line y=\frac{1}{2}x+3 perpendicular to y=−2x+5?
m1=\frac{1}{2}, m2=−2. Product: \frac{1}{2}×(−2)=−1 ✓ — yes, perpendicular.
Why Does Slope Matter? (The Real-World GROUND)
The slope concept appears everywhere a rate is measured. Some examples:
Road grade. A road labeled "7% grade" has a slope of 0.07 — it rises 7 metres per 100 metres horizontal.
Wheelchair ramp standards. The Americans with Disabilities Act (ADA) specifies a maximum ramp slope of 1:12 (about m≈0.083). Steeper ramps are unsafe.
Speed and velocity. On a position-vs-time graph, the slope is the velocity. A horizontal line means stationary; a steep upward line means fast motion.
Linear regression. In statistics, the slope of the best-fit line tells you how much y changes per unit increase in x — the regression coefficient.
Skiing and roof pitch. A "double black diamond" ski run typically has a slope of tan(35°)≈0.7 or steeper.
The concept comes from René Descartes and Pierre de Fermat, who independently invented analytic geometry in the 1630s.
A Worked Example
Find the slope of the line through (−2,5) and (4,−7).
The intuitive (wrong) approach. A student mixes up the subtraction order:
m=?−7−5−2−4=−12−6=2
The answer is wrong.
The correct method.
m=\frac{y_2 - y_1}{x_2 - x_1} = \frac{-7 - 5}{4 - (-2)} = \frac{-12}{6} = -2
The slope is −2 — the line falls 2 units for every 1 unit right.
What Are the Most Common Mistakes With Slope?
Mistake 1: Flipping numerator and denominator order inconsistently
Where it slips in: Computing slope from two points with the wrong subtraction order.
The correct way: Pick one order — \frac{y_2 - y_1}{x_2 - x_1} — and stick with it on both.
Mistake 2: Calling a vertical line "zero slope"
Where it slips in: Confusing vertical (undefined) with horizontal (zero).
Mistake 3: Dividing rise/run as a decimal when fraction is exact
Where it slips in: Reporting m≈0.667 instead of m=\frac{2}{3}.
The Mathematicians Who Shaped Slope
René Descartes (1596–1650) — Invented analytic geometry in 1637. The concept of slope as a number depends entirely on his coordinate system.
Pierre de Fermat (1607–1665) — Independently developed analytic geometry around the same time as Descartes.
Isaac Newton (1643–1727) — Generalised the slope concept to curves via differential calculus.
A Practical Next Step
- Find the slope through (1,4) and (5,12).
- Find the slope through (−3,7) and (2,−3).
- Find the slope of y=6. Then find the slope of x=−2.
If problem 2 had a sign issue, return to the wrong-path-first example — consistent subtraction order is the trap.