Imagine I want to determine the distance between points 0,0,0 and 1,2,3.

How is this calculated?

  • 1
    $\begingroup$ How would you do it in two dimensions? $\endgroup$
    – JavaMan
    Commented Jun 1, 2011 at 20:00
  • $\begingroup$ No idea. For some reason they don't learn us that at school… $\endgroup$ Commented Jun 1, 2011 at 20:12

4 Answers 4


By using the the Pythagorean theorem twice, you can show that $d((0,0,0),(1,2,3))=\sqrt{\left(\sqrt{1^2+2^2}\right)^2+3^2}=\sqrt{1^2+2^2+3^2}$.

In general, if you have two points $(x_1, \ldots, x_n)$ and $(y_1, \ldots, y_n)$ in $\mathbb{R}^n$, you can use the Pythagorean theorem $n-1$ times to show that the distance between them is $$\sqrt{\displaystyle\sum_{i=1}^n (x_i -y_i)^2}$$

  • $\begingroup$ How can we prove the last formula? I find it difficult to imagine a n-dimensional space geometrically when $n > 3$... $\endgroup$ Commented Apr 19, 2018 at 10:30
  • 2
    $\begingroup$ @user3019105 We use induction, together with the fact that all the coordinate axes are orthogonal to each other. So the way the z-axis is orthogonal to the xy-plane (and hence to any line that has constant z-coordinate) generalizes. Or rather, that is how we define the geometry of higher dimensional space. $\endgroup$
    – Aaron
    Commented Apr 19, 2018 at 15:31
  • $\begingroup$ Thank you, where can I find some theory and examples about this topic? $\endgroup$ Commented Apr 19, 2018 at 20:55
  • $\begingroup$ @user3019105 unfortunately, I don't know any references that talk about this in elementary terms, explaining why things are like they are. This is a basic example of a metric space (the Euclidean metric), and the metric is induced by a norm ($\ell^2$ norm), and that norm comes from an inner product, so this is an example in a lot of places, and I can give you references for generalizations, but I don't think they are what you are looking for. $\endgroup$
    – Aaron
    Commented Apr 19, 2018 at 21:30
  • 1
    $\begingroup$ A starting point might be this article on Wikipedia. $\endgroup$
    – Aaron
    Commented Apr 19, 2018 at 21:37

Here is an illustration:

3d Pythagorean theorem illustration

You want to find $d$, where $d^2 = h^2 + z^2$, and $h^2 = x^2 + y^2$. So

$d^2 = (x^2 + y^2) + z^2$, and therefore $d = \sqrt{x^2 + y^2 + z^2}$


It's Pythagorean theorem, just like with 2D space.

$||[0, 0, 0]-[1, 2, 3]|| = \sqrt{(0-1)^2+(0-2)^2+(0-3)^2} = \sqrt{1+4+9} = \sqrt{14}$


The distance between two points in three dimensions is given by:
Given two points: point $a = (x_0, y_0, z_0)$; point $b = (x_1, y_1, z_1)$
The distance is (in units):
$$d = \sqrt{(x_1-x_0)^2 + (y_1-y_0)^2 + (z_1 - z_0)^2}$$
For your given points: point $a = (0,0,0)$; point $b = (1,2,3)$
Using substitution:
$$d = \sqrt{(1-0)^2+(2-0)^2+(3-0)^2}$$
$$d = \sqrt{(1 + 4 + 9)}$$
$$d = \sqrt{(14)}$$
$$d = 3.7$$
Note: if one point, point a, is the origin $$(0,0,0)$$ then the equation reduces to d = $\sqrt{(x^2 + y^2 + z^2)}$

  • $\begingroup$ For some basic information about writing math at this site see e.g. here, here, here and here. $\endgroup$
    – user109879
    Commented Dec 15, 2014 at 20:40
  • 1
    $\begingroup$ Does d equal exactly 3.7? I get 3.7416573867739413 doing the calculation in Python. $\endgroup$ Commented Feb 9, 2015 at 7:15
  • $\begingroup$ Thanks, this is by far the clearest answer for us non-mathematicians. I needed that extra bit of hand holding. $\endgroup$
    – Felix Eve
    Commented Nov 23, 2018 at 15:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .