Counting rise and run works on a grid. With coordinates you can compute them instead, using signed-number arithmetic in place of counting from a graph.
Why it works
The rise from point 1 to point 2 is the change in $y$: $y_2 - y_1$. The run is the change in $x$: $x_2 - x_1$. That gives the formula below. Which point you call “point 1” does not matter: swapping them flips the sign of both the top and the bottom, and the two signs cancel.
Key idea
For any two points $(x_1, y_1)$ and $(x_2, y_2)$ with $x_1 \ne x_2$: $$m = \frac{y_2 - y_1}{x_2 - x_1}$$ Subtract in the same order on the top and the bottom.
Worked examples
Worked example: Plug in
Find the slope through $(2, 1)$ and $(6, 9)$.
- $m = \dfrac{9 - 1}{6 - 2} = \dfrac{8}{4}$.
Answer: $2$
Worked example: With negatives
Find the slope through $(-3, 4)$ and $(3, -2)$.
- $m = \dfrac{-2 - 4}{3 - (-3)} = \dfrac{-6}{6}$.
- $m = -1$.
Answer: $-1$
Worked example: Flat and upright lines
Find the slopes through $(1, 5)$ and $(7, 5)$, and through $(4, -2)$ and $(4, 3)$.
- First pair: $m = \frac{5 - 5}{7 - 1} = \frac{0}{6} = 0$. A horizontal line has slope 0.
- Second pair: the run is $4 - 4 = 0$, and dividing by 0 is not possible. A vertical line has no slope; we say its slope is undefined.
Answer: $0$, and undefined
Common mistake
Subtracting in different orders on top and bottom, which flips the sign. For $(2, 1)$ and $(6, 9)$: $\frac{9 - 1}{2 - 6} = -2$ is wrong. Keep the same order: $\frac{9 - 1}{6 - 2} = 2$. Check: the line rises from left to right, so the slope must be positive.