1 Introduction

Constructing lattice squares in the integer lattice \({\mathbb {Z}}^2\) is easy as an arbitrary vector \((a,b)\in {\mathbb {Z}}^2\) generates a lattice square with \((-b,a)\). The analogous problem in dimension three is to find lattice cubes in \({\mathbb {Z}}^3\). Although there are axis-parallel lattice cubes, still many other constructions exist, which are much more complicated to construct as there is no canonical rotation in dimension three.

One early result on lattice cubes is due to Sárközy [8], who described some constructions of lattice cubes and determined the number of certain lattice cubes in 1961. This topic is still researched, Ionascu studied lattice cubes in dimensions 2, 3, 4 and determined their Ehrhart polynomial in his recently published paper [4].

If the edge length of a lattice cube is d, then its volume \(d^3\) is the determinant of the edge vectors, so it is an integer, while the squared edge length \(d^2\) is also an integer. This means that the edge length d is an integer. The following statement is an easy consequence of the description of the Pythagorean quadruples (see [1, 9]). If the length of a vector \({\textbf{v}}\in {\mathbb {Z}}^3\) is an integer, then \({\textbf{v}}\) can be extended to a lattice cube. An algorithmic proof is found in [7]. Similar questions are discussed in dimension four using Hurwitz integral quaternions by Kiss and Kutas [6].

A lattice cube can be easily extended to a cubic sublattice, which is a sublattice having such basis whose elements are pairwise orthogonal and of equal lengths. In this situation, it is natural to ask which cubic sublattices contain a given vector \({\textbf{v}}\in {\mathbb {Z}}^3\) not necessarily as a basis vector. If the edge length of the cubic sublattice is d, then \(d^2\) must divide the squared length of \({\textbf{v}}\). Our goal is to show that this condition is sufficient in the following sense.

Theorem 1

For a vector \({\textbf{v}}\in {\mathbb {Z}}^3\) whose squared length is divisible by \(d^2\) for an integer d, there exists a cubic sublattice containing \({\textbf{v}}\) with edge length d. If \({\textbf{v}}\) is primitive (i.e., its coordinates are coprime), then this cubic sublattice is unique.

For example, the squared length of the vector \({\textbf{v}}=(5,5,2)\) is 54, which is divisible by 9, so there exists a cubic sublattice containing \({\textbf{v}}\) with edge length 3. This cubic sublattice is generated by the basis \({\textbf{e}}_1=(-1,2,2)\), \({\textbf{e}}_2=(2,-1,2)\), \({\textbf{e}}_3=(2,2,-1)\), and the vector \({\textbf{v}}\) can be written as \({\textbf{v}}={\textbf{e}}_1+{\textbf{e}}_2+2{\textbf{e}}_3\).

There might be several suitable cubic sublattices if \({\textbf{v}}\) is not primitive. For instance, the vector \({\textbf{v}}=(5,0,0)\) is contained in the cubic sublattices with edge length \(d=5\) generated by bases \(\{(5,0,0),(0,5,0),(0,0,5)\}\) and \(\{(5,0,0),(0,3,4),(0,4,-3)\}\).

For the uniqueness, it is enough to assume that the greatest positive divisor k of \({\textbf{v}}\) and d are coprime. Indeed, we show that the primitive vector \({\textbf{u}}={\textbf{v}}/k\) is also contained in the cubic sublattice \(\Gamma \) given by the theorem for \({\textbf{v}}\) when d and k are coprime. In the group \({\mathbb {Z}}^3/\Gamma \), the order of \({\textbf{u}}\Gamma \) divides k and the order \(d^3\) of the group by Lagrange’s theorem, hence the order of \({\textbf{u}}\Gamma \) is 1.

For the greatest possible value of d, i.e., in the case when \(\Vert {\textbf{v}}\Vert ^2/d^2\) is square-free, Theorem 1 was proved in [3] by Goswick et al. using the decomposition theory of Hurwitz integral quaternions. Our proof builds solely on the structure of the three-dimensional Euclidean space and some basic facts about lattice geometry.

Let \({\textbf{v}}=(5,8,19)\) for which \(\Vert {\textbf{v}}\Vert ^2=450=2\cdot 15^2\). In that case, d might be 3, 5, or 15, so our theorem gives three cubic sublattices, while the method of [3] constructs a cubic sublattice only for \({d=15}\).

Finally, we give a number-theoretic corollary by considering the squared length of the vector \({\textbf{v}}\). When a number \(d^2m\) (where d and m are integers) is a sum of three squares, then m is also a sum of three squares. This is not surprising because Legendre’s three-square theorem states that a natural number is a sum of three squares if and only if it is not of the form \(4^n(8k+7)\). As a primitive vector remains primitive vector in the cubic sublattice, we can formulate a similar corollary: If an integer \(d^2m\) is a sum of three coprime squares, then m is also a sum of three coprime squares. We will discuss the converse of this claim after Theorem 3 at the end of Sect. 4.

In Sect. 2, we introduce some definitions and propositions from lattice geometry. Section 3 is devoted to the proof of Theorem 1. Then we characterize the cubic sublattices of \({\mathbb {Z}}^3\) and we prove a kind of reverse theorem in Sect. 4. Finally, we investigate cubic sublattices as a partial ordered set in Sect. 5.

2 Preliminaries

In this section, we summarize some basic definitions and statements without proof. We refer to [2] for more details on lattice geometry. After that we prove some easy propositions which will be used later.

Let \(\Lambda \) be an n-dimensional lattice in a real vector space. We say that a subgroup \(K<\Lambda \) is a sublattice if K is also an n-dimensional lattice. This is equivalent to the finiteness of the index of K in \(\Lambda \). If some linearly independent vectors in \(\Lambda \) form a basis in the intersection of \(\Lambda \) and the linear subspace generated by them, then these vectors can be extended to a basis of \(\Lambda \). The parallelepiped generated by the basis of the lattice is called fundamental parallelepiped. When a scalar product or just a volume form is given on the vector space, the volume of the fundamental parallelepiped does not depend on the choice of the basis of the lattice. For a sublattice \(K\subseteq \Lambda \), the ratio of the volumes of the fundamental parallelepipeds is equal to the index of K in \(\Lambda \) as a subgroup.

We say that a vector \({\textbf{v}}\in \Lambda \) is divisible by a positive integer k if there exists a vector \({\textbf{u}}\in \Lambda \) such that \({\textbf{v}}=k{\textbf{u}}\). A vector \({\textbf{v}}\in \Lambda \) is called primitive if there is not any positive integer \(k\ne 1\) which divides \({\textbf{v}}\). For a non-zero vector \({\textbf{v}}\in \Lambda \), there exists a unique primitive vector \({\textbf{u}}\) and a unique positive integer k such that \({\textbf{v}}=k{\textbf{u}}\). In this case, we say that k is the greatest divisor of \({\textbf{v}}\). The vectors that are divisible by a positive integer k form a sublattice in \(\Lambda \), it will be denoted by \(k\Lambda \). The index of \(k\Lambda \) in \(\Lambda \) is \(k^n\).

Fixing a basis \(\{{\textbf{e}}^1,\dots ,{\textbf{e}}^n\}\) of \(\Lambda \), we can identify \(\Lambda \) with \({\mathbb {Z}}^n\) by using the coordinates \((v_1,\dots ,v_n)\) of a vector \({\textbf{v}}\in \Lambda \) with respect to this basis. A vector is divisible by k if and only if its coordinates so are. A vector is primitive if and only if its coordinates are coprime. The standard embedding \({\mathbb {Z}}^n\subseteq \mathbb R^n\) and the Euclidean vector space structure of \(\mathbb R^n\) define the dot product on \(\Lambda \). In particular, the perpendicularity of two vectors of \(\Lambda \) and the length \(\Vert {\textbf{v}}\Vert \) of a vector \({\textbf{v}}\in \Lambda \) are defined. In this case, the volume of the fundamental parallelepiped is the determinant of the basis vectors.

From now, we consider the case \(n=3\). The advantage of this dimension is the applicability of the cross product. We say that a sublattice \(\Gamma \) of the standard lattice \({\mathbb {Z}}^3\) is a cubic sublattice if there exists a basis of \(\Gamma \) whose elements are pairwise orthogonal and of equal lengths. Such basis is called cubic basis, and their common length d is the edge length. When we have a cubic sublattice \(\Gamma \subset {\mathbb {Z}}^3\), we can identify \(\Gamma \) with \({\mathbb {Z}}^3\), so we can measure the vectors of \(\Gamma \) with respect to this identification.

For a non-zero vector \({\textbf{v}}\in {\mathbb {Z}}^3\), the set of the orthogonal vectors to \({\textbf{v}}\) will be denoted by \({\textbf{v}}^\perp \).

Proposition 1

For a non-zero vector \({\textbf{v}}=(v_1,v_2,v_3)\in {\mathbb {Z}}^3\), the set \({\textbf{v}}^\perp \) is a two-dimensional lattice.

Proof

Obviously, \({\textbf{v}}^\perp \) is a discrete subgroup. Its dimension is at most 2, we show that it is exactly 2. We can assume that \(v_3\ne 0\), so none of the linear combinations of \({\textbf{e}}^1,{\textbf{e}}^2\) is parallel to \({\textbf{v}}\). In this case, the linearity of the cross product yields that the vectors \({\textbf{e}}^1\times {\textbf{v}},{\textbf{e}}^2\times {\textbf{v}}\in {\textbf{v}}^\perp \) are linearly independent. \(\square \)

Proposition 2

For a primitive vector \({\textbf{v}}\in {\mathbb {Z}}^3\), the area of the fundamental parallelogram in \({\textbf{v}}^\perp \) is equal to the length of \({\textbf{v}}\).

Proof

The area of the fundamental parallelogram equals the length of the cross product \(\tilde{{\textbf{v}}}\) of the generating vectors. As \({\textbf{v}}\) is primitive, \(\tilde{{\textbf{v}}}\) is a multiple of \({\textbf{v}}\). Every pair of the vectors \({\textbf{e}}^i\times {\textbf{v}}\), \(i=1,2,3\), generates a sublattice of \({\textbf{v}}^\perp \), unless \(\Vert {\textbf{v}}\Vert =1\). The cross product of the generators is

$$\begin{aligned} ({\textbf{e}}^i\times {\textbf{v}})\times ({\textbf{e}}^j\times {\textbf{v}})=({\textbf{v}}\cdot ({\textbf{e}}^i\times {\textbf{e}}^j))\hspace{0.7222pt}{\textbf{v}}=\pm v_k{\textbf{v}}, \end{aligned}$$

where \(i,j,k\in \{1,2,3\}\) are distinct indices. These vectors are multiples of \(\tilde{{\textbf{v}}}\). As \({\textbf{v}}\) is primitive, the coefficients \(v_1,v_2,v_3\) are coprime, hence \(\tilde{{\textbf{v}}}=\pm {\textbf{v}}\). \(\square \)

Fixing a primitive vector \({\textbf{v}}\), let the vectors \(\textbf{a},\textbf{b}\in {\mathbb {Z}}^3\) be equivalent if their difference is a multiple of \({\textbf{v}}\). Then the cross product with \({\textbf{v}}\) is a well-defined map \(\Phi _{{\textbf{v}}}\) from the equivalence classes to \({\textbf{v}}^\perp \).

Proposition 3

The map \(\Phi _{{\textbf{v}}}\) is a bijection.

