What slope measures
Picture walking from left to right along a line. The slope answers one question: for every step sideways, how much do you go up or down? It is a ratio — a comparison of vertical change to horizontal change. We capture it with the phrase rise over run: rise is the vertical change, run is the horizontal change.
A positive slope rises as you move right; a negative slope falls. A bigger absolute value means a steeper line. We almost always call the slope m.
The slope formula from two points
Give me any two points on a line, (x1, y1) and (x2, y2), and I can compute the slope. The rise is the difference in the y-values; the run is the difference in the x-values, taken in the same order:
y2 - y1
m = ---------
x2 - x1
Example: line through (1, 2) and (4, 8)
8 - 2 6
m = ------- = ---- = 2
4 - 1 3
Check by swapping the order of the points:
2 - 8 -6
m = ------- = ---- = 2 same answer
1 - 4 -3Zero slope and undefined slope
Two special lines push the formula to its edges. A horizontal line never rises, so the rise is 0 and the slope is 0. A vertical line never runs, so the run is 0 — and dividing by zero is undefined, so a vertical line has no slope at all (we say the slope is undefined, not zero).
Horizontal line through (1, 3) and (5, 3):
3 - 3 0
m = ------- = ---- = 0 slope is 0
5 - 1 4
Vertical line through (2, 1) and (2, 7):
7 - 1 6
m = ------- = ---- -> divide by 0
2 - 2 0 slope UNDEFINED