# Distance Formula

## Theorem

The distance $d$ between two points $A = \tuple {x_1, y_1}$ and $B = \tuple {x_2, y_2}$ on a Cartesian plane is:

$d = \sqrt {\paren {x_1 - x_2}^2 + \paren {y_1 - y_2}^2}$

### 3 Dimensions

The distance $d$ between two points $A = \tuple {x_1, y_1, z_1}$ and $B = \tuple {x_2, y_2, z_2}$ in a Cartesian space of 3 dimensions is:

$d = \sqrt {\paren {x_1 - x_2}^2 + \paren {y_1 - y_2}^2 + \paren {z_1 - z_2}^2}$

## Proof

The distance in the horizontal direction between $A$ and $B$ is given by $\size {x_1 - x_2}$.

The distance in the vertical direction between $A$ and $B$ is given by $\size {y_1 - y_2}$.

By definition, the angle between a horizontal and a vertical line is a right angle.

So when we place a point $C = \tuple {x_1, y_2}$, $\triangle ABC$ is a right triangle.

Thus, by Pythagoras's Theorem:

$d^2 = \size {x_1 - x_2}^2 + \size {y_1 - y_2}^2$

and the result follows.

$\blacksquare$