Proof

If the cross products with \({\textbf{v}}\) are equal for two vectors of \({\mathbb {Z}}^3\), then their difference is parallel to \({\textbf{v}}\). This means that \(\Phi _{{\textbf{v}}}\) is injective.

For the surjectivity, consider a vector \(k{\textbf{u}}\in {\textbf{v}}^\perp \), where \({\textbf{u}}\) is primitive and k is an integer. The vector \({\textbf{v}}\) is primitive in \({\textbf{u}}^\perp \), so there exists a vector \(\textbf{w}\) such that \(\{{\textbf{v}},\textbf{w}\}\) is a basis of \({\textbf{u}}^\perp \). Then the cross product \(\textbf{w}\times {\textbf{v}}\) is \(\pm {\textbf{u}}\), so \(\pm k\textbf{w}\times {\textbf{v}}=k{\textbf{u}}\), hence \(\Phi _{{\textbf{v}}}\) is surjective. \(\square \)

3 The Proof of Theorem 1

It is enough to prove the theorem for primitive vector \({\textbf{v}}\). Indeed, if \({\textbf{v}}=k{\textbf{u}}\) for a primitive vector \({\textbf{u}}\in {\mathbb {Z}}^3\), and \(d^2\) divides the squared length \(\Vert {\textbf{v}}\Vert ^2=k^2\Vert {\textbf{u}}\Vert ^2\), then there exists a decomposition \(d=d_1d_2\) such that \(d_1\) divides k and \(d_2^2\) divides \(\Vert {\textbf{u}}\Vert ^2\). Applying the theorem for \(d_2\) and \({\textbf{u}}\), we get a cubic sublattice \(\Gamma \). Then the cubic sublattice \(d_1\Gamma \) has edge length \(d_1d_2=d\) and contains \(d_1{\textbf{u}}\), therefore also \({\textbf{v}}\).

First we prove the uniqueness part of the theorem in case \({\textbf{v}}\) is primitive. Suppose that we have a cubic sublattice \(\Gamma \) containing \({\textbf{v}}\) with edge length d. The first lemma is the key observation.

Lemma 1

If \(\textbf{a},\textbf{b}\in \Gamma \), then \(\textbf{a}\times \textbf{b}\) is divisible by d, and \(\textbf{a}\times \textbf{b}/d\in \Gamma \).

Proof

Computing the cross product of \(\textbf{a}\) and \(\textbf{b}\) with respect to the Euclidean structure of \(\Gamma \cong {\mathbb {Z}}^3\subset \mathbb R^3\), we get \(\textbf{a}\times \textbf{b}/d\), which implies the statement. \(\square \)

Let us consider the example shown in the introduction for \({\textbf{v}}=(5,5,2)\). The vectors \({\textbf{e}}_1=(-1,2,2)\), \({\textbf{e}}_2=(2,-1,2)\), \({\textbf{e}}_3=(2,2,-1)\) form a cubic basis of a cubic sublattice \(\Gamma \) with edge length \(d=3\). We have

$$\begin{aligned} {\textbf{e}}_1\times {\textbf{e}}_2=(-1,2,2)\times (2,-1,2)=(6,6,-3)=3{\textbf{e}}_3, \end{aligned}$$

as we expect because \({\textbf{e}}_1\times {\textbf{e}}_2={\textbf{e}}_3\) using the cross product of the cubic sublattice \(\Gamma \).

Lemma 1 allows us to characterize the elements of \(\Gamma \) with the help of the cross product. Firstly we do that only in \({\textbf{v}}^\perp \). Lemma 1 yields that \(\textbf{a}\times {\textbf{v}}\) is divisible by d for \(\textbf{a}\in \Gamma \), so consider the following subset of \({\textbf{v}}^\perp \):

$$\begin{aligned} M({\textbf{v}},d)=\{\textbf{a}\in {\textbf{v}}^\perp \mid \textbf{a}\times {\textbf{v}} \text { is divisible by }d\}. \end{aligned}$$

We have that \(M({\textbf{v}},d)\) contains the intersection \({\textbf{v}}^\perp \cap \Gamma \). Later we will see that these sets are coincide. By the linearity of the cross product, \(M({\textbf{v}},d)\) is a subgroup. The next lemma shows that it is a sublattice.

Lemma 2

The index of \(M({\textbf{v}},d)\) in \({\textbf{v}}^\perp \) is d.

Proof

Let i denote the index of \(M({\textbf{v}},d)\) in \({\textbf{v}}^\perp \). Firstly we prove that i is divisible by d. As the vector \({\textbf{v}}=(v_1,v_2,v_3)\) is primitive, there exist integers \(t_1,t_2,t_3\) such that \(t_1v_1+t_2v_2+t_3v_3=1\). Consider the vector \(\textbf{t}=(t_1,t_2,t_3)\), and put \({\textbf{u}}=\textbf{t}\times {\textbf{v}}\in {\textbf{v}}^\perp \). Then

$$\begin{aligned} {\textbf{u}}\times {\textbf{v}}= & {} (\textbf{t}\times {\textbf{v}})\times {\textbf{v}}\\= & {} (\textbf{t}\cdot {\textbf{v}}){\textbf{v}}-({\textbf{v}}\cdot {\textbf{v}})\textbf{t}={\textbf{v}}-\ell ^2\textbf{t}=(v_1-\ell ^2t_1,v_2-\ell ^2t_2,v_3-\ell ^2t_3). \end{aligned}$$

