1 Introduction and Our Results

For a positive integer d, we denote the d-dimensional Euclidean space by \(\mathbb {R}^d\). A set V of (distinct) points in \(\mathbb {R}^d\) is called almost equidistant if among any three of them, some pair is at distance 1. Let f(d) be the maximum size of an almost-equidistant set in \(\mathbb {R}^d\). For example, the vertex set of the well-known Moser spindle (Fig. 1) is an almost-equidistant set of 7 points in the plane and thus \(f(2) \ge 7\).

In this paper we study the growth rate of the function f. We first consider the case when the dimension d is small and give some almost tight estimates on f(d) for \(d \le 9\). Then we turn to higher dimensions and show \(2d+4 \le f(d) \le O(d^{3/2})\). We also discuss some possible generalisations of the problem.

Fig. 1
figure 1

The Moser spindle

1.1 Our Results in Low Dimensions

It is trivial that \(f(1)=4\) and that, up to congruence, there is a unique almost-equidistant set on 4 points in \(\mathbb {R}\). Bezdek, Naszódi, and Visy [5] showed that an almost-equidistant set in the plane has at most 7 points. Talata (personal communication) showed in 2007 that there is a unique extremal set. We give a simple, computer-assisted proof of this result.

Theorem 1

(Talata, 2007) The largest number of points in an almost-equidistant set in \(\mathbb {R}^2\)is 7, that is, \(f(2)=7\). Moreover, up to congruence, there is only one planar almost-equidistant set with 7 points, namely the Moser spindle.

Fig. 2
figure 2

An almost-equidistant set in \(\mathbb {R}^3\) made of two biaugmented tetrahedra

Figure 2 shows an example of an almost-equidistant set of 10 points in \(\mathbb {R}^3\). It is made by taking a so-called biaugmented tetrahedron, which is a non-convex polytope formed by gluing three unit tetrahedra together at faces, and rotating a copy of it along the axis through the two simple vertices so that two additional unit-distance edges are created. This unit-distance graph is used in a paper of Nechushtan [19] to show that the chromatic number of \(\mathbb {R}^3\) is at least 6. Györey [13] showed, by an elaborate case analysis, that this is the unique largest almost-equidistant set in dimension 3. We again give an independent, computer-assisted proof.

Theorem 2

(Györey [13]) The largest number of points in an almost-equidistant set in \(\mathbb {R}^3\)is 10, that is, \(f(3)=10\). Moreover, up to congruence, there is only one almost-equidistant set in\(\mathbb {R}^3\)with 10 points.

In dimension 4, we have only been able to obtain the following bounds.

Theorem 3

The largest number of points in an almost-equidistant set in\(\mathbb {R}^4\)is either 12 or 13, that is,\(f(4) \in \{12,13\}\).

The lower bound comes from a generalization of the example in Fig. 2; see also Theorem 5. The proofs of the upper bounds in the above theorems are computer assisted. Based on some numerical work to find approximate realisations of graphs, we believe, but cannot prove rigorously, that there does not exist an almost-equidistant set of 13 points in \(\mathbb {R}^4\).

Conjecture 1

The largest number of points in an almost-equidistant set in\(\mathbb {R}^4\) is 12, that is, \(f(4) =12\).

In dimension 5, Larman and Rogers [16] showed that \(f(5)\ge 16\) by a construction based on the so-called Clebsch graph. In dimensions 6 to 9, we use their construction to obtain lower bounds that are stronger than the lower bound \(2d+4\) stated below in Theorem 5. We again complement this with some computer-assisted upper bounds.

Theorem 4

The largest number of points in an almost-equidistant set in\(\mathbb {R}^5\), \(\mathbb {R}^6\), \(\mathbb {R}^7\), \(\mathbb {R}^8\) and \(\mathbb {R}^9\)satisfy the following:\(16\le f(5)\le 20\), \(18\le f(6)\le 26\), \(20\le f(7)\le 34\), \(24\le f(8)\le 41\), and\(24\le f(9)\le 49\).

The unit-distance graph of an almost-equidistant point set P in \(\mathbb {R}^d\) is the graph obtained from P by letting P be its vertex set and by placing an edge between pairs of points at unit distance.

For every \(d \in \mathbb {N}\), a unit-distance graph in \(\mathbb {R}^d\) does not contain \(K_{d+2}\) (see Corollary 8) and the complement of the unit-distance graph of an almost-equidistant set is triangle-free. Thus we have \(f(d)\le R(d+2,3)-1\), where \(R(d+2,3)\) is the Ramsey number of \(K_{d+2}\) and \(K_3\), that is, the smallest positive integer N such that for every graph G on N vertices there is a copy of \(K_{d+2}\) in G or a copy of \(K_3\) in the complement of G.

Ajtai, Komlós, and Szemerédi [1] showed \(R(d+2,3) \le O(d^2/\log {d})\) and this bound is known to be tight [14]. We thus have an upper bound \(f(d) \le O(d^2/\log {d})\), which, as we show below, is not tight. For small values of d where the Ramsey number \(R(d+2,3)\) is known or has a reasonable upper bound, we obtain an upper bound for f(d). In particular, we get \(f(5) \le 22\), \(f(6) \le 27\), \(f(7) \le 35\), \(f(8) \le 41\), and \(f(9) \le 49\) [22]. For \(d \in \{5,6,7\}\), we slightly improve these estimates to the bounds from Theorem 4 using our computer-assisted approach (Table 1).

Table 1 Lower and upper bounds on the largest size of an almost-equidistant set in \(\mathbb {R}^d\)

1.2 Our Results in Higher Dimensions

We now turn to higher dimensions. The obvious generalization of the Moser spindle gives an example of an almost-equidistant set of \(2d+3\) points in \(\mathbb {R}^d\). The next theorem improves this by 1. It is a generalization of the almost-equidistant set on 10 points in \(\mathbb {R}^3\) from Fig. 2.

Theorem 5

In each dimension\(d\ge 3\), there is an almost-equidistant set in\(\mathbb {R}^d\)with\(2d+4\)points.

Rosenfeld [23] showed that an almost-equidistant set on a sphere in \(\mathbb {R}^d\) of radius \(1/\sqrt{2}\) has size at most 2d, which is best possible. Rosenfeld’s proof, which uses linear algebra, was adapted by Bezdek and Langi [4] to spheres of other radii. They showed that an almost-equidistant set on a sphere in \(\mathbb {R}^d\) of radius \(\le 1/\sqrt{2}\) has at most \(2d+2\) elements, which is attained by the union of two d-simplices inscribed in the same sphere.

Pudlák [21] and Deaett [10] gave simpler proofs of Rosenfeld’s result. Our final result is an asymptotic upper bound for the size of an almost-equidistant set, based on Deaett’s proof [10].

Theorem 6

An almost-equidistant set of points in\(\mathbb {R}^d\)has cardinality\(O(d^{3/2})\).

We note that Polyanskii [20] recently found an upper bound of \(O(d^{13/9})\) for the size of an almost-equidistant set in \(\mathbb {R}^d\) and Kupavskii, Mustafa, and Swanepoel [15] improved this to \(O(d^{4/3})\). Both papers use ideas from our proof of Theorem 6.

In this paper, we use \(\left\Vert v\right\Vert\) to denote the Euclidean norm of a vector v from \(\mathbb {R}^d\). For a subset S of \(\mathbb {R}^d\), we use \({{\,\mathrm{span}\,}}(S)\) and \({{\,\mathrm{aff}\,}}(S)\) to denote the linear hull and the affine hull of S, respectively.

The proofs of Theorems 5 and 6 are in Sect. 2. Theorems 1, 2, 3 and 4 are proved in Sect. 3. In Sect. 4, we discuss a possible generalization of the problem of determining the function f.

2 High Dimensions

In this section, we first prove Theorem 5 by constructing, for every integer \(d \ge 3\), an almost-equidistant set in \(\mathbb {R}^d\) with \(2d+4\) points. In the rest of the section, we prove Theorem 6 by showing the upper bound \(f(d) \le O(d^{3/2})\).

2.1 Proof of Theorem 5

