distance in n-dimensional space

1.4k Views Asked by At

According to answer of this question :

Distance between 2 points in 3D space (in spherical polar coordinates)

The distance between 2 points in 3 dimensional space is :

$$ \sqrt{r_1^2+r_2^2-2r_1r_2\left(\cos\theta_1\cos\theta_2\cos(\phi_1-\phi_2)+\sin\theta_1\sin\theta_2\right)}$$

My question is how does this formula generalized in n dimensional space ?

The Wikipedia page for n sphare gives the transformation of x(1...n) values to their

spherical coordinates but doesn't mention the distance function for 2 points.

Can any one generalize the above equation for n-D space calculation ?

And of course i know the Euclidean distance function between 2 points (a,b) that is :

$$ \sqrt{(a_1-b_1)^2+(a_2-b_2)^2+...+(a_n-b_n)^2}$$

But i want a distance function in form of cosinus and sinuous.

Any help would be appreciated !