This vector is not divisible by any non-unit divisor of d, otherwise such a divisor would divide \(\ell ^2\) and \(v_1,v_2,v_3\), which would contradict the primitiveness of \({\textbf{v}}\). Thus, the vectors \({\textbf{u}}\times {\textbf{v}},2{\textbf{u}}\times {\textbf{v}},\dots ,(d-1)\hspace{0.49988pt}{\textbf{u}}\times {\textbf{v}}\) are not divisible by d, so the vectors \({\textbf{u}},2{\textbf{u}},\dots ,(d-1)\hspace{0.49988pt}{\textbf{u}}\) are not contained in \(M({\textbf{v}},d)\). The vector \(d{\textbf{u}}\) belongs to \(M({\textbf{v}},d)\) by definition. In the group \(\langle {\textbf{u}}\rangle \) generated by \({\textbf{u}}\in {\textbf{v}}^\perp \), the subgroup \(\langle {\textbf{u}}\rangle \cap M({\textbf{v}},d)\) has index d, hence i is a multiple of d by Noether’s isomorphism theorem (see, for example, [5, Theorem 1.9]).

Now we prove that i divides d. Consider the vectors

$$\begin{aligned} \textbf{r}^1&=d{\textbf{e}}^1\times {\textbf{v}}=(0,-dv_3,dv_2),\\ \textbf{s}^1&=\frac{\textbf{r}^1\times {\textbf{v}}}{d}=({\textbf{e}}^1\times {\textbf{v}})\times {\textbf{v}}=(-v_2^2-v_3^2,v_1v_2,v_1v_3). \end{aligned}$$

We have that \(\textbf{r}^1\in M({\textbf{v}},d)\) and \(\textbf{r}^1\perp \textbf{s}^1\). As \(\textbf{r}^1\) is perpendicular to \({\textbf{v}}\), we have

$$\begin{aligned} \textbf{s}^1\times {\textbf{v}}=\frac{1}{d}\hspace{0.55542pt}(\textbf{r}^1\times {\textbf{v}})\times {\textbf{v}}=-\frac{\ell ^2}{d}\textbf{r}^1, \end{aligned}$$

which means that \(\textbf{s}^1\in M({\textbf{v}},d)\). The area of the rectangle spanned by \(\textbf{r}^1\) and \(\textbf{s}^1\) is \(\Vert \textbf{r}^1\Vert ^2\ell /d=d\ell \hspace{0.33325pt}(v_2^2+v_3^2)\). By Proposition 2, the area of the fundamental parallelogram in \({\textbf{v}}^\perp \) is \(\ell \). The index of the sublattice generated by \(\textbf{r}^1\) and \(\textbf{s}^1\) in \({\textbf{v}}^\perp \) is the quotient of the areas of the fundamental parallelograms, which is equal to \(d\hspace{0.33325pt}(v_2^2+v_3^2)\). This shows that i divides \(d\hspace{0.33325pt}(v_2^2+v_3^2)\). We get similarly that i also divides \(d\hspace{0.33325pt}(v_1^2+v_3^2)\) and \(d\hspace{0.33325pt}(v_1^2+v_2^2)\), which yields that i divides the greatest common divisor

$$\begin{aligned}&\gcd {\bigl (d\hspace{0.33325pt}(v_2^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_2^2)\bigr )}\\&\qquad =d\gcd {(v_2^2+v_3^2,v_1^2+v_3^2,v_1^2+v_2^2)}\\&\qquad =d\gcd {(v_2^2+v_3^2,v_1^2+v_3^2,v_1^2+v_2^2,v_2^2-v_3^2,v_1^2-v_3^2,v_1^2-v_2^2)}\\&\qquad =d\gcd {(2v_1^2,2v_2^2,2v_3^2,v_2^2+v_3^2,v_1^2+v_3^2,v_1^2+v_2^2)}. \end{aligned}$$

Using \(\gcd \hspace{0.88882pt}(v_1,v_2,v_3)=1\), we obtain \(\gcd {(d\hspace{0.33325pt}(v_2^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_2^2))}=d\) if \(v_1,v_2,v_3\) are not all odd. This implies the statement in this case. If \(v_1,v_2,v_3\) are all odd, then \(\gcd {(d\hspace{0.33325pt}(v_2^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_3^2),d\hspace{0.33325pt}(v_1^2+v_2^2))}=2d\), so we have that i divides 2d. In this case, \(\ell ^2=v_1^2+v_2^2+v_3^2\) is odd, so is d. The sublattice \(d{\textbf{v}}^\perp \) is contained in \(M({\textbf{v}},d)\), and its index is \(d^2\). Therefore i divides \(\gcd \hspace{0.88882pt}(2d,d^2)=d\). \(\square \)

Lemma 1 implies for a vector \(\textbf{a}\in \Gamma \) that \(\textbf{a}\times {\textbf{v}}\) is divisible by d and \(\textbf{a}\times {\textbf{v}}/d\in \Gamma \). Since \(\textbf{a}\times {\textbf{v}}/d\in {\textbf{v}}^\perp \) as well, we obtain \(\textbf{a}\times {\textbf{v}}/d\in M({\textbf{v}},d)\). This motivates the definition of the set

$$\begin{aligned} \Gamma ({\textbf{v}},d)&=\{\textbf{a}\in {\mathbb {Z}}^3\mid \textbf{a}\times {\textbf{v}}/d\in M({\textbf{v}},d)\}\\&=\{\textbf{a}\in {\mathbb {Z}}^3\mid \textbf{a}\times {\textbf{v}}\text { is divisible by }d\text { and }(\textbf{a}\times {\textbf{v}})\times {\textbf{v}}\text { is divisible by } d^2\}. \end{aligned}$$

We have \(\Gamma \subseteq \Gamma ({\textbf{v}},d)\) and \({\textbf{v}}\in \Gamma ({\textbf{v}},d)\). As the cross product is linear, \(\Gamma ({\textbf{v}},d)\) is a subgroup. The following lemma shows that \(\Gamma ({\textbf{v}},d)\) is a sublattice.

Lemma 3

