# How generate n equidistant points in a n-1 dimensional space

As said, i want to build a program to generate n equidistant points in an euclidian space. From what i know

• 1d : all couple of points
• 2d : all equilateral triangles
• 3d : all equilateral tetrahedra
• up to 3d : i suppose it's called an equilateral hypertriangle

So my problem is as follow, in a n-1 euclidian space, giving a defined point build the n-1 other in order to have an equilateral hypertriangle with a distant d between each points.

I suppose that we can start as follow with for example a 3d space.

• p1 = (x1,y1,z1) fixed
• p2 = (x2,y2,z2)
• p3 = (x3,y3,z3)
• p4 = (x4,y4,z4)
• d

We start to fix p2 knowing d and p1

• $d²=(x_1-x_2)^2 + (y_1-y_2)^2 + (z_1-z_2)^2$

We have 3 variables x2,y2,z2. We can fix randomly two of them and determine the third without problem.

Then for the second point we have now 2 equations to defined it :

• $d²=(x_1-x_3)^2 + (y_1-y_3)^2 + (z_1-z_3)^2$
• $d²=(x_2-x_3)^2 + (y_2-y_3)^2 + (z_2-z_3)^2$

As previous, i presume that we can fix 2 variables to determine the third.

For the last point we now have 3 equations which defined it.

So for a n-1 dimensional space we have n-1 equation to defined the last point.

I don't know how to solve this kind of system composed of quadratic equation with one variable and if the process which consist to fix n-1 dimension to determine the last one lead to an equidistant hypertriangle. Moreover it exist maybe others methods with an smaller complexity and easier to implement.

I hope i was clear enough and i thank you for your help.

I assume we are working in $\mathbb{R}^n$.

First of all, observe that one regular $n-$simplex effectively determines all the others. In fact, if $S_1, S_2$ are two sets of points in $\mathbb{R}^n$ that satisfy the regularity condition, then they can be obtained from each other by composing at most an isometry and an homothetic transformation of the affine space (the converse is also true).

Therefore, it is sufficient to construct an unitary $n-$simplex centered in the origin. We visualize each vertex of the simplex $v_1, v_2, \dots v_{n+1}$ as an element of the real $n$-dimensional vector space.

Consider two vertices $v_1, v_2$ of the simplex, let $O$ be the origin and $\pi$ be the plane passing through $v_1, v_2, O$. The angle $\vartheta =\angle v_1 O v_2$ is exactly $\arccos (-1/n)$. To prove that, we observe that:

$$0 = \left \| \sum_{i} v_i \right \|^2 = (n+1) + 2 \cos\vartheta \binom{n+1}{2}$$

We deduce that the following hold:

• $\forall i \quad \| v_i \| = 1$

• $\forall i \neq j \quad \left \langle v_i, v_j\right \rangle = -1/n$

We may assume without loss of generality that $v_1, v_2$ lie on the same line, that $v_3$ lies on the same plane as the others and so on (in general, that for each $k$, $v_1, v_2, \dots v_k$ lie on the same subspace of $\mathbb{R}^n$ with dimension $k$). Therefore, we may write the vectors by coordinates as follows:

$$\begin{array}{r c l} \begin{array}{r} v_1 \\ v_2 \\ \cdots \\ v_{n+1} \end{array} & \begin{array}{r} = \\ = \\ \\ = \end{array} & \begin{array}{c c c c c c} (x_{1,1} & 0 & 0 & 0 & \dots & 0)^T \\ (x_{2,1} & x_{2,2} & 0 & 0 & \dots & 0)^T \\ \\ (x_{n+1, 1} & x_{n+1, 2} & x_{n+1, 3} & x_{n+1, 4} & \dots & x_{n+1, n+1})^T \\ \end{array} \end{array}$$

The first equation uniquely determines $x_{1,1}$ and the second all the $x_{m,1}$. Now we use again the first to compute $x_{2,2}$ and with the second we determine all the remaining $x_{2, m}$.

Continuing the procedure in a similar fashion computes the coordinate values of all the vertices.

• Thank you, despite the well formed theorical stuff you share with us i don't success to figure out how to determine the $x_{2,1}, x_{2,2},...$, presuming that $x_{1,1}$ is defined by user. Can you please explain it in another way ?
– KyBe
Jan 30, 2017 at 6:02
• v[n+1] should have n dimensions not n+1 like in the last equation; the v[n+1] should be computed from v+v+...+v[n]+v[n+1]=0 Apr 4, 2019 at 13:51

You can make n-1 equidistant points by using the unit vectors along each of the axis aka. (1, 0, 0, 0, ..., 0); (0, 1, 0, 0, ..., 0); (0, 0, 1, 0, ..., 0); etc., The last nth point will be along the 1, 1, 1, ..., 1 direction.

Then you can use a scale to set the distance between the points from $\sqrt 2$ to $d$ and a translate to move one of the points to the fixed point

• Nice -- I think you can actually write a closed-form solution with this approach! Jan 29, 2017 at 3:47
• [later] For the last point, you can use either $\left( \frac{1 - \sqrt n}{n - 1} , \frac{1 - \sqrt n}{n - 1} , \dots , \frac{1 - \sqrt n}{n - 1} \right)$ or $\left( \frac{1 + \sqrt n}{n - 1} , \frac{1 + \sqrt n}{n - 1} , \dots , \frac{1 + \sqrt n}{n - 1} \right)$. Jan 29, 2017 at 3:57
• Thank you, but I'm not sure to well understand what you proposed by "using the unit vector along each of the axis", can you reformulate please.
– KyBe
Jan 30, 2017 at 5:57
• @KyBe I added a few examples. Jan 30, 2017 at 8:53
• From where did you find your expression of the last point (which is the nth in a n-1 d-space) @ruakh ? It's interesting but i don't success to figure out how to get it.
– KyBe
Jan 31, 2017 at 8:14