# What is the distance between  (2, 3, 5)  and  (2, 7, 4) ?

Mar 13, 2016

$\sqrt{17} \approx 4.123$

#### Explanation:

The distance between $\left({x}_{1} , {y}_{1} , {z}_{1}\right)$ and $\left({x}_{2} , {y}_{2} , {z}_{2}\right)$ is given by the formula:

$d = \sqrt{{\left({x}_{2} - {x}_{1}\right)}^{2} + {\left({y}_{2} - {y}_{1}\right)}^{2} + {\left({z}_{2} - {z}_{1}\right)}^{2}}$

So in our case:

$d = \sqrt{{\left(2 - 2\right)}^{2} + {\left(7 - 3\right)}^{2} + {\left(4 - 5\right)}^{2}}$

$= \sqrt{0 + 16 + 1} = \sqrt{17} \approx 4.123$

Distance formula for $3$ dimensions

Here's how to derive the distance formula for $3$ dimensions from Pythagoras theorem:

Given points $\left({x}_{1} , {y}_{1} , {z}_{1}\right)$ and $\left({x}_{2} , {y}_{2} , {z}_{2}\right)$, consider the triangle with vertices:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right)$, $\left({x}_{2} , {y}_{1} , {z}_{1}\right)$, $\left({x}_{2} , {y}_{2} , {z}_{1}\right)$

This is a right angled triangle with legs:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right) \left({x}_{2} , {y}_{1} , {z}_{1}\right)$ of length $\left\mid {x}_{2} - {x}_{1} \right\mid$

$\left({x}_{2} , {y}_{1} , {z}_{1}\right) \left({x}_{2} , {y}_{2} , {z}_{1}\right)$ of length $\left\mid {y}_{2} - {y}_{1} \right\mid$

and hypotenuse:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right) \left({x}_{2} , {y}_{2} , {z}_{1}\right)$ of length $\sqrt{{\left({x}_{2} - {x}_{1}\right)}^{2} + {\left({y}_{2} - {y}_{1}\right)}^{2}}$

Next consider the triangle with vertices:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right)$, $\left({x}_{2} , {y}_{2} , {z}_{1}\right)$, $\left({x}_{2} , {y}_{2} , {z}_{2}\right)$

This is a right angled triangle with legs:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right) \left({x}_{2} , {y}_{2} , {z}_{1}\right)$ of length $\sqrt{{\left({x}_{2} - {x}_{1}\right)}^{2} + {\left({y}_{2} - {y}_{1}\right)}^{2}}$

$\left({x}_{2} , {y}_{2} , {z}_{1}\right) \left({x}_{2} , {y}_{2} , {z}_{2}\right)$ of length $\left\mid {z}_{2} - {z}_{1} \right\mid$

and hypotenuse:

$\left({x}_{1} , {y}_{1} , {z}_{1}\right) \left({x}_{1} , {y}_{2} , {z}_{2}\right)$ of length:

$\sqrt{{\left(\sqrt{{\left({x}_{2} - {x}_{1}\right)}^{2} + {\left({y}_{2} - {y}_{1}\right)}^{2}}\right)}^{2} + {\left({z}_{2} - {z}_{1}\right)}^{2}}$

$= \sqrt{{\left({x}_{2} - {x}_{1}\right)}^{2} + {\left({y}_{2} - {y}_{1}\right)}^{2} + {\left({z}_{2} - {z}_{1}\right)}^{2}}$