You can find the distance between points that share a coordinate by subtracting. For any two points, add the Pythagorean theorem.
Why it works
From $A$, go straight across to the point below or above $B$, then straight up or down to $B$. Those two moves are the legs of a right triangle, and their lengths are the difference in $x$ and the difference in $y$. The straight path from $A$ to $B$ is the hypotenuse.
Key idea
To find the distance between $(x_1, y_1)$ and $(x_2, y_2)$: the legs are $|x_2 - x_1|$ and $|y_2 - y_1|$, so $$d = \sqrt{(x_2 - x_1)^{2} + (y_2 - y_1)^{2}}$$
Worked examples
Worked example: A 3-4-5 triangle
Find the distance from $A(1, 1)$ to $B(5, 4)$.
- Across: $5 - 1 = 4$. Up: $4 - 1 = 3$.
- $d^{2} = 4^{2} + 3^{2} = 25$, so $d = 5$.
Answer: $5$
Worked example: With negatives
Find the distance from $(-2, 3)$ to $(4, -5)$.
- Across: $4 - (-2) = 6$. Down: $-5 - 3 = -8$, a length of 8.
- $d^{2} = 6^{2} + 8^{2} = 100$, so $d = 10$.
Answer: $10$
Worked example: A root
Find the distance from $(0, 0)$ to $(2, 5)$.
- Legs 2 and 5: $d^{2} = 4 + 25 = 29$.
- $d = \sqrt{29}$, which is between 5 and 6, about 5.4.
Answer: $\sqrt{29} \approx 5.4$
Common mistake
Adding the legs instead of using the theorem: from $(1, 1)$ to $(5, 4)$ is not $4 + 3 = 7$. Walking along the grid lines is 7; the straight path is shorter, 5. Also, a negative difference is fine: squaring it makes it positive.