Consider an equilateral d-simplex \(\triangle\) with vertex set \(S=\{x_0,\dots ,x_d\}\). Let \(x_i'\) be the reflection of \(x_i\) in the hyperplane through the facet of \(\triangle\) not containing \(x_i\). We will show that there exists an isometry \(\rho\) of \(\mathbb {R}^d\) that fixes the line determined by \(x_0'\) and \(x_1'\) such that the distances \(\left\Vert x_0-\rho (x_0)\right\Vert\) and \(\left\Vert x_1-\rho (x_1)\right\Vert\) are both 1, and such that \(\{x_0,\dots ,x_d\}\) is disjoint from \(\{\rho (x_0),\dots ,\rho (x_d)\}\).

With such an isometry \(\rho\), the set \(R:=S\cup \rho (S)\cup \{x_0',x_1'\}\) clearly contains \(2d+4\) distinct points. We next show that R is almost equidistant. Suppose for contradiction there is a subset of R with three points and with no pair of points at distance 1. Since S and \(\rho (S)\) form cliques in the unit-distance graph of R and every point from \(S \cup \rho (S)\) is at unit distance from \(x'_0\) or \(x'_1\), this subset is necessarily \(\{x_i,\rho (x_j), x_k'\}\) for some \(i,j\in \{0,\dots ,d\}\) and \(k\in \{0,1\}\). Since \(x_k'\) is at distance 1 from all other points in \(S\cup \rho (S)\) except \(x_k\) and \(\rho (x_k)\), we obtain \(i=k\) and \(j=k\). However, then the points \(x_k\) and \(\rho (x_k)\) are at distance 1, as the isometry \(\rho\) is chosen so that \(\left\Vert x_k-\rho (x_k)\right\Vert =1\), contradicting the choice of the 3-point subset.

It remains to show that there exists an isometry \(\rho\) as described above. Let \(c:=\frac{1}{2}(x_0+x_1)\), and assume without loss of generality that \(\frac{1}{2}(x_0'+x_1')\) is the origin o. Let H be the \((d-1)\)-dimensional subspace through o with normal \(x_1-x_0\). Note that \(c,x_2,\dots ,x_d\in H\). Let V be any 2-dimensional subspace containing o and c. (For instance, we can let V be the linear span of c and \(x_2\).) Let \(\pi\) be the orthogonal projection of \({\mathbb {R}}^d\) onto V. Then \(\pi (x_0)=\pi (x_1)=c\) and \(\pi (x_0')=\pi (x_1')=o\). Let \(\rho _V\) be a rotation of V around o such that \(\left\Vert c-\rho _V(c)\right\Vert =1\). Define \(\rho :\mathbb {R}^d\rightarrow \mathbb {R}^d\) by \(\rho (x):=\rho _V(\pi (x))+(x-\pi (x))\). Then \(\rho\) is an isometry that fixes the orthogonal complement of V (including \(x_0'\) and \(x_1'\)) and moves \(x_0\) and \(x_1\) by a distance of 1. Since \(x_0,x_1\notin H\), it follows that \(\rho (x_0),\rho (x_1)\notin H\), hence \(\rho (x_0),\rho (x_1)\) do not coincide with any of \(x_2,\dots ,x_d\). Similarly, \(x_0,x_1\) do not coincide with any of \(\rho (x_2),\dots ,\rho (x_d)\). It remains to show that \(\{x_2,\dots ,x_d\}\) is disjoint from \(\{\rho (x_2),\dots ,\rho (x_d)\}\). It is sufficient to prove that \(\left\Vert x_i-\rho (x_i)\right\Vert <1\) for all \(i=2,\dots ,d\), since \(\left\Vert x_i-x_j\right\Vert =1\) for all distinct i and j, and \(\rho\) does not fix any of \(x_2,\dots ,x_d\). We first calculate that

$$\begin{aligned} \left\Vert c-o\right\Vert =\sqrt{1-\frac{1}{d^2}}\quad \text {and}\quad \left\Vert x_i-o\right\Vert =\sqrt{\frac{3}{4}-\frac{1}{d}-\frac{1}{d^2}} < \left\Vert c-o\right\Vert . \end{aligned}$$
(1)

Note that

$$\begin{aligned} x_0'=\frac{2}{d}(x_1+\dots +x_d)-x_0 = \frac{2}{d}\sum _{i=0}^d x_i - \left( 1+\frac{2}{d}\right) x_0, \end{aligned}$$

and similarly,

$$\begin{aligned} x_1' = \frac{2}{d}\sum _{i=0}^d x_i - \left( 1+\frac{2}{d}\right) x_1. \end{aligned}$$

It follows that

$$\begin{aligned} c = c-o =\frac{1}{2}(x_0+x_1)-\frac{1}{2}(x_0'+x_1') = \left( 1-\frac{1}{d}\right) (x_0+x_1) - \frac{2}{d}(x_2+\dots +x_d). \end{aligned}$$

We can embed \(\mathbb {R}^d\) isometrically into the hyperplane \(\left\{ (\lambda _0,\dots ,\lambda _d)\;\Big |\;\lambda _0+\dots +\lambda _d=1\right\}\) of \(\mathbb {R}^{d+1}\) by sending \(x_i\) to \(\frac{1}{\sqrt{2}}e_i\in \mathbb {R}^{d+1}\), \(i=0,\dots ,d\). It follows that

$$\begin{aligned} \left\Vert c-o\right\Vert =\frac{1}{\sqrt{2}}\left\Vert \left( 1-\frac{1}{d},1-\frac{1}{d},-\frac{2}{d},\dots ,-\frac{2}{d}\right) \right\Vert = \sqrt{1-\frac{1}{d^2}}, \end{aligned}$$

which is the first half of (1). Similarly, it follows that

$$\begin{aligned} \left\Vert x_i-o\right\Vert = \frac{1}{\sqrt{2}}\left\Vert \left( \frac{1}{2}-\frac{1}{d},\frac{1}{2}-\frac{1}{d},1-\frac{2}{d},-\frac{2}{d},\dots ,-\frac{2}{d}\right) \right\Vert = \sqrt{\frac{3}{4}-\frac{1}{d}-\frac{1}{d^2}}, \end{aligned}$$

which establishes the second half of (1). Since the isometry \(\rho\) is a rotation in V, moving each point in V at distance \(\sqrt{1-\frac{1}{d^2}}\) from o by a distance of 1, it will move each point in \(\mathbb {R}^d\) at distance less than \(\sqrt{1-\frac{1}{d^2}}\) from o by a distance less than 1. Therefore, \(x_2,\dots ,x_d\) are all moved by a distance less than 1, and the proof is finished.

2.2 Proof of Theorem 6

As a first step towards this proof, we show the following lemma, whose statement is illustrated in Fig. 3. This lemma is also used later in Sect. 3.

Lemma 7

For\(d,k\in \mathbb {N}\), letCbe a set ofkpoints in\(\mathbb {R}^d\)such that the distance between any two of them is 1. Let\(c {:}{=}\frac{1}{k} \sum _{p \in C} p\)be the centroid ofCand let\(A {:}{=}{{\,\mathrm{span}\,}}(C-c)\). Then the set of points equidistant from all points ofCis the affine space\(c+A^\perp\)orthogonal toAand passing throughc. Furthermore, the intersection of all unit spheres centred at the points inCis the\((d-k)\)-dimensional sphere of radius\(\sqrt{(k+1)/(2k)}\)centred atcand contained in\(c+A^{\perp }\).

Fig. 3
figure 3

An illustration of the statement of Lemma 7 for \(d=k=2\). The points \(p_1\) and \(p_2\) are at distance 1. The intersection of the unit spheres centred at \(p_1\) and \(p_2\) is the 0-dimensional sphere of radius \(\sqrt{(k+1)/(2k)}=\sqrt{3}/2\) centred at c

Proof

Let \(C=\{p_1,\dots ,p_k\}\). First, we show that a point x from \(\mathbb {R}^d\) lies in \(c+A^{\perp }\) if and only if \(\left\Vert x-p_1\right\Vert =\cdots =\left\Vert x-p_k\right\Vert\), which gives the first part of the lemma. For every \(x \in \mathbb {R}^d\) and each \(i \in \{1,\dots ,k\}\), we have

$$\begin{aligned} \left\Vert x-p_i\right\Vert ^2&= \left\Vert (x-c)-(p_i-c)\right\Vert ^2\\&= \left\Vert x-c\right\Vert ^2 + \left\Vert p_i-c\right\Vert ^2 -2\left\langle x-c, p_i-c \right\rangle . \end{aligned}$$

Let \(\triangle\) be the standard \((k-1)\)-simplex with vertices \((1,0,\dots ,0),\dots ,(0,\dots ,0,1)\) embedded in \(\mathbb {R}^k\). Note that \(\sqrt{2}\left\Vert p_i-c\right\Vert\) is the distance between a vertex of \(\triangle\) and its centroid \((1/k,\dots ,1/k)\), which is \(\sqrt{(k-1)/k}\). Therefore \(\left\Vert p_i-c\right\Vert = \sqrt{(k-1)/(2k)}\) and, in particular,

$$\begin{aligned} \left\Vert x-p_i\right\Vert ^2 = \left\Vert x-c\right\Vert ^2 + \frac{k-1}{2k} -2\left\langle x-c, p_i-c \right\rangle \end{aligned}$$
(2)

for every \(i \in \{1,\dots ,k\}\).

Now, assume that \(x \in c+A^{\perp }\). Then, since \(p_i-c \in A\) for every \(i \in \{1,\dots ,k\}\), we have \(\left\langle x-c, p_i-c \right\rangle = 0\). By (2), we obtain

$$\begin{aligned} \left\Vert x-p_i\right\Vert ^2 = \left\Vert x-c\right\Vert ^2 + \frac{k-1}{2k} \end{aligned}$$

for every \(i \in \{1,\dots ,k\}\) and thus \(\left\Vert x-p_1\right\Vert =\cdots =\left\Vert x-p_k\right\Vert\).

On the other hand, if there is a \(\gamma \in \mathbb {R}\) such that \(\gamma = \left\Vert x-p_i\right\Vert\) for every \(i \in \{1,\dots ,k\}\), then the equality (2) gives

$$\begin{aligned} \gamma ^2 = \left\Vert x-c\right\Vert ^2 + \frac{k-1}{2k} -2\left\langle x-c, p_i-c \right\rangle \end{aligned}$$

for every \(i \in \{1,\dots ,k\}\). Setting \(\eta {:}{=}\bigl (\left\Vert x-c\right\Vert ^2 + (k-1)/(2k) - \gamma ^2\bigr )/2\), we have \(\left\langle x-c, p_1-c \right\rangle =\dots =\left\langle x-c, p_k-c \right\rangle =\eta\). Using this fact and the expression of c, we obtain

$$\begin{aligned} 0=\left\langle x-c, o \right\rangle = \left\langle x-c, c-c \right\rangle = \left\langle x-c, \frac{1}{k}\sum _{i=1}^k p_i-c \right\rangle = \frac{1}{k}\sum _{i=1}^k \left\langle x-c, p_i-c \right\rangle =\eta , \end{aligned}$$

where o denotes the origin in \(\mathbb {R}^d\). Thus \(\left\langle x-c, p_i-c \right\rangle =\eta =0\) for every \(i \in \{1,\dots ,k\}\) and, since every element of A is a linear combination of elements from \(C-c\), we have \(x \in c+A^{\perp }\).

For the second part of the lemma, let S be the intersection of all unit spheres centred at the points in C. By the first part of the lemma, we know that

$$\begin{aligned} S= \left\{ x \in c+A^{\perp }\;\Big |\;1 = \left\Vert x-c\right\Vert ^2 + \frac{k-1}{2k}\right\} . \end{aligned}$$

Since A is a \((k-1)\)-dimensional subspace, \(c+A^{\perp }\) is a \((d-k+1)\)-dimensional affine subspace of \(\mathbb {R}^d\), hence S is the \((d-k)\)-dimensional sphere of radius \(\sqrt{(k+1)/(2k)}\) centred at c and contained in \(c+A^{\perp }\). \(\square\)

Corollary 8

For\(d \in \mathbb {N}\), every subset of\(\mathbb {R}^d\)contains at most\(d+1\)points that are pairwise at unit distance.

Proof

Lemma 7 applied to a set C of d points in \(\mathbb {R}^d\) with all pairs of points at unit distance implies that the set of points that are at unit distance from all points in C lies on a 0-dimensional sphere of diameter \(2\sqrt{(d+1)/(2d)} \ne 1\). \(\square\)

The following is a well-known result that bounds the rank of a square matrix from below in terms of the entries of the matrix [2, 10, 21].

Lemma 9

Let \(A=[a_{i,j}]\) be a non-zero symmetric \(m\times m\) matrix with real entries. Then

$$\begin{aligned} \operatorname {rank}A \ge \left( \sum \limits _{i=1}^m a_{i,i}\right) ^2 / \sum \limits _{i=1}^m\sum \limits _{j=1}^m a_{i,j}^2. \end{aligned}$$

The last lemma before the proof of Theorem 6 can be proved by a calculation, using its assumption that the vectors \(v_i\) have pairwise inner products \(\varepsilon\), so they differ from an orthogonal set by some skewing.

Lemma 10

For\(n,t \in \mathbb {N}\) with \(t \le n\), let\(w_1,\dots ,w_t\)be unit vectors in\(\mathbb {R}^n\)such that\(\left\langle w_i, w_j \right\rangle =\varepsilon\)for allijwith\(1\le i < j \le t\), where\(\varepsilon \in [0,1)\). Then the set\(\{w_1,\dots ,w_t\}\)can be extended to\(\{w_1,\dots ,w_n\}\)such that\(\left\langle w_i, w_j \right\rangle =\varepsilon\)for allijwith\(1\le i < j \le n\), and such that for some orthonormal basis\(e_1,\dots ,e_n\)we have

$$\begin{aligned} w_i = \frac{e_i+\lambda e}{\left\Vert e_i+\lambda e\right\Vert }\quad (i=1,\dots ,n), \end{aligned}$$

where

$$\begin{aligned} \lambda {:}{=}\frac{-1+\sqrt{1+\varepsilon n/(1-\varepsilon )}}{n} \quad \text {and}\quad e {:}{=}\sum _{j=1}^n e_j = \frac{1}{\sqrt{1+(n-1)\varepsilon }}\sum _{j=1}^n w_j. \end{aligned}$$

Moreover,\(\left\Vert e_i+\lambda e\right\Vert ^2 = (1-\varepsilon )^{-1}\)for each\(i\in \{1,\dots ,n\}\) and for every \(x\in \mathbb {R}^n\) we have

$$\begin{aligned} \sum _{j=1}^n (\left\langle x, w_j \right\rangle -\varepsilon )^2 = (1-\varepsilon )(\left\Vert x\right\Vert ^2-\varepsilon ) + \varepsilon \left( \left\langle x, e \right\rangle -\sqrt{1+(n-1)\varepsilon }\right) ^2. \end{aligned}$$

Proof

Let \(\varepsilon \in [0,1)\) and \(w_1,\dots ,w_t\) be from the statement of the lemma. We first extend the set \(\{w_1,\dots ,w_t\}\) to a set \(\{w_1,\dots ,w_n\}\) of unit vectors in \(\mathbb {R}^n\) so that \(\left\langle w_i, w_j \right\rangle =\varepsilon\) for all ij with \(1\le i < j \le n\). We proceed iteratively, choosing \(w_{i+1}\) after the vectors \(w_1,\dots ,w_i\) have been obtained for some i with \(t \le i < n\). The condition \(\left\langle w_i, w_j \right\rangle = \varepsilon\) for each j with \(1 \le j < i\) says that the desired point \(w_{i+1}\) lies in the hyperplanes \(\left\{ x \in \mathbb {R}^n\;\Big |\;\left\langle x, w_j \right\rangle = \varepsilon \right\}\). Since \(\varepsilon \ge 0\), the intersection of these hyperplanes taken over \(j \in \{1,\dots ,i\}\) is an affine subspace A of dimension at least \(n-i \ge 1\). The subspace A contains the point

$$\begin{aligned} a&{:}{=}\frac{\varepsilon }{1+(i-1)\varepsilon } \cdot (w_1+\dots +w_i) \\&= \frac{\varepsilon }{1+\varepsilon (i-1)}(w_1+\dots +w_{j-1}+w_{j+1}+\dots +w_i) + \frac{1}{1+\varepsilon (i-1)}\varepsilon w_j, \end{aligned}$$

which is in the convex hull of \(\{w_1,\dots ,w_{j-1},\varepsilon w_j,w_{j+1},\dots ,w_i\}\) for every \(j\in \{1,\dots ,i\}\). Since \(\varepsilon < 1\), each point \(\varepsilon w_j\) is inside the unit ball centred in the origin and so is a. Additionally, A does not contain any of the points \(w_1,\dots ,w_i\). Altogether, A intersects the unit sphere centred in the origin at a point that is not in \(\{w_1,\dots ,w_i\}\). We let \(w_{i+1}\) be an arbitrary point from this intersection. For \(i=n-1\), we obtain the set \(\{w_1,\dots ,w_n\}\).

We now let \(e_i {:}{=}w_i/\sqrt{1-\varepsilon }-\lambda e\) for every \(i \in \{1,\dots ,n\}\), where \(e=\frac{1}{\sqrt{1+(n-1)\varepsilon }}\sum _{j=1}^n w_j\) and \(\lambda = (-1+\sqrt{1+\varepsilon n/(1-\varepsilon )})/n\). That is, we skew the vectors \(w_1,\dots ,w_n\) so that they are pairwise orthogonal and we scale the resulting vectors so that they will form an orthonormal basis. Note that \(\lambda n+1 = \sqrt{\frac{1+(n-1)\varepsilon }{1-\varepsilon }}\). Using this fact and the choice of \(e_1,\dots ,e_n\), we obtain

$$\begin{aligned} \sum _{j=1}^n e_j = \frac{\sum _{j=1}^n w_j }{\sqrt{1-\varepsilon }}- \lambda n e = \left( \sqrt{\frac{1+(n-1)\varepsilon }{1-\varepsilon }} - \lambda n\right) e = e. \end{aligned}$$

We now verify that \(e_1,\dots ,e_n\) form an orthonormal basis of \(\mathbb {R}^n\). Let \(i \in \{1,\dots ,n\}\) be fixed. Note that \(\left\langle w_i, e \right\rangle = \frac{1+(n-1)\varepsilon }{\sqrt{1+(n-1)\varepsilon }}=\sqrt{1+(n-1)\varepsilon }\), as every \(w_j\) is a unit vector and pairwise inner products of vectors \(w_1,\dots ,w_n\) equal \(\varepsilon\). Summing over i, we obtain \(\left\langle e, e \right\rangle = \frac{1}{\sqrt{1+(n-1)\varepsilon }}\sum _{i=1}^n\left\langle w_i, e \right\rangle = n\). Using these facts and the choice of \(\lambda\), we derive

$$\begin{aligned} \left\Vert e_i\right\Vert ^2&= \left\langle \frac{w_i}{\sqrt{1-\varepsilon }}-\lambda e, \frac{w_i}{\sqrt{1-\varepsilon }}-\lambda e \right\rangle = \frac{\left\Vert w_i\right\Vert ^2}{1-\varepsilon } - 2\lambda \frac{\left\langle w_i, e \right\rangle }{\sqrt{1-\varepsilon }} + \lambda ^2\left\Vert e\right\Vert ^2 \\&= \frac{1}{1-\varepsilon } - 2\lambda \sqrt{\frac{1+(n-1)\varepsilon }{1-\varepsilon }}+\lambda ^2 n = \frac{1}{1-\varepsilon } - 2\lambda (\lambda n + 1) + \lambda ^2n \\&= \frac{1}{1-\varepsilon } - \lambda ^2n - 2\lambda = 1. \end{aligned}$$

Therefore each \(e_i\) is a unit vector. Similarly, for all distinct i and j from \(\{1,\dots ,n\}\), we have

$$\begin{aligned} \left\langle e_i, e_j \right\rangle&= \left\langle \frac{w_i}{\sqrt{1-\varepsilon }}-\lambda e, \frac{w_j}{\sqrt{1-\varepsilon }}-\lambda e \right\rangle \\&= \frac{\left\langle w_i, w_j \right\rangle }{1-\varepsilon } - \lambda \frac{\left\langle w_i, e \right\rangle }{\sqrt{1-\varepsilon }} - \lambda \frac{\left\langle w_j, e \right\rangle }{\sqrt{1-\varepsilon }} + \lambda ^2\left\Vert e\right\Vert ^2 \\&= \frac{\varepsilon }{1-\varepsilon } - 2\lambda \sqrt{\frac{1+(n-1)\varepsilon }{1-\varepsilon }}+\lambda ^2 n = \frac{\varepsilon }{1-\varepsilon } - \lambda ^2n - 2\lambda = 0. \end{aligned}$$

We thus see that \(e_1,\dots ,e_n\) is indeed an orthonormal basis in \(\mathbb {R}^n\).

To show \(\left\Vert e_i+\lambda e\right\Vert ^2 = (1-\varepsilon )^{-1}\) for each \(i\in \{1,\dots ,n\}\), we simply use the fact that \(w_i\) is a unit vector and derive

$$\begin{aligned} \left\Vert e_i + \lambda e\right\Vert ^2= & {} \left\langle \frac{w_i}{\sqrt{1-\varepsilon }}, \frac{w_i}{\sqrt{1-\varepsilon }} \right\rangle \\= & {} \frac{\left\Vert w_i\right\Vert ^2}{1-\varepsilon } = \frac{1}{1-\varepsilon }. \end{aligned}$$

It remains to prove the last expression in the statement of the lemma. Let x be an arbitrary point from \(\mathbb {R}^n\). Since \(e_1,\dots ,e_n\) is a basis of \(\mathbb {R}^n\), we have \(x=\sum _{i=1}^n \alpha _i e_i\) for some \((\alpha _1,\dots ,\alpha _n) \in \mathbb {R}^n\). For each \(j \in \{1,\dots ,n\}\), we express the term \(\left\langle x, w_j \right\rangle\) as

$$\begin{aligned} \left\langle x, w_j \right\rangle= & {} \sum _{i=1}^n \alpha _i\left\langle e_i, w_j \right\rangle = \sqrt{1-\varepsilon }\sum _{i=1}^n \alpha _i(\left\langle e_i, e_j \right\rangle + \lambda \left\langle e_i, e \right\rangle ) \\= & {} \sqrt{1-\varepsilon }(\alpha _j + \lambda \left\langle x, e \right\rangle ), \end{aligned}$$

using the facts that the basis \(e_1,\dots ,e_n\) is orthonormal and that \(w_j=\sqrt{1-\varepsilon }(e_j+\lambda e)\). Now, we have

$$\begin{aligned} \sum _{j=1}^n \bigl (\left\langle x, w_j \right\rangle - \varepsilon \bigr )^2&= \sum _{j=1}^n \bigl (\sqrt{1-\varepsilon }(\alpha _j + \lambda \left\langle x, e \right\rangle ) - \varepsilon \bigr )^2 \\&= (1-\varepsilon )\sum _{j=1}^n \bigl (\alpha _j + \lambda \left\langle x, e \right\rangle \bigr )^2 -2\varepsilon \sqrt{1-\varepsilon }\biggl (\sum _{j=1}^n\alpha _j + \lambda \left\langle x, e \right\rangle \biggr )+n\varepsilon ^2 \\&= (1-\varepsilon )\biggl (\sum _{j=1}^n \alpha _j^2 + 2\lambda \left\langle x, e \right\rangle \sum _{j=1}^n \alpha _j + \lambda ^2 n \left\langle x, e \right\rangle ^2\biggr ) \\&\quad - 2\varepsilon \sqrt{1-\varepsilon }\biggl (\sum _{j=1}^n\alpha _j + \lambda n\left\langle x, e \right\rangle \biggr ) + n\varepsilon ^2. \end{aligned}$$

Since the basis \(e_1,\dots ,e_n\) is orthonormal, we have \(\left\Vert x\right\Vert ^2 = \sum _{i=1}^n\sum _{j=1}^n \alpha _i\alpha _j \left\langle e_i, e_j \right\rangle = \sum _{i=1}^n\alpha _i^2\) and, since \(e=\sum _{j=1}^n e_j\), we also have \(\left\langle x, e \right\rangle = \sum _{i=1}^n \sum _{j=1}^n \alpha _i\left\langle e_i, e_j \right\rangle = \sum _{i=1}^n\alpha _i\). The above expression thus equals

$$\begin{aligned} (1-\varepsilon )\bigl (\left\Vert x\right\Vert ^2 + (2\lambda +\lambda ^2n)\left\langle x, e \right\rangle ^2\bigr ) - 2\varepsilon \sqrt{1-\varepsilon }(1+\lambda n)\left\langle x, e \right\rangle + n\varepsilon ^2. \end{aligned}$$

Using the facts that \(2\lambda +\lambda ^2n = \varepsilon /(1-\varepsilon )\) and \(1+\lambda n = \sqrt{\frac{1+(n-1)\varepsilon }{1-\varepsilon }}\), this expression can be further simplified as

$$\begin{aligned} (1-\varepsilon )\left\Vert x\right\Vert ^2 + \varepsilon \left( \left\langle x, e \right\rangle ^2 - 2\sqrt{1+(n-1)\varepsilon }\left\langle x, e \right\rangle + n\varepsilon \right) \end{aligned}$$

and then rewritten to the final form

$$\begin{aligned} (1-\varepsilon )(\left\Vert x\right\Vert ^2-\varepsilon ) + \varepsilon \left( \left\langle x, e \right\rangle -\sqrt{1+(n-1)\varepsilon }\right) ^2. \qquad\qquad\qquad\square\end{aligned}$$

We are now ready to prove Theorem 6. For \(d \ge 2\), let \(V\subset \mathbb {R}^d\) be an almost-equidistant set. We let \(G=(V,E)\) be the unit-distance graph of V and let \(k {:}{=}\lfloor 2\sqrt{d}\rfloor\). Note that \(1 \le k \le d\).

Let \(S\subseteq V\) be a set of k points such that the distance between any two of them is 1. If such a set does not exist, then, since the complement of G does not contain a triangle, we have \(|V| < R(k,3)\), where R(k, 3) is the Ramsey number of \(K_k\) and \(K_3\). Using the bound \(R(k,3) \le \left( {\begin{array}{c}k+3-2\\ 3-1\end{array}}\right)\) obtained by Erdős and Szekeres [11], we derive \(|V| < \left( {\begin{array}{c}2\sqrt{d}+1\\ 2\end{array}}\right) = 2d+\sqrt{d}\). Thus we assume in the rest of the proof that S exists.

Let B be the set of common neighbours of S, that is,

$$\begin{aligned} B {:}{=}\left\{ x\in V\;\Big |\;\left\Vert x-s\right\Vert =1\text { for all }s\in S\right\} . \end{aligned}$$

Since V is equidistant, the set of non-neighbours of any vertex of G is a clique and so it has size at most \(d+1\) by Corollary 8. Every vertex from \(V{\setminus } B\) is a non-neighbour of some vertex from S and thus it follows that \(\left|V{\setminus } B\right| \le k(d+2)\).

We now estimate the size of B. By Lemma 7 applied to S, the set B lies on a sphere of radius \(\sqrt{(k+1)/2k}\) in an affine subspace of dimension \(d-k+1\). We may take the centre of this sphere as the origin, and rescale by \(\sqrt{2k/(k+1)}\) to obtain a set \(B'\) of m unit vectors \(v_1,\dots ,v_m\in \mathbb {R}^{d-k+1}\) where \(m {:}{=}\left|B\right|\). For any three of the vectors from \(B'\), the distance between some two of them is \(\sqrt{2k/(k+1)}\). For two such vectors \(v_i\) and \(v_j\) with \(\left\Vert v_i-v_j\right\Vert ^2 = 2k/(k+1)\), the facts \(\left\Vert v_i-v_j\right\Vert ^2 = \left\Vert v_i\right\Vert ^2+\left\Vert v_j\right\Vert ^2-2\left\langle v_i, v_j \right\rangle\) and \(\left\Vert v_i\right\Vert ^2=\left\Vert v_j\right\Vert ^2=1\) imply \(\left\langle v_i, v_j \right\rangle = \varepsilon\), where \(\varepsilon {:}{=}1/(k+1)\). Note that the opposite implication also holds. That is, if \(\left\langle v_i, v_j \right\rangle = \varepsilon\), then \(v_i\) and \(v_j\) are at distance \(\sqrt{2k/(k+1)}\).

Let \(A=[a_{i,j}]\) be the \(m\times m\) matrix defined by \(a_{i,j} {:}{=}\left\langle v_i, v_j \right\rangle - \varepsilon\). Clearly, A is a symmetric matrix with real entries. If \(m \ge d-k+2\), then A is also non-zero, as G contains no \(K_{d+2}\) and every vertex from B is adjacent to every vertex from S in G. We recall that \(\operatorname {rank}XY \le \min \{\operatorname {rank}X, \operatorname {rank}Y\}\) and \(\operatorname {rank}(X+Y) \le \operatorname {rank}X + \operatorname {rank}Y\) for two matrices X and Y. Since \(B' = \{v_1,\dots ,v_m\} \subset \mathbb {R}^{d-k+1}\) and

$$\begin{aligned} A = \begin{bmatrix} v_1&v_2&\cdots&v_m\end{bmatrix}^\top \begin{bmatrix} v_1&v_2&\cdots&v_m\end{bmatrix} - \varepsilon J, \end{aligned}$$

where J is the \(m\times m\) matrix with each entry equal to 1, we have

$$\begin{aligned} \operatorname {rank} A\le d-k+2. \end{aligned}$$
(3)

By Lemma 9,

$$\begin{aligned} \operatorname {rank}A \ge \frac{\left( \sum \nolimits _{i=1}^m a_{i,i}\right) ^2}{\sum \nolimits _{i=1}^m\sum \nolimits _{j=1}^m a_{i,j}^2} = \frac{m^2(1-\varepsilon )^2}{\sum \nolimits _{i=1}^m \sum \nolimits _{j=1}^m (\left\langle v_i, v_j \right\rangle - \varepsilon )^2}. \end{aligned}$$
(4)

For \(i \in \{1,\dots ,m\}\), let \(N_i\) be the set of vectors from \(B'\) that are at distance \(\sqrt{2k/(k+1)}\) from \(v_i\). That is,

$$\begin{aligned} N_i {:}{=}\left\{ v_j \in B'\;\Big |\;\left\langle v_i, v_j \right\rangle = \varepsilon \right\} . \end{aligned}$$

Then for each fixed \(v_i\) we have

$$\begin{aligned} \sum _{j=1}^m (\left\langle v_i, v_j \right\rangle -\varepsilon )^2 = (1-\varepsilon )^2 + \sum _{v_j\in N_i} 0 + \sum _{v_j \in B' {\setminus } (N_i \cup \{v_i\})} (\left\langle v_i, v_j \right\rangle -\varepsilon )^2. \end{aligned}$$
(5)

Note that the vectors from \(B' {\setminus } (N_i \cup \{v_i\})\) have pairwise inner products \(\varepsilon\), as neither of them is at distance \(\sqrt{2k/(k+1)}\) from \(v_i\), and thus \(|B' {\setminus } (N_i \cup \{v_i\})| \le d-k+2\). In fact, we even have \(|B' {\setminus } (N_i \cup \{v_i\})| \le d-k+1\), since \(B'\) contains only unit vectors and any subset of \(d-k+2\) points from \(B'\) with pairwise distances \(\sqrt{2k/(k+1)}\) would form the vertex set of a regular \((d-k+1)\)-simplex with edge lengths \(\sqrt{2k/(k+1)}\) centred at the origin. However, then the distance from the centroid of such a simplex to its vertices would be equal to \(\sqrt{k(d-k+1)/((k+1)(d-k+2))} \ne 1\), which is impossible.

Thus setting \(n{:}{=}d-k+1\) and \(t {:}{=}|B' {\setminus } (N_i \cup \{v_i\})|\), we have \(t \le n\). Applying Lemma 10 to the t vectors from \(B' {\setminus } (N_i \cup \{v_i\}) \subseteq \mathbb {R}^n\) with \(\varepsilon =(k+1)^{-1}\) and \(x=v_i\), we see that the last sum in (5) is at most

$$\begin{aligned} (1-\varepsilon )^2 + \varepsilon \left( \left\langle v_i, e \right\rangle -\sqrt{1+(d-k)\varepsilon }\right) ^2, \end{aligned}$$

where \(e=\sum _{j=1}^{d-k+1}e_j\) for some orthonormal basis \(e_1,\dots ,e_{d-k+1}\) of \(\mathbb {R}^{d-k+1}\).

By the Cauchy–Schwarz inequality,

$$\begin{aligned} \left( \left\langle v_i, e \right\rangle -\sqrt{1+(d-k)\varepsilon }\right) ^2&< \left( \sqrt{d-k+1}+\sqrt{1+(d-k)\varepsilon }\right) ^2\\&= d-k+1 + 2\sqrt{d-k+1}\sqrt{1+(d-k)\varepsilon } \\&\quad + 1+(d-k)\varepsilon \\&< 4 (d-k+1). \end{aligned}$$

Thus, using \(\varepsilon = (k+1)^{-1}\), we obtain

$$\begin{aligned} \sum _{j=1}^m \bigl (\left\langle v_i, v_j \right\rangle -\varepsilon \bigr )^2&< 2(1-\varepsilon )^2 + 4\varepsilon (d-k+1)\\&= 4\varepsilon d + 2(1+\varepsilon )^2 - 4 < 4\varepsilon d. \end{aligned}$$

If we substitute this upper bound back into (4), then with (3) we obtain that \(d-k+2 > m^2(1-\varepsilon )^2/(4m\varepsilon d)\) and thus \(m < (4\varepsilon d)(d-k+2)/(1-\varepsilon )^2\). Using the choice \(k = \lfloor 2\sqrt{d}\rfloor\) and the expression \(\varepsilon = (k+1)^{-1}\), we obtain \((d-k+2)/(1-\varepsilon )^2 < d\), if \(d \ge 8\), and thus \(m < 4d^2/(k+1)\).

Altogether, we have \(m \le \max \{d-k+1,4d^2/(k+1)\} = 4d^2/(k+1)\). It follows that \(\left|V\right| \le k(d+2) + 4d^2/(k+1)\). Again, using the choice \(k= \lfloor 2\sqrt{d}\rfloor \in (2\sqrt{d}-1,2\sqrt{d}]\), we conclude that

$$\begin{aligned}\left|V\right| < 2\sqrt{d}(d+2) + 4d^2/(2\sqrt{d}) = 4d^{3/2} + 4\sqrt{d}. \end{aligned}$$

This finishes the proof of Theorem 6.

3 Low Dimensions

In this section, we give proofs of Theorems 123, and 4. Before doing so, we introduce the notion of abstract almost-equidistant graphs. Denote the complete t-partite graph with classes of sizes \(m_1,\dots ,m_t\) by \(K_{m_1,\dots ,m_t}\) or \(K_t(m_1,\dots ,m_t)\). A graph G is said to be an abstract almost-equidistant graph in\(\mathbb {R}^d\) if the complement of G does not contain \(K_3\) and either

  • \(d=2\) and G does not contain \(K_4\) nor \(K_{2,3}\);

  • or \(d\ge 3\), d odd and G does not contain \(K_{d+2}\) nor \(K_{(d+1)/2}(3,\dots ,3)\);

  • or \(d\ge 4\), d even and G does not contain \(K_{d+2}\) nor \(K_{(d+2)/2}(1,3,\dots ,3)\).

The following lemma justifies the notion of abstract almost-equidistant graphs. We will see later that its converse is not true, as there are abstract almost-equidistant graphs in \(\mathbb {R}^d\) that are not unit-distance graphs of any point set from \(\mathbb {R}^d\).

Lemma 11

For every\(d \ge 2\)and every almost-equidistant setPfrom\(\mathbb {R}^d\), the unit-distance graph ofPis an abstract almost-equidistant graph in\(\mathbb {R}^d\).

Proof

Let G be the unit-distance graph of an almost-equidistant set \(P \subset \mathbb {R}^d\). Clearly, the complement of G does not contain a triangle, as P is almost equidistant. The graph G also does not contain a copy of \(K_{d+2}\) by Corollary 8. Thus it remains to show that \(K_{2,3}\) does not occur as a unit-distance graph in \(\mathbb {R}^2\), \(K_{(d+1)/2}(3,\dots ,3)\) does not occur as a unit-distance graph for odd \(d\ge 3\), and \(K_{(d+2)/2}(1,3,\dots ,3)\) does not occur as a unit-distance graph for even \(d\ge 4\).

For \(d=2\), suppose that \(K_{2,3}\) occurs as a unit-distance graph in \(\mathbb {R}^2\). Let the class with two points be \(\{p,q\}\). The set of points that are at the same distance from both p and q is the intersection of two unit circles centred at p and q, respectively, and thus contains at most two points. Therefore, the other class cannot contain three points.

For odd \(d\ge 3\), suppose for contradiction that there exist sets \(V_1,\dots ,V_k\), where \(k=(d+1)/2\), such that each \(V_i\) contains three points, and such that the distance between any two points from different \(V_i\) equals 1. As in the proof of Lemma 7, it is easy to show that each \(V_i\) lies on a circle. Furthermore, for any distinct ij, \(a_1-a_2\perp b_1-b_2\) for all \(a_1,a_2\in V_i\) and \(b_1,b_2\in V_j\). Thus the affine hulls of the \(V_i\)s are pairwise orthogonal to each other, hence \(V_1\cup \dots \cup V_k\) together span a space of dimension at least \(2k > d\), a contradiction.

For even \(d \ge 4\), suppose that there exist sets \(V_1,\dots ,V_k\) in \(\mathbb {R}^d\), where \(k=d/2\), such that \(V_1\) contains four points abcd with \(\left\Vert a-b\right\Vert =\left\Vert a-c\right\Vert =\left\Vert a-d\right\Vert =1\), the sets \(V_2,\dots ,V_k\) each contains three points, and such that the distance between any two points from different \(V_i\) equals 1. As in the case of odd d, the \(V_i\) lie on circles (or a sphere in the case of \(V_1\)), the affine hulls of the \(V_i\)s have dimension at least 2 and are pairwise orthogonal to each other, hence \(V_1\cup \dots \cup V_k\) together span a space of dimension at least \(2k = d\). It follows that the affine hull of \(V_1\cup \dots \cup V_k\) has dimension exactly 2k, and that the affine hulls of all the the \(V_i\)s are 2-dimensional. In particular, we have that abcd lie on a circle C. However, then C and the unit circle with centre a intersect in 3 points, a contradiction. \(\square\)

An abstract almost-equidistant graph \(G=(V,E)\) in \(\mathbb {R}^d\) is realisable (in\(\mathbb {R}^d\)) if there is a point set P in \(\mathbb {R}^d\), called a realisation of G, and a one-to-one correspondence \(f :P \rightarrow V\) such that, for all points p and q from P, if \(\{f(p),f(q)\} \in E\), then p and q are at unit distance. If G is not realisable in \(\mathbb {R}^d\), then we say that it is non-realisable. For a realisable graph G and its realisation P, we sometimes do not distinguish between the vertices of G and the points from P.

By Lemma 11, if there is no realisable abstract almost-equidistant graphs in \(\mathbb {R}^d\) on n vertices, then there is no almost-equidistant set in \(\mathbb {R}^d\) of size n. Using a simple exhaustive computer search, we enumerated all non-isomorphic graphs that are abstract almost-equidistant in \(\mathbb {R}^d\) for \(d \in \{2,3,4,5,6\}\). We filtered out graphs that are minimal, meaning that any graph obtained by removing any edge from such a graph is no longer abstract almost-equidistant. We summarise our results obtained by the computer search in Tables 2 and 3. More detailed description of our computations can be found in Sect. 3.5.

The core of the proofs of Theorems 12, and 3 is to show that none of the minimal abstract almost-equidistant graphs in \(\mathbb {R}^d\) is realisable in \(\mathbb {R}^d\) for \(d=2,3,4\), respectively.

Table 2 Numbers of minimal abstract almost-equidistant graphs in \(\mathbb {R}^d\) on n vertices for \(d \in \{2,3,4,5,6\}\) and some values of n from \(\{4,\dots ,27\}\)
Table 3 Numbers of all abstract almost-equidistant graphs in \(\mathbb {R}^d\) on n vertices for \(d \in \{2,3,4,5,6\}\) and some values of n from \(\{4,\dots ,17\}\)

3.1 Proof of Theorem 1

We show that \(f(2) = 7\) and that, up to congruence, there is only one planar almost-equidistant set with 7 points, namely the Moser spindle.

A computer search shows that, up to isomorphism, there are exactly two abstract almost-equidistant graphs on 7 vertices. One of them is the Moser spindle (Fig. 1), which is clearly uniquely realisable in the plane up to congruence. The other graph (part (a) of Fig. 4) is the graph of the square antiprism with one point removed, which is easily seen to be non-realisable in the plane. Lemma 11 thus implies that the Moser spindle is the unique (up to congruence) almost-equidistant set in the plane on 7 points.

Fig. 4
figure 4

Non-realisable abstract almost-equidistant graphs in \(\mathbb {R}^2\) on 7 and 8 vertices

There is a unique abstract almost-equidistant graph on 8 vertices, namely the graph of the square antiprism (part (b) of Fig. 4), which is not realisable in the plane because it contains a non-realisable subgraph, namely the non-realisable abstract almost-equidistant graph on 7 vertices drawn in part (a) of Fig. 4. Thus, by Lemma 11, there is no almost-equidistant set in the plane on 8 points.

3.2 Proof of Theorem 2

We prove \(f(3)=10\) and that, up to congruence, there is only one almost-equidistant set in \(\mathbb {R}^3\) with 10 points.

A computer search shows that there is exactly one abstract almost-equidistant graph \(G_{11}\) in \(\mathbb {R}^3\) on 11 vertices (Fig. 5), and exactly 7 abstract almost-equidistant graphs in \(\mathbb {R}^3\) on 10 vertices, four of which are minimal (Figs. 2 and 6).

Fig. 5
figure 5

The non-realisable abstract almost-equidistant graph \(G_{11}\) in \(\mathbb {R}^3\) on 11 vertices

Although \(G_{11}\) contains the first graph in Fig. 6, and we will show that none of the graphs in Fig. 6 are realisable in \(\mathbb {R}^3\), it is worth observing the following direct argument for the non-realisability of \(G_{11}\). Suppose for contradiction that it is realisable in \(\mathbb {R}^3\). We label the vertices \(p_0\) to \(p_{10}\), with subscripts modulo 11, such that \(\{p_i,p_j\}\) is an edge of \(G_{11}\) if and only if \(i-j\equiv \pm 1,\pm 2\pmod {11}\). There are 11 equilateral tetrahedra \(p_i p_{i+1}p_{i+2}p_{i+3}\) in a realisation of \(G_{11}\). Let \(T:\mathbb {R}^3\rightarrow \mathbb {R}^3\) be the unique isometry that maps the tetrahedron \(p_0p_1p_2p_3\) to \(p_1p_2p_3p_4\), that is, \(T(p_i)=p_{i+1}\) for \(i=0,1,2,3\). Note that the vertex \(p_{i+4}\) is uniquely determined by \(p_i p_{i+1}p_{i+2}p_{i+3}\). In fact \(p_{i+4}\) is the reflection of \(p_i\) through the centroid of the triangle \(p_{i+1}p_{i+2}p_{i+3}\). It follows that \(T(p_i)=p_{i+1}\) for every i. Therefore the centroid \(c {:}{=}\frac{1}{11}\sum _{i=0}^{10}p_i\) is a fixed point of T and all points \(p_i\) are on a sphere with centre c. However, the points \(p_0,p_1,p_2,p_3,p_4\) are easily seen not to lie on a sphere (for example, by using Lemma 7) and we have a contradiction. Thus, by Lemma 11, there is no almost-equidistant set in \(\mathbb {R}^3\) on 11 points.

Fig. 6
figure 6

Non-realisable abstract almost-equidistant graphs in \(\mathbb {R}^3\) on 10 vertices

We have already described a realisation in \(\mathbb {R}^3\) of the graph from Fig. 2 in the proof of Theorem 5. It is unique up to congruence, and it is easy to check that there are no further unit distances between vertices. We next show that the other three graphs are not realisable in \(\mathbb {R}^3\).

The graph in part (a) of Fig. 6 consists of six copies of \(K_4\), namely \(p_0p_1p_2p_3\), \(p_1p_2p_3p_4\), \(p_2p_3p_4p_5\), \(p_4p_5p_6p_7\), \(p_5p_6p_7p_8\), \(p_6p_7p_8p_9\), together with the edges \(p_0p_9\), \(p_1p_9\) and \(p_0p_8\). We may choose coordinates \(p_4=(0,0,1/2)\), \(p_5=(0,0,-1/2)\), \(p_2=(\sqrt{3}/2,0,0)\), \(p_3=(1/(2\sqrt{3}), \sqrt{2/3},0)\), and then we will have \(p_7=(\frac{\sqrt{3}}{2}\cos \beta ,\frac{\sqrt{3}}{2}\sin \beta ,0)\) for some angle \(\beta\), and \(p_6=(\frac{\sqrt{3}}{2}\cos (\beta +\alpha ),\frac{\sqrt{3}}{2}\sin (\beta +\alpha ),0)\), where \(\cos \alpha =1/3\). Thus \(p_6=(\frac{1}{2\sqrt{3}}\cos \beta \mp \frac{\sqrt{2}}{\sqrt{3}}\sin \beta , \frac{1}{2\sqrt{3}}\sin \beta \mp \frac{\sqrt{2}}{\sqrt{3}}\cos \beta , 0)\). It is now simple to determine the coordinates of the remaining points by taking reflections. In particular, we obtain \(p_1 = (\frac{4}{3\sqrt{3}}, \frac{2\sqrt{2}}{3\sqrt{3}},\frac{5}{6})\) and \(p_9 = (\frac{20}{9\sqrt{3}}\cos \beta \mp \frac{10\sqrt{2}}{9\sqrt{3}}\sin \beta ,\frac{20}{9\sqrt{3}}\sin \beta \pm \frac{10\sqrt{2}}{9\sqrt{3}}\cos \beta ,-\frac{1}{18})\). If we now calculate the distance \(\left\Vert p_1-p_9\right\Vert\), we obtain either \(\sqrt{\frac{112}{27}-\frac{80}{27}\cos \beta }\) or \(\sqrt{\frac{112}{27}-\frac{80}{81}\cos \beta - \frac{160\sqrt{2}}{81}\sin \beta }\), depending on the sign of \(\sin \alpha\). However, both these expressions are larger than 1.

The graph in part (b) of Fig. 6 is the complement of the Petersen graph, and contains 5 copies of the graph of the regular octahedron, one for every induced matching of three edges in the Petersen graph. Each such octahedron is uniquely realisable in \(\mathbb {R}^3\). The octahedron \(O_1\) with diagonals \(\{p_0p_6, p_7p_9, p_3p_8\}\) and the octahedron \(O_2\) with diagonals \(\{p_0p_4, p_1p_3, p_2p_7\}\) have a common face \(p_0p_3p_7\). The only way to realise \(O_1\) and \(O_2\) is with the opposite faces \(p_6p_8p_9\) and \(p_4p_1p_2\) in two planes parallel to the plane of \(p_0p_3p_7\). Since an octahedron with edges of unit length has width \(\sqrt{2/3}\), we obtain that the distance between \(p_4\) and \(p_6\) (both opposite to \(p_0\) in \(O_1\) and \(O_2\), respectively) is \(2\sqrt{2/3}\), which is impossible, as they have to be at unit distance.

The graph in part (c) of Fig. 6 is a ring of 5 unit tetrahedra \(p_i q_i p_{i+1}q_{i+1}\), \(i=0,\dots ,4\) with indices taken modulo 5, with two successive ones joined at an edge \(p_iq_i\). Suppose for contradiction that we have a realisation of this graph in \(\mathbb {R}^3\). Let \(m_i\) be the midpoint of \(p_iq_i\) for each \(i \in \{0,\dots ,4\}\). The distance between \(m_i\) and \(m_{i+1}\) is \(r=1/\sqrt{2}\). Since each \(p_iq_i\) is orthogonal to \(p_{i+1}q_{i+1}\), it follows that \(m_i\), \(p_{i-1}q_{i-1}\), and \(p_{i+1}q_{i+1}\) lie in the same plane and the lines \(p_{i-1}q_{i-1}\) and \(p_{i+1}q_{i+1}\) are tangent to the circle \(C_i\) in this plane with centre \(m_i\) and radius r. If \(C_1\) and \(C_3\) were in the same plane, then the edges \(p_4q_4\) and \(p_0q_0\) of the tetrahedron \(p_0q_0p_4q_4\) would have to be coplanar. Therefore \(C_1\) and \(C_3\) are in different planes, but they have the same tangent line \(p_2q_2\) touching both at \(m_2\). It follows that they lie on a unique sphere \(\Sigma\). The lines \(p_0q_0\) and \(p_4q_4\) are tangent to \(\Sigma\) at \(m_0\) and \(m_4\), respectively. It follows that the plane \(\Pi _0\) through \(m_0\) orthogonal to \(p_0q_0\) and the plane \(\Pi _4\) through \(m_4\) orthogonal to \(p_4q_4\) both contain the centre c of \(\Sigma\). Thus \(c\in \Pi _0\cap \Pi _4\). Since both \(\Pi _0\) and \(\Pi _4\) contain \(m_0\) and \(m_4\), it follows that \(\Pi _0\cap \Pi _4\) is the line \(m_0m_4\), and it follows that \(c\in m_0m_4\), that is, \(\left\Vert m_0-m_4\right\Vert =r\) is a diameter of \(\Sigma\). However, \(\Sigma\) contains two circles on its boundary of radius r, a contradiction.

Thus there is only one realisable abstract almost-equidistant graph in \(\mathbb {R}^3\) on 10 vertices and, by Lemma 11, there is also a unique (up to congruence) almost-equidistant set in \(\mathbb {R}^3\) on 10 points.

3.3 Proof of Theorem 3

We want to show that \(12 \le f(4) \le 13\). To do so, we use the following result, which says that the graph in Fig. 7 is not realisable in \(\mathbb {R}^4\).

Fig. 7
figure 7

A non-realisable abstract almost-equidistant graph \(G_{10}\) in \(\mathbb {R}^4\) on 10 vertices. The missing edge \(\{p_2,p_4\}\) is denoted by a dotted segment

Lemma 12

The graph\(G_{10}\)in Fig. 7is not realisable in\(\mathbb {R}^4\).

Proof

The graph \(G_{10}\) is built up by starting with a cross-polytope with vertices \(p_0,\dots ,p_7\) and diagonals \(p_0p_4\), \(p_1p_5\), \(p_2p_6\), \(p_3p_7\), then removing edge \(p_2p_4\), and then adding vertices \(p_8\), \(p_9\) and edges \(p_8p_0\), \(p_8p_1\), \(p_8p_2\), \(p_8p_3\), \(p_8p_9\), \(p_9p_2\), \(p_9p_3\), \(p_9p_4\), \(p_9p_5\).

Suppose for contradiction that \(G_{10}\) has a realisation in \(\mathbb {R}^4\). We first show that the distance between \(p_2\) and \(p_4\) is necessarily 1. Note that \(G_{10}\) contains a copy of \(K_{4,4}\) with classes \(V_1=\{p_1,p_3,p_5,p_7\}\) and \(V_2=\{p_0,p_2,p_4,p_6\}\) as a subgraph. Similarly as in the proof of Lemma 11, it follows that \(V_1\) and \(V_2\) each lies on a circle with the same centre, which we take as the origin, in orthogonal 2-dimensional planes. The induced subgraph \(G_{10}[p_1,p_3,p_5,p_7]\) of \(G_{10}\) is a 4-cycle, hence the circle on which \(V_1\) lies has radius \(1/\sqrt{2}\). Therefore the circle on which \(V_2\) lies also has radius \(1/\sqrt{2}\) and, since the induced subgraph \(G_{10}[p_0,p_2,p_4,p_6]\) of \(G_{10}\) is a path of length 3, \(p_0,p_2,p_4,p_6\) also have to be the vertices of a square and \(\left\Vert p_2-p_4\right\Vert =1\).

Therefore we have a cross-polytope with diagonals \(p_ip_{i+4}\), \(i=0,1,2,3\). The graph of a cross-polytope can be realised in only one way in \(\mathbb {R}^4\) up to isometry. Thus we may choose coordinates so that \(p_0=-p_4=(1/\sqrt{2},0,0,0)\), \(p_1=-p_5=(0,1/\sqrt{2},0,0)\), \(p_2=-p_6=(0,0,1/\sqrt{2},0)\), \(p_3=-p_7=(0,0,0,1/\sqrt{2})\). Since \(p_0p_1p_2p_3p_8\) is a clique, \(p_8=(\lambda ,\lambda ,\lambda ,\lambda )\), where \(\lambda =(1\pm \sqrt{5})/(4\sqrt{2})\). Since \(p_2p_3p_4p_5p_9\) is a clique, we obtain similarly that \(p_9=(-\mu ,-\mu ,\mu ,\mu )\) where \(\mu =(-1\pm \sqrt{5})/(4\sqrt{2})\). However, then the distance \(\left\Vert p_8-p_9\right\Vert\) is one of the values \((\pm 1+\sqrt{5})/2\) or \(\sqrt{3/2}\), but it has to equal 1, a contradiction. \(\square\)

Now, we can proceed with the proof of Theorem 3. The lower bound of \(f(4) \ge 12\) follows from Theorem 5. A computer search shows that there are no abstract almost-equidistant graphs in \(\mathbb {R}^4\) on 17 or more vertices, a unique one on 16 vertices, a unique one on 15 vertices, and four on 14 vertices, three of which are minimal; see Figs. 8 and 9.

The first of these three consists of the graphs of a 3-dimensional octahedron \(q_0\cdots q_5\) and a 4-dimensional cross-polytope \(p_0\cdots p_7\) with a biregular graph between their respective vertex sets, as in part (a) of Fig. 8. It contains the graph \(G_{10}\) as a subgraph on vertices \(\{p_0,\dots , p_7\}\cup \{q_0,q_1\}\).

Fig. 8
figure 8

Two non-realisable abstract almost-equidistant graphs in \(\mathbb {R}^4\) on 14 vertices. We use colours on edges between the two cross-polytopes to emphasise the symmetries of the graphs. The missing edge \(\{p_1, p_3\}\) in b is denoted by a dotted segment

The second of these graphs (part (b) of Fig. 8) contains the graph \(G_{10}\) as an induced subgraph on vertices \(\{p_0\cdots p_7\} \cup \{q_1,q_5\}\). Note that the edge \(\{p_1,p_3\}\) is missing. Thus these two graphs are not realisable in \(\mathbb {R}^4\) by Lemma 12.

The last of the three graphs, called \(G_{14}\) and shown in Fig. 9, is the complement of the graph that is obtained from the cycle \(C_{14}\) by adding the diagonals and chords of length 4. We show that \(G_{14}\) is non-realisable in \(\mathbb {R}^4\) using an analogous approach as we used to show that the graph \(G_{11}\) is not realisable in \(\mathbb {R}^3\).

Suppose for contradiction that the graph \(G_{14}\) is realisable in \(\mathbb {R}^4\). We label the vertices \(p_0\) to \(p_{13}\), with subscripts modulo 14, such that \(\{p_i,p_j\}\) is an edge of \(G_{14}\) if and only if \(i-j\equiv \pm 2,\pm 3, \pm 5,\pm 6\pmod {14}\). There are 14 equilateral 4-simplices \(p_i p_{i+2}p_{i+5}p_{i+8}p_{i+11}\) in a realisation of \(G_{14}\). Let \(T:\mathbb {R}^4\rightarrow \mathbb {R}^4\) be the unique isometry that maps the simplex \(p_0p_2p_5p_8p_{11}\) to \(p_3p_5p_8p_{11}p_0\), that is, \(T(p_i)=p_{i+3}\) for \(i=0,2,5,8,11\). Note that the vertex \(p_{i+3}\) is the reflection of \(p_{i+2}\) through the centroid of the tetrahedron \(p_i p_{i+5}p_{i+8}p_{i+11}\) and thus it is uniquely determined by \(p_i p_{i+5}p_{i+8}p_{i+11}\). It follows that \(T(p_i)=p_{i+3}\) for every i. Therefore the centroid \(c {:}{=}\frac{1}{14}\sum _{i=0}^{13}p_i\) is a fixed point of T and all points \(p_i\) are on a sphere with centre c. However, the points \(p_0,p_2,p_3,p_5,p_8,p_{11}\) are easily seen not to lie on a sphere (for example, by using Lemma 7), a contradiction.

Using Lemma 11, we conclude that every almost-equidistant set in 4-space of maximum cardinality has at most 13 points.

Fig. 9
figure 9

The non-realisable abstract almost-equidistant graph \(G_{14}\) in \(\mathbb {R}^4\) on 14 vertices

3.4 Proof of Theorem 4

Here, we prove the estimates \(f(6)\ge 18\), \(f(7)\ge 20\), and \(f(9)\ge f(8)\ge 24\) using the construction of Larman and Rogers [16] that gives \(f(5) \ge 16\). The computer search for the upper bounds is described in the next section.

We first briefly describe the Larman–Rogers construction of an almost-equidistant set of 16 points in \(\mathbb {R}^5\). Let V be the set of vertices of the cube \(\{\pm 1\}^5\) in \(\mathbb {R}^5\) with an odd number of positive signs. It is easy to check that \(\left|V\right|=16\) and that for any three points in V, some two differ in exactly two coordinates. Moreover, any two points differ in either two or four coordinates and then their distance is \(\sqrt{8}\) or 4, respectively. It follows that \(S {:}{=}\frac{1}{\sqrt{8}}V\) is an almost-equidistant set in \(\mathbb {R}^5\). Also note that the norm of every vector from S is exactly \(\sqrt{5/8}\).

Consider \(\mathbb {R}^6=E_1\oplus \mathbb {R}e\) where \(\dim E_1=5\) and e is a unit vector orthogonal to \(E_1\). We place S in \(E_1\) and show that \(S\cup \{\pm \sqrt{3/8} e\}\) is an almost-equidistant set of 18 points in \(\mathbb {R}^6\). Since S is an almost-equidistant set in \(\mathbb {R}^5\), it suffices to check triples of points from \(S\cup \{\pm \sqrt{3/8} e\}\) containing points from \(\{\pm \sqrt{3/8} e\}\). Let T be such a triple. Then T contains a point p from S and q from \(\{\pm \sqrt{3/8} e\}\). Since p and q are orthogonal, we obtain \(\left\Vert p-q\right\Vert ^2 = \left\langle p, p \right\rangle - 2\left\langle p, q \right\rangle + \left\langle q, q \right\rangle = 5/8+0+3/8=1\). Thus T contains a pair of points at unit distance and, consequently, \(f(6) \ge 18\).

Next consider \(\mathbb {R}^7=E_1\oplus E_2\), where \(\dim E_1=5\), \(\dim E_2=2\), and \(E_1\perp E_2\). We place S in \(E_1\) and \(S'{:}{=}\{(\pm \frac{1}{2},\pm \frac{1}{\sqrt{8}})\}\) in \(E_2\). We show that \(S\cup S'\) is an almost-equidistant set of 20 points in \(\mathbb {R}^7\). Again, since S is an almost-equidistant set in \(\mathbb {R}^5\), we only need to check triples T of points from \(S\cup S'\) containing some of the vectors from \(S'\). Analogously as before, the distance between every point from \(S'\) and every point of S is 1, as the norm of every vector from \(S'\) is \(\sqrt{3/8}\) and \(E_1\perp E_2\). We can thus assume \(T \subseteq S'\). If two vectors from \(S'\) differ only in the first coordinate, then their distance is 1. Since every triple of vectors from \(S'\) contains a pair of vectors that differ only in the first coordinate, we obtain that T contains a pair of points at unit distance and thus \(f(7) \ge 20\).

Next consider \(\mathbb {R}^8=E_1\oplus E_3\) where \(\dim E_1=5\) and \(\dim E_3=3\). We place S in \(E_1\) and \(S' {:}{=}\frac{1}{\sqrt{8}}\{\pm 1\}^3\) in \(E_2\). Again, it suffices to check triples T of points from \(S \cup S'\) with \(T \cap S' \ne \emptyset\). The distance between every point in S and every point in \(S'\) again equals 1 and thus we can assume \(T \subseteq S'\). Every triple of points from \(S'\) contains a pair of points that differ in exactly two coordinates and so they are at distance 1. Thus \(S'\) is an almost-equidistant set of 8 points. It follows that \(S\cup S'\) is an almost-equidistant set of 24 points in \(\mathbb {R}^8\), which implies that \(f(9)\ge f(8)\ge 24\).

3.5 The Computer Search

In this subsection we describe how we computed the entries as stated in Tables 2 and 3, and also the upper bounds as stated in Table 1.

First, we describe our simple approach to generate all n-vertex abstract almost-equidistant graphs in \(\mathbb {R}^d\) for given n and d. We start with a single vertex and repeatedly add a new vertex and go through all possibilities of joining the new vertex to the old vertices. For each possibility of adding edges, we check if the resulting graph contains one of the two forbidden subgraphs and that its complement does not contain a triangle. We use two tricks to speed this up. First, when adding a vertex, we can assume that the newly inserted vertex has minimum degree in the extended graph. Secondly, we only have to go through all possibilities of adding at least \(n-d-1\) new edges, where n is the number of vertices before extending the graph. This is because the degree of the newly added vertex has to be at least \(n-d-1\), since the complement of an abstract almost-equidistant graph G is triangle-free, hence the non-neighbours of each vertex induce a clique in G, which has at most \(d+1\) vertices. To find all minimal graphs, we repeatedly attempt to remove an edge and check that the complement is still triangle-free. Once this is no longer possible, we know that we have a minimal abstract almost-equidistant graph.

We implemented this approach in Sage and used it to obtain all abstract almost-equidistant graphs in \(\mathbb {R}^d\) for \(d\in \{2,3,4\}\). To find all abstract almost-equidistant graphs in \({\mathbb {R}}^5\) on at most 15 vertices and in \({\mathbb {R}}^6\) on at most 13 vertices, we used a C++ implementation of this approach. The obtained numbers of abstract almost-equidistant graphs are summarized in Table 3.

Unfortunately, our program was not able to find all minimal abstract almost-equidistant graphs in \({\mathbb {R}}^d\) on n vertices for \(d \ge 5\) and large n in reasonable time. To do this, we used the programs Triangleramsey [8, 9] by Brinkmann, Goedgebeur, and Schlage-Puchta and MTF [6, 7] by Brandt, Brinkmann, and Harmuth. These programs generate all minimal \(K_{d+2}\)-free graphs with no \(K_3\) in their complement, the so-called Ramsey \((3,d+2)\)-graphs. For each Ramsey \((3,d+2)\)-graph on the output we tested whether it is a minimal abstract almost-equidistant graph in \({\mathbb {R}}^d\) using a simple C++ program that checks forbidden subgraphs from Lemma 11. This allowed us to find all minimal abstract almost-equidistant graphs in \(\mathbb {R}^5\) and all minimal abstract almost-equidistant graphs in \({\mathbb {R}}^6\) with at most 19 vertices; see Table 2. We were also able to find some minimal abstract almost-equidistant graphs in \({\mathbb {R}}^6\) on 25 vertices.

To improve the upper bounds on f(d) for \(d \in \{5,6,7\}\), we checked forbidden subgraphs in all minimal Ramsey (3, 7)-graphs on 21 and 22 vertices, minimal Ramsey (3, 8)-graphs on 27 vertices, and minimal Ramsey (3, 9)-graphs on 35 vertices, respectively. A complete list of these graphs is available on the website [17] of McKay. Since none of these graphs are abstract almost-equidistant, we obtain \(f(5) \le 20\), \(f(6) \le 26\), and \(f(7) \le 34\); see Table 1.

The source code of our programs and the files are available on a separate website [24].

4 A More General Setting

We consider the following natural generalization of the problem of determining the maximum sizes of almost-equidistant sets. For positive integers d, k, and l with \(l \le k\), let f(dkl) be the maximum size of a point set P in \({\mathbb {R}}^d\) such that among any \(k+1\) points from P there are at least \(l+1\) points that are pairwise at unit distance. Since every subset of \({\mathbb {R}}^d\) with all pairs of points at unit distance has size at most \(d+1\), we have \(f(d,1,1)=d+1\) for every d. In the case \(k=2\) and \(l=1\), Theorems 5 and 6 give \(2d+4 \le f(d,2,1) \le O(d^{3/2})\) for every \(d \ge 3\). In this section, we discuss the problem of determining the growth rate of f(dkl) for larger values of d, k, and l.

A similar problem, where the notion of unit distance is replaced by orthogonality, has been studied by several authors [3, 10, 12, 23]. More specifically, for positive integers d, k, and l with \(l \le k\), let \(\alpha (d,k,l)\) be the maximum size of a set V of nonzero vectors from \({\mathbb {R}}^d\) such that among any \(k+1\) vectors from V there are at least \(l+1\) pairwise orthogonal vectors. Füredi and Stanley [12] showed that \(\alpha (d,k,l) \le (1+o(1))\sqrt{\pi d/(2l)}((l+1)/l)^{d/2-1}k\). Alon and Szegedy [3] used a probabilistic argument to show the following lower bound on \(\alpha (d,k,l)\).

Theorem 13

([3]) For every fixed positive integerlthere are some\(\delta =\delta (l)>0\) and \(k_0(l)\)such that for every\(k \ge k_0(l)\)and every\(d \ge 2\log {k}\),

$$\begin{aligned} \alpha (d,k,l) \ge d^{\delta \log {(k+2)}/\log {\log {(k+2)}}}, \end{aligned}$$

where the logarithms are base 2.

Let d, k, and l be positive integers with \(d \ge 2\log {k}\) and with k sufficiently large with respect to l. It follows from the proof of Theorem 13 that there is a \(\delta =\delta (l)>0\) and a subset \(F=F(d,k,l)\) of \(\{-1,1\}^d\) of size at least \(d^{\delta \log {(k+2)}/\log {\log {(k+2)}}}\) such that among any \(k+1\) vectors from F there are at least \(l+1\) pairwise orthogonal vectors. We define the set \(P_F=\frac{1}{\sqrt{2d}} \cdot F = \left\{ p_v=(v_1/\sqrt{2d},\dots ,v_d/\sqrt{2d})\;\Big |\;v=(v_1,\dots ,v_d) \in F\right\}\). Clearly, \(|P_F|=|F|\). Since \(F \subseteq \{-1,1\}^d\), it is not difficult to verify that any two points \(p_u\) and \(p_v\) from \(P_F\) are at unit distance if and only if the vectors u and v from F are orthogonal. It follows that for every fixed positive integer l there are some \(\delta =\delta (l)>0\) and \(k_0(l)\) such that for every \(k \ge k_0(l)\) and every \(d \ge 2\log {k}\),

$$\begin{aligned} f(d,k,l) \ge d^{\delta \log {(k+2)}/\log {\log {(k+2)}}}. \end{aligned}$$

Let dkl be positive integers. The following simple argument, which is based on an estimate on the chromatic number of \({\mathbb {R}}^d\), gives an upper bound on f(dkl) that is linear in k and exponential in d.

Let P be a set of points in \({\mathbb {R}}^d\) such that among any \(k+1\) points from P there are \(l+1\) points that are pairwise at unit distance. Let G be the unit-distance graph for P. Let c be a colouring of G with \(m {:}{=}\chi (G)\) colours and let \(P=C_1 \cup \cdots \cup C_m\) be the colour classes induced by c. For every unit-distance graph H in \({\mathbb {R}}^d\), Larman and Rogers [16] showed that \(\chi (H) \le (3+o(1))^d\). We thus have \(m \le (3+o(1))^d\). Since there are at least \(l+1 \ge 1\) edges among any set of \(k+1\) vertices of G, we have \(|C_i| \le k\) for every \(i \in \{1,\dots ,m\}\). In particular, \(|P| \le mk \le (3+o(1))^d k\). We thus obtain the following estimate.

Proposition 14

For any\(k\ge 2\),

$$\begin{aligned} f(d,k,l) \le (3+o(1))^d k. \end{aligned}$$