The index of \(\Gamma ({\textbf{v}},d)\) in \({\mathbb {Z}}^3\) is \(d^3\).

Proof

The sublattice \(\Gamma ({\textbf{v}},d)\) contains such vectors \(\textbf{a}\in {\mathbb {Z}}^3\) that \(\textbf{a}\times {\textbf{v}}\in dM({\textbf{v}},d)\). By Proposition 3, the index of \(\Gamma ({\textbf{v}},d)\) in \({\mathbb {Z}}^3\) is equal to the index of \(dM({\textbf{v}},d)\) in \({\textbf{v}}^\perp \). As \(M({\textbf{v}},d)\) has index d in \({\textbf{v}}^\perp \), the index of the sublattice \(dM({\textbf{v}},d)\) in \({\textbf{v}}^\perp \) is \(d^3\). \(\square \)

Since the index of \(\Gamma \) is \(d^3\) as well, if there exists an appropriate cubic sublattice, then it is \(\Gamma ({\textbf{v}},d)\), which proves the uniqueness part of Theorem 1.

Now we prove that \(\Gamma ({\textbf{v}},d)\) is indeed a cubic sublattice. The first step is to show that the dot products of the elements of \(\Gamma ({\textbf{v}},d)\) are divisible by \(d^2\), but we have to start with weaker lemmas.

Lemma 4

For a vector \(\textbf{a}\in \Gamma ({\textbf{v}},d)\), the dot product \(\textbf{a}\cdot {\textbf{v}}\) is an integer and it is divisible by \(d^2\).

Proof

For \(\textbf{a}\in \Gamma ({\textbf{v}},d)\), we have that \(d^2\) divides

$$\begin{aligned} (\textbf{a}\times {\textbf{v}})\times {\textbf{v}}=(\textbf{a}\cdot {\textbf{v}}){\textbf{v}}-({\textbf{v}}\cdot {\textbf{v}})\textbf{a}, \end{aligned}$$

which means that

$$\begin{aligned} \frac{\textbf{a}\cdot {\textbf{v}}}{d^2}\hspace{0.55542pt}{\textbf{v}}-\frac{{\textbf{v}}\cdot {\textbf{v}}}{d^2}\hspace{0.55542pt}\textbf{a}\in {\mathbb {Z}}^3. \end{aligned}$$

Since \({\textbf{v}}\cdot {\textbf{v}}\) is divisible by \(d^2\), we earn \((\textbf{a}\cdot {\textbf{v}}/d^2)\hspace{0.88882pt}{\textbf{v}}\in {\mathbb {Z}}^3\). This gives the statement as \({\textbf{v}}\) is primitive. \(\square \)

Lemma 5

For vectors \(\textbf{a},\textbf{b}\in \Gamma ({\textbf{v}},d)\), the vector \(\textbf{a}\times \textbf{b}/d\) is contained in \(\Gamma ({\textbf{v}},d)\).

Proof

Our goal is to prove that \(M({\textbf{v}},d)\) contains the vector

$$\begin{aligned} \frac{(\textbf{a}\times \textbf{b}/d)\times {\textbf{v}}}{d}=\frac{\textbf{a}\cdot {\textbf{v}}}{d^2}\hspace{0.55542pt}\textbf{b}-\frac{\textbf{b}\cdot {\textbf{v}}}{d^2}\hspace{0.55542pt}\textbf{a}, \end{aligned}$$

where the coefficients \(\textbf{a}\cdot {\textbf{v}}/d^2\) and \(\textbf{b}\cdot {\textbf{v}}/d^2\) are integers by Lemma 4. The above vector is in \(M({\textbf{v}},d)\) if

$$\begin{aligned} \frac{\textbf{a}\cdot {\textbf{v}}}{d^2}\cdot \frac{\textbf{b}\times {\textbf{v}}}{d}-\frac{\textbf{b}\cdot {\textbf{v}}}{d^2}\cdot \frac{\textbf{a}\times {\textbf{v}}}{d}\in {\mathbb {Z}}^3, \end{aligned}$$

which is satisfied, because \(\textbf{b}\times {\textbf{v}}/d,\textbf{a}\times {\textbf{v}}/d\in {\mathbb {Z}}^3\) as \(\textbf{a},\textbf{b}\in \Gamma ({\textbf{v}},d)\). \(\square \)

Lemma 6

For vectors \(\textbf{a},\textbf{b}\in \Gamma ({\textbf{v}},d)\), the dot product \(\textbf{a}\cdot \textbf{b}\) is divisible by \(d^2\).

Proof

We have \(\textbf{a}\times {\textbf{v}}/d\in \Gamma ({\textbf{v}},d)\) by Lemma 5. Applying Lemma 5 again, we get that the vector

$$\begin{aligned} (\textbf{a}\times {\textbf{v}})\times \textbf{b}=(\textbf{a}\cdot \textbf{b})\hspace{0.49988pt}{\textbf{v}}-({\textbf{v}}\cdot \textbf{b})\hspace{0.49988pt}\textbf{a}\end{aligned}$$

is divisible by \(d^2\). Lemma 4 implies that \(d^2\) divides the coefficient \({\textbf{v}}\cdot \textbf{b}\). Therefore the vector \((\textbf{a}\cdot \textbf{b})\hspace{0.49988pt}{\textbf{v}}\) is also divisible by \(d^2\), which gives the statement. \(\square \)

The second step is to find the cubic basis in \(\Gamma ({\textbf{v}},d)\).

Lemma 7

There exists a vector \(\textbf{a}\in \Gamma ({\textbf{v}},d)\) of length d.

Proof

Suppose the contrary. Lemma 6 implies that the squared length of every vector of \(\Gamma ({\textbf{v}},d)\) is divisible by \(d^2\). This and the indirect assumption yield that the length of every non-zero vector of \(\Gamma ({\textbf{v}},d)\) is at least \(\sqrt{2}d\). Thus, the balls centered at the elements of \(\Gamma ({\textbf{v}},d)\) with radius \(\sqrt{2}d/2\) are disjoint. The parts of the intersection of a fundamental parallelepiped and these balls form an entire ball. Its volume is

$$\begin{aligned} \frac{4\pi }{3}\biggl (\frac{\sqrt{2}d}{2}\biggr )^{\!3}>\sqrt{2}d^3, \end{aligned}$$

while the volume of the fundamental parallelepiped is \(d^3\). This is a contradiction. \(\square \)

Fix a vector \(\textbf{a}\in \Gamma ({\textbf{v}},d)\) of length d. By Lemma 6, for a vector \(\textbf{b}\in \Gamma ({\textbf{v}},d)\), the dot product \(\textbf{a}\cdot \textbf{b}\) is divisible by \(d^2\), so the length of the projection of \(\textbf{b}\) to \(\textbf{a}\) is a multiple of d. Therefore the elements of \(\Gamma ({\textbf{v}},d)\) lie in \(\textbf{a}^\perp \) and its translates by the multiples of \(\textbf{a}\). Consider the sublattice \(\Lambda =\textbf{a}^\perp \cap \Gamma ({\textbf{v}},d)\). The area of the fundamental parallelogram in \(\Lambda \) is \(d^2\) as we can get the basis of the fundamental parallelepiped of \(\Gamma ({\textbf{v}},d)\) by adding \(\textbf{a}\) to the basis of the fundamental parallelogram of \(\Lambda \).

Lemma 8

There exists a vector \(\textbf{b}\in \Lambda \) of length d.

Proof

We prove by contradiction in a way similar to the proof of Lemma 7. We suppose that the length of every non-zero vector in \(\Lambda \) is at least \(\sqrt{2}d\). In this case, the disks around the elements of \(\Lambda \) with radius \(\sqrt{2}d/2\) in the plane perpendicular to \(\textbf{a}\) are disjoint. The area of the intersection of a fundamental parallelogram and these disks is

$$\begin{aligned} \biggl (\frac{\sqrt{2}d}{2}\biggr )^{\!2}\!\pi =\frac{\pi }{2}\hspace{0.55542pt}d^2>d^2, \end{aligned}$$

which is the area of the fundamental parallelogram, this is a contradiction. \(\square \)

Fix a vector \(\textbf{b}\in \Lambda \) of length d. The vector \(\textbf{c}=\textbf{a}\times \textbf{b}/d\) is in \(\Gamma ({\textbf{v}},d)\) by Lemma 5. Since the lengths of \(\textbf{a}\) and \(\textbf{b}\) are d and they are perpendicular, the length of \(\textbf{c}\) is also d. The vectors \(\textbf{a},\textbf{b},\textbf{c}\) are pairwise perpendicular, so the volume of the parallelepiped generated by them is \(d^3\). As the index of \(\Gamma ({\textbf{v}},d)\) in \({\mathbb {Z}}^3\) is also \(d^3\), the vectors \(\textbf{a},\textbf{b},\textbf{c}\) generate the sublattice \(\Gamma ({\textbf{v}},d)\). This means that \(\Gamma ({\textbf{v}},d)\) is indeed a cubic sublattice with edge length d.

4 Characterization of Cubic Sublattices

Although the following two lemmas are well known, we prove them for the sake of completeness.

Lemma 9

Let K be a sublattice of a two-dimensional lattice \(\Lambda \) and let k be the greatest common divisor of the vectors of K. Then there exists a vector in K whose greatest divisor is k.

Fig. 1
figure 1

The vector \({\textbf{v}}_1+{\textbf{v}}_2\) is divisible by 2

Proof

Let the generators of K be \({\textbf{v}}_1=k_1{\textbf{u}}_1\) and \({\textbf{v}}_2=k_2{\textbf{u}}_2\), where \({\textbf{u}}_1,{\textbf{u}}_2\) are primitive, and \(k_1,k_2\) are positive integers. We can assume that \(k=\gcd \hspace{0.88882pt}(k_1,k_2)\) is equal to 1. Unfortunately, the vector \({\textbf{v}}_1+{\textbf{v}}_2\) is not necessarily primitive, see Fig. 1, so we have to be more tricky. As \({\textbf{u}}_1\) is primitive, there exists such a vector \(\textbf{w}\) that \({\textbf{u}}_1\) and \(\textbf{w}\) generate \(\Lambda \). We can write \({\textbf{u}}_2=a{\textbf{u}}_1+b\textbf{w}\), where ab are coprime integers. Let c be the product of those prime numbers which divide b, but do not divide \(k_1k_2\) (set \(c=1\) if there is not any such prime number). We show that the vector \({\textbf{v}}=c{\textbf{v}}_1+{\textbf{v}}_2\in K\) is a primitive vector. Suppose the contrary, i.e., there exists a prime number p which divides

$$\begin{aligned} {\textbf{v}}=c{\textbf{v}}_1+{\textbf{v}}_2=ck_1{\textbf{u}}_1+k_2(a{\textbf{u}}_1+b\textbf{w})=(ck_1+ak_2)\hspace{0.49988pt}{\textbf{u}}_1+bk_2\textbf{w}. \end{aligned}$$

Since \({\textbf{u}}_1,\textbf{w}\) are the generators of \(\Lambda \), p divides \(ck_1+ak_2\) and \(bk_2\). As p is prime, p divides b or \(k_2\). If p divides \(k_2\), then p also divides \(ck_1\), which contradicts the definition of c or \(\gcd \hspace{0.88882pt}(k_1,k_2)=1\). If p does not divide \(k_2\), then p divides b. By the definition of c, p divides \(ck_1\), hence p divides \(ak_2\) and consequently also a. Thus, p divides \({\textbf{u}}_2=a{\textbf{u}}_1+b\textbf{w}\), which is a contradiction. \(\square \)

The next lemma is the three-dimensional version of Lemma 9.

Lemma 10

If the greatest common divisor of the vectors of a sublattice K of a three-dimensional lattice \(\Lambda \) is k, then K contains a vector whose greatest divisor is k.

Proof

Denote the generators of K by \({\textbf{v}}_1,{\textbf{v}}_2,{\textbf{v}}_3\) and its greatest divisors by \(k_1,k_2,k_3\), respectively. We have that \(k=\gcd \hspace{0.88882pt}(k_1,k_2,k_3)\). Let M be the sublattice generated by \({\textbf{v}}_1\) and \({\textbf{v}}_2\). By Lemma 9, there is a vector \({\textbf{v}}\) in M whose greatest divisor is \(\gcd \hspace{0.88882pt}(k_1,k_2)\). If we apply Lemma 9 again to the sublattice generated by \({\textbf{v}}\) and \({\textbf{v}}_3\), we get a vector in K, whose greatest divisor is \(\gcd {(\gcd \hspace{0.88882pt}(k_1,k_2),k_3)}=k\). \(\square \)

We remark that similar statement holds for arbitrary dimensional lattices, and one can prove it by induction on the dimension.

Now we can characterize the cubic sublattices of \({\mathbb {Z}}^3\). We show that every cubic sublattice can be obtained from our construction.

Theorem 2

For an arbitrary cubic sublattice \(\Gamma \subseteq {\mathbb {Z}}^3\), there exist unique positive integers k and d such that \(\Gamma =k\Gamma ({\textbf{v}},d)\) for a primitive vector \({\textbf{v}}\in {\mathbb {Z}}^3\).

Proof

We have that k is the greatest common divisor of the vectors of \(\Gamma \) and d is the quotient of the edge length of \(\Gamma \) and k. Consider the cubic sublattice \(\Gamma '\) such that \(k\Gamma '=\Gamma \). By Lemma 10, there exists a primitive vector \({\textbf{v}}\in \Gamma '\). Theorem 1 implies \(\Gamma '=\Gamma ({\textbf{v}},d)\), which gives the statement. \(\square \)

When a cubic sublattice is constructed from a primitive vector, this vector is also a primitive vector in the cubic sublattice. Our next goal is to show that every primitive vector can be such a vector. It requires two lemmas.

Lemma 11

If a cubic sublattice \(\Gamma \subseteq {\mathbb {Z}}^3\) has edge length d, then it contains the vectors divisible by \(d^2\), i.e., the inclusion \(d^2{\mathbb {Z}}^3\subseteq \Gamma \) is fulfilled.

Proof

When \(\Gamma =\Gamma ({\textbf{v}},d)\) for some primitive vector \({\textbf{v}}\), we have \(d^2\textbf{a}\in \Gamma ({\textbf{v}},d)\) for any \(\textbf{a}\in {\mathbb {Z}}^3\) by the construction. In the general case, \(\Gamma =k\Gamma ({\textbf{v}},d/k)\) for some integer k by Theorem 2. For an arbitrary \(\textbf{a}\in {\mathbb {Z}}^3\), we obtain \(d^2/k^2\textbf{a}\in \Gamma ({\textbf{v}},d/k)\), hence \(d^2\textbf{a}\in \Gamma \).

\(\square \)

The second lemma is a claim from number theory.

Lemma 12

For an odd prime number p, there exists a primitive vector in \({\mathbb {Z}}^3\) whose squared length is divisible by \(p^2\).

Proof

It is enough to construct a vector whose squared length is divisible by \(p^2\) and which is not divisible by p, as we can divide it by its greatest divisor.

If \(-1\) is a quadratic residue (when \(p=4k+1\) for a positive integer k), then there exists a positive integer x such that \(x^2=ap-1\) for some integer a. As p is odd, there exists integer b such that \(-2b\equiv a\) modulo p. Then \((0,x,bp+1)\) is a suitable vector.

When \(-1\) is not a quadratic residue (if \(p=4k+3\)), we search for \(x,y\in {\mathbb {Z}}_p\) such that \(x^2+y^2=-1\). If there were no such elements, then each of the pairs

$$\begin{aligned} (1,p-2),(2,p-3),\dots ,\biggl (\frac{p-1}{2},\frac{p-1}{2}\biggr ) \end{aligned}$$

would contain only one quadratic residue (in particular, the last one would not contain any), which would contradict the well-known fact that there exist \((p-1)/2\) quadratic residues modulo p. Denoting the corresponding integers by xy as well, we obtain that \(x^2+y^2=ap-1\) for some integer a. As in the previous case, we have an integer b such that \(-2b\equiv a\) modulo p, thus, the vector \((x,y,bp+1)\) is a suitable vector. \(\square \)

Lemma 12 does not hold for \(p=2\). Indeed, the square numbers are congruent 0 or 1 modulo 4, so if 4 divides the sum of the square of the coordinates, then all of them are even, hence the vector is divisible by 2.

If we construct a cubic sublattice in a cubic sublattice \(\Lambda \) instead of \({\mathbb {Z}}^3\), we will use the notion \(\Gamma _\Lambda ({\textbf{v}},d)\) for the cubic sublattice of \(\Lambda \) with edge length d which contains the primitive vector \({\textbf{v}}\in \Lambda \).

Theorem 3

For an arbitrary primitive vector \({\textbf{v}}=(v_1,v_2,v_3)\in {\mathbb {Z}}^3\) and an odd d, there exists a primitive vector \({\textbf{u}}\in {\mathbb {Z}}^3\) for which we can choose a cubic basis of the cubic sublattice \(\Gamma ({\textbf{u}},d)\) so that the coordinates of \({\textbf{u}}\) are \((v_1,v_2,v_3)\).

Proof

First we show that it is enough to prove the theorem for odd prime number d. Applying the theorem for a vector \({\textbf{v}}=(v_1,v_2,v_3)\in {\mathbb {Z}}^3\) and \(d_1\) yields a primitive vector \({\textbf{u}}\in {\mathbb {Z}}^3\). If we apply again the theorem for \({\textbf{u}}\) and for \(d_2\), we get a primitive vector \(\textbf{t}\in {\mathbb {Z}}^3\). The sublattice \(\Gamma _{\Gamma (\textbf{t},d_2)}({\textbf{u}},d_1)\) is a cubic sublattice with edge length \(d_1d_2\), where the coordinates of the vector \(\textbf{t}\) are \((v_1,v_2,v_3)\). The uniqueness part of Theorem 1 implies that this sublattice is \(\Gamma (\textbf{t},d_1d_2)\). In the following, we suppose that d is an odd prime number.

As \({\textbf{v}}\) is primitive, d does not divide at least one of its coordinates, let it be the first coordinate \(v_1\). Lemma 12 provides a primitive vector \(\textbf{w}=(w_1,w_2,w_3)\) whose squared length is divisible by \(d^2\). Reordering the coordinates, we can achieve that d does not divide the first coordinate \(w_1\). Set \(\tilde{\textbf{w}}=(-w_1,w_2,w_3)\). Now one of the dot products \({\textbf{v}}\cdot \textbf{w}\) or \({\textbf{v}}\cdot \tilde{\textbf{w}}\) is not divisible by d, otherwise d would divide their difference \(2v_1w_1\), which would contradict our assumptions on \(v_1\) and \(w_1\) as d is odd. Assume that \({\textbf{v}}\cdot \textbf{w}\) is not divisible by d.

Finally, construct the cubic sublattice \(\Gamma (\textbf{w},d)\). By Lemma 11, it contains the vector \(d^2{\textbf{v}}\). Consider this vector as a vector of the cubic sublattice \(\Gamma (\textbf{w},d)\), and denote it by \({\textbf{u}}\). This vector is primitive since \(d{\textbf{v}}\) is not contained in \(\Gamma (\textbf{w},d)\) by Lemma 4. The sublattice \(d^2{\mathbb {Z}}^3\) is a cubic sublattice in \(\Gamma (\textbf{w},d)\) with edge length d and it contains \({\textbf{u}}\). Thus, the cubic sublattice \(\Gamma _{\Gamma (\textbf{w},d)}({\textbf{u}},d)\) is \(d^2{\mathbb {Z}}^3\). Choosing the basis \((d^2{\textbf{e}}^1,d^2{\textbf{e}}^2,d^2{\textbf{e}}^3)\) of \(d^2{\mathbb {Z}}^3\), we have that the coordinates of \({\textbf{u}}\) are \((v_1,v_2,v_3)\). \(\square \)

Theorem 3 allows us to formulate the converse of the number-theoretic corollary mentioned in the introduction. If an integer m is a sum of three coprime squares, then for an odd d, the number \(d^2m\) is also a sum of three coprime squares. The assumption on the oddness of d is necessary, as a number divisible by 4 cannot be a sum of three coprime squares by the investigation of the remainders modulo 4.

5 Cubic Sublattices as Partially Ordered Set

The inclusion gives a partial order over the cubic sublattices of \({\mathbb {Z}}^3\). This makes the set of the cubic sublattices to a partially ordered set. We decide whether this set is a lattice in the algebraic sense.

Similarly to the cubic sublattices, we can investigate the square sublattices of \({\mathbb {Z}}^2\). A square sublattice can be characterized by the invariance of the rotation of \(90^\circ \). Therefore the intersection and the union of square sublattices are also square sublattices. These are the supremum and the infimum of the given square sublattices, so the partially ordered set of the square sublattices of \({\mathbb {Z}}^2\) forms a lattice in algebraic sense.

Fig. 2
figure 2

This example shows that the partially ordered set of the cubic sublattices of \({\mathbb {Z}}^3\) does not form a lattice in algebraic sense

We show that the partially ordered set of the cubic sublattices of \({\mathbb {Z}}^3\) is not a lattice in algebraic sense. The squared length of \({\textbf{v}}=(1,2,2)\) is \(9=3^2\), so there exists the cubic sublattice \(\Gamma ({\textbf{v}},3)\le {\mathbb {Z}}^3\). We have the inclusions \(9{\mathbb {Z}}^3\le 3{\mathbb {Z}}^3\le {\mathbb {Z}}^3\) and \(3\Gamma ({\textbf{v}},3)\le \Gamma ({\textbf{v}},3)\le {\mathbb {Z}}^3\), and from the last one, \(3\Gamma ({\textbf{v}},3)\le 3{\mathbb {Z}}^3\), see Fig. 2. Lemma 11 gives \(9{\mathbb {Z}}^3\le \Gamma ({\textbf{v}},3)\). In all of the mentioned inclusions, the (relatively) edge lengths of the cubic sublattices are 3, so there is not any cubic sublattice between the inclusions. This means that there is no supremum of \(3\Gamma ({\textbf{v}},3)\) and \(9{\mathbb {Z}}^3\). And there is no infimum of \(\Gamma ({\textbf{v}},3)\) and \(3{\mathbb {Z}}^3\).

However, the partially ordered set of such cubic sublattices that contain a given primitive vector \({\textbf{v}}\in {\mathbb {Z}}^3\) is a lattice in algebraic sense. If the squared length of \({\textbf{v}}\) is \(kd^2\), where k is square-free, then this lattice is isomorphic to the lattice of the divisors of d.