Let S(P,Q) be the square of the distance between point number P and point number Q, all of which are known. In N dimensions (where N is the unknown to be found):
S(P,Q) = sum(i=1 to N) ( x(P,i) - x(Q,i) )^2
where x(P,i) is the coordinate value of point P along axis i in some orthogonal coordinate system.
Choose point 1 as the origin of the coordinate system. Since x(1,i) is zero for all i, S(1,P) = sum(i=1 to N) x(P,i)^2
Select a point number M, having a non-zero S(1,M). The line through point 1 and point M will be taken as the first axis in the orthogonal coordinate system. The x(P,1) of all the points can be found from x(M,1)=sqrt(S(1,M)) being non-zero while the x(M,i) for i>1 are all zero:
S(M,P) = ( x(M,1) - x(P,1) )^2 + sum(i = 2 to N) x(P,i)^2
= x(M,1)^2 - 2*x(M,1)x(P,1) + x(P,1)^2 + sum(i = 2 to N) x(P,i)^2
= S(1,M) - 2sqrt(S(1,M))x(P,1) + S(1,P)
which gives:
x(P,1) = ( S(1,M) + S(1,P) - S(M,P) ) / ( 2sqrt(S(M,1) )
With all the x(P,1) now found, subtract (x(P,1)-x(Q,1))^2 from each S(P,Q) to give updated values for distance squared in N-1 dimensions:
S’(P,Q) = S(P,Q) - (x(P,1)-x(Q,1))^2
Now this is like the original problem except N-1 dimensions. Keep repeating until all the S’(P,Q) are zero, i.e. unable to choose a point M in the steps above. The number of times this needs to be done in order to zero out the S’(P,Q) is N.