Slope of a Line
You already know steepness. Your legs know it on a hill; your ears know it when a car
engine strains; your stomach knows it at the top of a ski run. But "steep" is a feeling,
and feelings are hard to compare. Is the hill by your school steeper than the one by the
park? Steeper by how much? Engineers, road builders and — soon — all of calculus
need steepness as a number.
The number already surrounds you. That triangular road sign that says
10% grade? It means the road climbs 10 metres
for every 100 metres you travel horizontally — a steepness of
10/100 = 0.1. Wheelchair-ramp regulations say a ramp may rise at
most 1 unit for every 12 along the
ground — a steepness of 1/12 \approx 0.083. Ski resorts rate
their runs the same way: a serious black run can pass 40\%. In
every case the recipe is identical: how much does it go up, per unit you go across?
That recipe is the slope. In the last lesson, the number
m in a
linear function
set how steeply the line tilts. Here is its precise meaning:
\text{slope} = \frac{\text{rise}}{\text{run}}.
The rise is the change in height (up is positive, down is negative), and
the run is the change across (to the right is positive). A steeper line
packs more rise into the same run, so it gets a bigger slope. A slope of
2 means: every step right, climb two. A slope of
\tfrac{1}{2} means: every step right, climb half. A slope of
-3 means: every step right, drop three. One number, and
"steep" stops being a feeling.
Rise over run between two points
A line is made of points, so let's compute the slope from them. Pick any two points on the
line, (x_1, y_1) and (x_2, y_2). The
rise is the difference in their y-values — how far you climbed —
and the run is the difference in their x-values — how far you
travelled across:
m = \frac{\text{rise}}{\text{run}} = \frac{y_2 - y_1}{x_2 - x_1}.
Mathematicians often write the two differences with the Greek letter delta —
\Delta y ("change in y") and
\Delta x ("change in x") — so you
will also see the formula as m = \Delta y / \Delta x. Same
recipe, shorter clothes. Get comfortable with the \Delta
notation now: calculus wears it constantly.
-
For any two points (x_1, y_1) and
(x_2, y_2) on a non-vertical line, the slope is
m = \dfrac{y_2 - y_1}{x_2 - x_1} = \dfrac{\Delta y}{\Delta x}.
-
The value of m is the same for every choice
of two distinct points on the line — slope is a property of the line, not of the points
you happened to pick.
-
A horizontal line has m = 0; a vertical line has
no slope (the formula would divide by zero).
Try it live. Move the two points below with the sliders. The dashed legs draw the
slope triangle — run across, then rise up — and the slope is read off as
their ratio. Two things to hunt for: first, slide both points along the same line
(say, double both coordinates' changes) and watch the slope refuse to budge — a bigger
triangle, but the same ratio, which is exactly why slope belongs to the whole line.
Second, drag the points until the run hits zero and watch the readout give up: that is the
vertical line, and we will deal with it honestly below.
The \Delta y / \Delta x ritual
Computing a slope is a four-step ritual worth making automatic. Label one point
(x_1, y_1) and the other (x_2, y_2)
(either way round — truly, either); subtract the y's; subtract
the x's in the same order; divide.
Example 1 — uphill. Through (1, 2) and
(4, 8):
m = \frac{\Delta y}{\Delta x} = \frac{8 - 2}{4 - 1} = \frac{6}{3} = 2.
For every 1 step right, the line climbs
2. Now the sanity check, which you should run
every single time: sketch (or imagine) the two points. Going left-to-right, from
(1,2) to (4,8), the line goes
up — so the slope had better be positive. It is. Move on.
Example 2 — downhill (the sign matters). Through
(2, 7) and (6, -1):
m = \frac{-1 - 7}{6 - 2} = \frac{-8}{4} = -2.
Sanity check: left-to-right, the height falls from 7 down to
-1 — downhill — so the slope must be negative.
-2 passes. If your arithmetic had produced
+2, the picture would have caught the error before anyone else
did. This one-second check is the cheapest insurance in mathematics.
Example 3 — the order really doesn't matter. Redo Example 2 with the
points labelled the other way round, (x_1,y_1) = (6,-1) and
(x_2,y_2) = (2,7):
m = \frac{7 - (-1)}{2 - 6} = \frac{8}{-4} = -2.
Both the top and the bottom flipped sign, and the two flips cancelled. Same slope. The only
rule is consistency: whichever point donates its y
first must also donate its x first.
The four personalities of slope
Every line on Earth has one of exactly four personalities, and the slope formula diagnoses
each. Let's compute all four from real coordinates rather than take them on faith.
-
Positive — uphill. Through (0, 1) and
(3, 7): m = \frac{7-1}{3-0} = \frac{6}{3} = 2.
Left to right, the line climbs.
-
Negative — downhill. Through (-1, 4) and
(3, -4): m = \frac{-4-4}{3-(-1)} = \frac{-8}{4} = -2.
Left to right, the line falls.
-
Zero — flat. Through (-2, 3) and
(5, 3): m = \frac{3-3}{5-(-2)} = \frac{0}{7} = 0.
The rise is zero, and zero divided by anything (non-zero) is zero. A perfectly legal,
perfectly boring slope: the horizontal line.
-
Undefined — vertical. Through (4, -1) and
(4, 6): m = \frac{6-(-1)}{4-4} = \frac{7}{0} —
and there the ritual halts, because dividing by zero is not allowed. A vertical line has
no slope. Not a huge slope. No slope at all.
Notice the two special cases are opposites in an important way: the flat line's slope
exists and equals zero; the vertical line's slope does not exist. Flip
through all four below and watch the line's character change.
Two mistakes catch nearly everyone who meets slope:
-
Mixing the subtraction order. The formula is
\frac{y_2 - y_1}{x_2 - x_1} — subtract in the same order
on top and bottom. Flip both (use \frac{y_1 - y_2}{x_1 - x_2})
and the two sign changes cancel: same answer, no harm done. But flip only one —
say \frac{y_2 - y_1}{x_1 - x_2} — and exactly one sign change
survives, so your slope comes out with the wrong sign: an uphill line
reported as downhill. This is the single most common slope error, and it is precisely
what the "does the sign match the picture?" sanity check exists to catch.
-
Calling a vertical line's slope "infinite" — or confusing it with zero.
A vertical line's slope is undefined: the formula demands
\tfrac{7}{0}, and division by zero has no value — not even
"infinity" (climbing from below, the ratio blows up toward +\infty;
descending, toward -\infty; no single number can be the answer).
And keep the two special cases apart: zero slope is a real, finite answer — the
flat line, going nowhere — while undefined slope is the formula refusing to
answer at all. Flat is a slope of nothing; vertical is no slope, full stop.
Grades, ramps, and a hint of angles
Back to the road sign, because it turns out road engineers speak fluent slope. A
grade (or gradient) is just a slope dressed up as a percentage:
\text{grade} = \text{slope} \times 100\%.
So the conversion runs both ways with nothing but a factor of
100. Take a sign warning of an 8% grade: as a
slope, that is
m = \frac{8}{100} = 0.08,
meaning the road drops (or climbs) 8 metres over every
100 horizontal metres — about the height of a two-storey house
every city block. If you're curious about the tilt as an angle: a slope of
0.08 corresponds to roughly 4.6^\circ
from horizontal (the exact link between slope and angle goes through the tangent function
from trigonometry — we only mention it here; nothing on this page needs it). Notice how
small that angle is: an 8% grade already gets trucks onto their brakes and warning signs
onto the roadside, yet it's barely a twentieth of a right angle. Real-world "steep" is
gentler than your eyes think.
The wheelchair-ramp rule reads naturally now too. The standard limit of
1 : 12 — one unit of rise per twelve of run — is the requirement
m \le \tfrac{1}{12} \approx 0.083, a grade of about
8.3\%. That single number is the difference between a ramp
someone can roll up unaided and a ramp that is effectively a wall. Slope isn't decoration
on a graph; people legislate with it.
Baldwin Street in Dunedin, New Zealand, holds the Guinness record for the world's steepest
residential street: at its sharpest stretch it climbs about 1
metre for every 2.86 metres of run — a grade of roughly
35%, a slope of 0.35, around
19^\circ. (A street in Wales, Ffordd Pen Llech, briefly stole
the title in 2019 until surveyors re-measured — the record turns on exactly how you
define the slope, which tells you how seriously the world takes this number.) Residents'
letterboxes stand at the roadside like normal, but the houses behind them are practically
stacked; every year runners race up it, and the concrete surface exists because asphalt
would slowly creep downhill on a tilt like that.
For scale: an ordinary car in first gear manages a 30–35% grade before its wheels or clutch
give up, which is why Baldwin Street sits right at the edge of drivable. Adhesion railways —
ordinary steel wheels on steel rails — surrender far earlier, around a 4% grade
(slope 0.04!), which is why mountain trains need racks and cogs.
And your legs? Stairs are typically a slope of about 0.6 to
0.8 — far "steeper" than any road — because legs, unlike wheels,
don't rely on friction alone. Once steepness is a number, you can rank the whole world with
it.
Why calculus cares so much
Here is the confession this page has been building to: slope is the single idea calculus
could not live without. A line has one great virtue — its steepness is the same
everywhere, so one number describes it completely. But most curves aren't lines. A
thrown ball's path, a growing population, your speed on a bike ride — their graphs bend,
and a bending curve is steep in one place and gentle in another.
Calculus's opening move is to zoom in. Look at a tiny piece of a smooth curve under a
microscope and it looks almost straight — zoom further and "almost" becomes "as straight as
you please." The derivative, the idea this whole chapter is marching toward, is
nothing more than the slope of that microscopic piece: rise over run, computed at a single
point of a curve, with the help of the
limit idea.
Every derivative you will ever compute is this page's formula wearing a magnifying glass.
Master \Delta y / \Delta x now and you have already done the
hard part.
For a second telling in a second voice, Khan Academy introduces slope here: