# How is the distance formula proven for anything greater than 3 dimensions?

I was able to follow a proof of the distance formula ( That is the distance between any two points. This is what I mean by "distance formula". ) as it applies to 3 dimensions and naturally it involves the Pythagorean theorem and is very intuitive from that point since you can see the proof of the Pythagorean theorem with a 3 dimensional representation of area. But the thought occurred to me in what manner is this done when n >3? Perhaps by induction in some way? Since you can't visualize a 4th spatial dimension in order to prove anything about it. The answer may be it is not done in 4 or greater dimensions and I would understand.

• Learning to visualize things in higher dimensions is a skill which takes time. As you learn math, you will learn which kinds of things you can hand wave away, and which you can't in any given situation. It's not uncommon for my instructors to draw 4D things just by drawing a square and saying each line of the square is a 2D space! Also, if you practice, you will find you will be able to visualize relationships in $\mathbb{R}^4$. – Alfred Yerger Apr 5 '17 at 1:05

The distance formula can be handled inductively. I'll show you how to go from 2D to 3D because it is easier to visualize, but the same trick will work to go from any dimension up to the next.

Suppose you have two points in 3D space. Let's assume without loss of any generality (since you can just translate) that one of these points is in the $xy$ plane. Let's call the points $p_1 = (x_1, y_1, 0)$ and $p_2 = (x_2, y_2, z)$. The first thing we will do is project $p_2$ down into the $xy$ plane, where we can work out it's distance. We will do this projection orthogonally. This is important. It means that the line we project down along makes a right angle with the $xy$ plane. We end up with a point $q = (x_2, y_2, 0)$. Now we have the distance $d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$ between $p_1$ and $q$.

Now since we projected orthogonally, we can make a right triangle with base the diagonal line connecting $p_1$ and $q$, and height going from $q$ to $p_2$. Then we can use the distance formula in the plane spanned by these two vectors just like before.

We have $D = \sqrt{\sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}^2 + (z-0)^2} = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2 + z^2}$.

In general, if you do not want to assume that one point lies in the plane, the last term will become $(z_2 - z_1)^2$. Then you can keep doing this to get to any dimension!

I should probably say a few more words about how to go up again, since you seem to actually already know everything I just said.

What's important is that at every step, the you have a line connecting two points who's length you know how to find. Then you have a height you know. The key is that at each step, you only care about the plane containing these two vectors, and not the rest of the space. When you go from 3D to 4D, you will have a 3D distance you know how to find, and a point 'sitting over' just like in the example I just gave. You can project down to 3D, and find the 'height' you have to go from 3D into the new dimension, and then you can just use the distance formula in the plane spanned by these two vectors.

If you're not familiar with the concept of span, it's a topic in linear algebra. It basically means 'the set of all stuff you can hit with these guys.' So the span of a vector is a line. The span of 2 vectors is a plane (if they are really different vectors and one is not a stretching of the other), and a span of 3 vectors is a 3D space, and so on.

Since these two vectors are always going to point in different directions, you'll always be able to use the distance formula that you know in the plane they span, so you can keep getting longer and longer formulae for higher and higher dimensions. They always look like $\sqrt{\sum_{i = 0}^n (x_{i,1} - x_{i,2})^2}$ where $n$ is the dimension and $i$ tells you which dimension you're in at each step of the sum.

Let $x=(x_1,...,x_n)$ and $y=(y_1,...,y_n)$.

$$\text { We have }\quad \|x+y\|\leq \|x\|+\|y\|\iff \|x+y\|^2\leq (\|x\|+\|y\|)^2\iff$$ $$\iff \sum_i(x_i+y_i)^2\leq \sum_jx_j^2+\sum_ky_k^2+2\|x\|\cdot \|y\|\iff$$ $$\iff 2\sum_ix_iy_i\leq 2\|x\|\cdot \|y\|.$$ For this last inequality to hold, it suffices that $|\sum_jx_jy_j|\leq \|x\|\cdot \|y\|,$ which is equivalent to $$0\leq -(\sum_ix_iy_i)^2+ \|x\|^2\|y\|^2=-(\sum_ix_iy_i)^2+(\sum_jx_j^2) (\sum_ky_k^2).$$ The RHS above is equal to $\sum_{j<k}(x_jy_k-x_ky_j)^2$ which is $\geq 0.$