# Distance

Distance is defined to be the magnitude or size of displacement between two positions.

Note that the distance between the two positions is not the same as the distance traveled between them. Distance traveled is the total length of the path traveled between two positions.

Although displacement is described in terms of direction, distance is not. Distance has no direction and, thus, no sign.

It is important to note that the distance traveled, however, can be greater than the magnitude of the displacement (by magnitude, we mean just the size of the displacement without regard to its direction; that is, just a number with a unit).

## The distance formula

Given endpoints $$P_1=(x_1,y_1)$$ and $$P_2=(x_2,y_2)$$, the distance between two points is given by:

$d(P_1,P_2)=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$

Similarly, the distance between two points $$P_1=(x_1,y_1,z_1)$$ and $$P_2=(x_2,y_2,z_2)$$ in xyz-space is given by the following generalization of the distance formula:

$d(P_1,P_2)=\sqrt{(x_2-x_1)^2+(y_2-y_1)^2+(z_2-z_1)^2}$