1 Introduction

A fabric consists in two sets of threads in perpendicular directions, called warp and weft (or woof). The traditional way to represent it is by the tiling of the plane by unit squares. Each vertical strip represents a thread of the warp and each horizontal strip a thread of the weft. Thus, each unit square represents the crossing of a warp-thread and a weft-thread. If the warp-thread pass over the weft thread, then the corresponding square is colored black; otherwise it is colored white. A way to design a fabric is to take a squared pattern of \(m\times m\) unit squares, called the draft or the design, color each unit square black or white, and repeat it to tiling the plane. To obtain a fabric, all the threads must hang together, so in each column and row of the draft there must be some black and some white squares.

There are a few attempts to study the mathematics of fabric designs. We can cite a six-pages paper by Shorter [13] in 1920, a series of four papers by Woods [14,15,16,17] in 1935 and 1936, the papers by Grünbaum and Shephard [6, 7] in 1980 and 1986, and an article by Crowe [2] in 1986 about the work of Woods. In almost all the cases the main interest is the symmetry group of the fabric.

A satin or sateen is the following special class of fabrics. Take a draft of size m (that means a square of \(m\times m\) of unit squares) and label columns and rows from 0 to \(m-1\). Then take an integer \(a\in \{1,\ldots ,m-1\}\) with \(\gcd (m,a)=1\), and color black the square (vr) in column v and row r if and only if \(av\equiv r\pmod {m}\). Note that, in this way, each column of the draft has exactly one black square, and the same for each row. The integer m is called the period, and the integer a the step of the satin. When the draft is extended to cover the plane, we also have that a unit square with coordinates (vr) is black if and only if \(av\equiv r\pmod {m}\). The case \(m=2\) and \(a=1\) is called plain or calico and, for \(m\ge 3\), the case \(a=1\) is called direct twill, and the case \(a=m-1\) indirect twill (often plain and twills are not considered as particular cases of satins, but different from satins). Figure 1 shows the drafts of the satin of period \(m=11\) and step \(a=4\), of the plain satin, and of the twills of period 4. The bottom rows from left to right represent the crossing of the weaf 0 with the warps \(0,1,\ldots ,m-1\), and the first column from bottom to top the crossing of warp 0 with the weafs \(0,1,\ldots ,m-1\).

Fig. 1
figure 1

The drafts of the satin of period \(m=11\) and step \(a=4\), of the plain satin, and of the direct and indirect twills of period 4

Probably the first in considering the design of satins from a mathematical point of view was Édouard Lucas [9] in 1867, motivated by two articles of the same year by the industrial Édouard Gand [4, 5]. After that, Lucas insisted in the topic with an article and an appendix in an Italian specialized industrial journal [10, 11]. The main interest of Lucas was to characterize periods and steps that produce satins considered of great quality: square and symmetric satins, which are those such that \(a^2+1\equiv 0\pmod {m}\), and \(a^2-1\equiv 0\pmod {m}\), respectively; this is to say to find periods m and steps a such that a has quadratic residue \(-1\) or \(+1\) modulus m.

Instead of the traditional representation by squares, we shall use coordinates; this is not usual in the context of fabrics, but an early precedent is Cerruti [1]. We identify the satin of size m and step a with the set

$$\begin{aligned} L(m,a)=\{(v,r)\in {\mathbb {Z}}^2: av\equiv r\pmod {m}\}. \end{aligned}$$

In fact, this set is a lattice:

$$\begin{aligned} (v,r)\in L(m,a)&\Leftrightarrow r\equiv av\pmod {m}\\&\Leftrightarrow r=av+\beta m \text{ for } \text{ some } \beta \in {\mathbb {Z}}\\&\Leftrightarrow (v,r)=v(1,a)+\beta (0,m) \text{ for } \text{ some } \beta \in {\mathbb {Z}} \\&\Leftrightarrow (v,r)\in \langle (1,a),(0,m)\rangle . \end{aligned}$$

From now on, we identify a satin of period m and step a with the lattice

$$\begin{aligned} L(m,a)=\langle (1,a),(0,m)\rangle =\{\alpha (1,a)+\beta (0,m):\alpha ,\beta \in {\mathbb {Z}}\}. \end{aligned}$$

A satin can be defined by its draft, but considered as a lattice, can be defined by a basis. It is natural to ask for the optimal basis; that is, a basis with the vectors as short as possible. An optimal basis can be obtained by the Lagrange–Gauss lattice basis-reduction algorithm.

Our goal is to relate the study of optimal basis in satin lattices L(ma) to the extended Euclid's algorithm applied to m and a. The paper is organized as follows.

In Sects. 2 and 3, we summarize basic properties of the extended Euclid's algorithm, and recall the Lagrange-Gauss algorithm for finding optimal basis; we apply it to obtain optimal basis of twills. In Sect. 4 we show how the extended Euclid's algorithm gives different basis of L(ma), and it always gives the shortest vector. Moreover, if the algorithm does not gives an optimal basis directly, then in just one step the Lagrange-Gauss algorithm finds the optimal basis. For square and symmetric satins, the extended Euclid's algorithm gives some additional information. In Sect. 5, we show that the algorithm always gives an optimal basis for square satins. Finally, in Sect. 6, we apply the algorithm to symmetric satins and provide their classification into rectangular and rombal, showing how to compute an optimal basis directly from the values of the period and step. While a rectangular basis is always optimal, a rombal basis can be optimal or not. In the case of rombal satins, we give both, the optimal and the rombal basis.

2 Extended Euclid's algorithm

Let us recall some of the basic properties of the extended Euclid's algorithm.

Let \(1\le a<m\) be integers. Define by recursion the sequence \(r_0=m\), \(r_1=a\) and, for \(i\ge 1\) and while \(r_{i}\ne 0\), let \(q_i\) and \(r_{i+1}\) the quotient and the remainder of dividing \(r_{i-1}\) by \(r_{i}\). If \(r_{n+1}=0\), we have

$$\begin{aligned} r_{i+1}=r_{i-1}-q_ir_i\ \text{ for } \ i\in \{1,\ldots ,n\}, \end{aligned}$$

and \(r_n=\gcd (m,a)\). We also define, for \(i\in \{1,\ldots ,n\}\),

$$\begin{aligned} \begin{array}{lll} u_0=1, &{}\ u_1=0, &{}\ u_{i+1}=u_{i-1}-q_iu_i,\\ v_0=0, &{}\ v_1=1, &{}\ v_{i+1}=v_{i-1}-q_iv_i. \end{array} \end{aligned}$$

We shall denote the data of the extended Euclid's algorithm by

$$\begin{aligned} {\text {E}}(m,a)=\{ (u_i,v_i,r_i)\}_{i=0}^{n+1}\cup \{q_i\}_{i=1}^n. \end{aligned}$$

The following properties are easily proved (most of them by induction) and almost all can be found in Shoup [12, Theorem 4.3].

Theorem 2.1

Let \(1\le a<m\) be integers and let \(d=\gcd (m,a)\). Then, E(ma) satisfies:

  1. (i)

    \(r_i=u_im+v_ia\) for all \(i\in \{0,1\ldots ,n+1\}\).

  2. (ii)

    \(\gcd (m,a)=r_n=u_nm+v_na\).

  3. (iii)

    \(u_{i+1}v_{i}-u_{i}v_{i+1}=(-1)^{i+1}\) for all \(i\in \{0,\ldots ,n\}\).

  4. (iv)

    \(\gcd (u_i,v_i)=1\) for all \(i\in \{0,\ldots ,n+1\}\).

  5. (v)

    For all \(i\in \{2,\ldots ,n+1\}\), if i is even, then \(u_i>0\); if i is odd, then \(u_i<0\).

  6. (vi)

    For all \(i\in \{1,\ldots ,n+1\}\), if i is even, then \(v_i<0\); if i is odd, then \(v_i>0\).

  7. (vii)

    \(|u_{i+1}|\ge |u_i|\) for all \(i\in \{1,\ldots ,n\}\).

  8. (viii)

    \(|v_{i+1}|\ge |v_i|\) for all \(i\in \{0,\ldots ,n\}\) and, if \(a<m/2\), then \(|v_{i+1}|>|v_i|\).

  9. (ix)

    \(u_{i+1}r_i-u_ir_{i+1}=(-1)^{i}a\) and \(|u_{i+1}|r_i\le a\), for all \(i\in \{0,\ldots ,n\}\).

  10. (x)

    \(v_{i+1}r_i-v_ir_{i+1}=(-1)^{i}m\) and \(|v_{i+1}|r_i\le m\), for all \(i\in \{0,\ldots ,n\}\).

  11. (xi)

    \(|u_{n+1}|=a/d\), \(|v_{n+1}|=m/d\).

  12. (xii)

    \(|u_n|\le \min \{a/2,\ a/d\}\), \(|v_n|\le \min \{m/2,m/d\}\).

Remark 2.1

If \(\gcd (m,a)=1\), then properties (xi) and (xii) above are

$$\begin{aligned} |u_{n+1}|=a,\quad |v_{n+1}|=m,\quad |u_n|\le a/2,\quad |v_n|\le m/2. \end{aligned}$$

We set \({\mathbf {e}}_i=(v_i,r_i)\) for \(i\in \{0,\ldots ,n+1\}\), and call them the vectors of E(ma).

The following property shall be useful to deal with square and symmetric satins.

Proposition 2.1

Keep the above notations and assume that \(1\le a<m/2\). For \(i\in \{1,\ldots ,n\}\), the integers \(|v_{i-1}|\) and \(q_i\) are the remainder and the quotient, respectively, of the division of \(|v_{i+1}|\) by \(|v_i|\).

Proof

Since \(a<m/2\), we know that \(0=|v_0|<|v_1|<\ldots<|v_n|<|v_{n+1}|\). By definition, \(v_2=v_0-q_1v_1=-q_1a\). The remainder of dividing \(|v_2|=q_1a\) by \(|v_1|=a\) is \(0=v_0\). For \(i\ge 3\), we have \(v_{i+1}=v_{i-1}-q_{i}v_{i}\) and \(v_{i-1}v_i<0\). Then,

$$\begin{aligned} |v_{i+1}|=|v_{i-1}|+q_{i}|v_{i}|,\quad |v_{i-1}|<|v_i|, \end{aligned}$$

that is, \(|v_{i-1}|\) is the remainder of dividing \(|v_{i+1}|\) by \(|v_i|\) and \(q_i\) is the quotient. \(\square\)

3 Lagrange–Gauss algorithm

Let \({\mathbf {u}}\in {\mathbb {R}}^2\) and denote \(\langle {\mathbf {u}}\rangle =\{\alpha {\mathbf {u}}: \alpha \in {\mathbb {Z}}\}\). If \({\mathbf {u}}\) and \({\mathbf {v}}\) are two independent vectors of \({\mathbb {R}}^2\), the lattice generated by \({\mathbf {u}}\) and \({\mathbf {v}}\) is the additive subgroup of \({\mathbb {R}}^2\)

$$\begin{aligned} \langle {\mathbf {u}},{\mathbf {v}}\rangle =\{\alpha {\mathbf {u}}+\beta {\mathbf {v}}: \alpha ,\beta \in {\mathbb {Z}}\}. \end{aligned}$$

An optimal basis of a lattice L is a basis \(({\mathbf {b}}_1,{\mathbf {b}}_2)\) such that for all \({\mathbf {x}}\in L\setminus \{{\mathbf {0}}\}\) one has:

  1. 1.

    \(\Vert {\mathbf {b}}_1 \Vert \le \Vert {\mathbf {x}} \Vert\);

  2. 2.

    if \(\Vert {\mathbf {x}} \Vert \le \Vert {\mathbf {b}}_2 \Vert\) then \(\Vert {\mathbf {x}} \Vert =\Vert {\mathbf {b}}_1 \Vert\) or \(\Vert {\mathbf {x}} \Vert =\Vert {\mathbf {b}}_2 \Vert\).

The vector \({\mathbf {b}}_1\) of an optimal basis \(({\mathbf {b}}_1,{\mathbf {b}}_2)\) is called a shortest vector of L, and \({\mathbf {b}}_2\) a second shortest vector. Note that if \({\mathbf {b}}_1\) is a shortest vector, \(-{\mathbf {b}}_1\) is a shortest vector too. Hence, we can always take a shortest vector with a no negative second coordinate.

An optimal basis of a lattice \(L=\langle {\mathbf {u}},{\mathbf {v}}\rangle\) can be found by using the Lagrange–Gauss algorithm. We refer, for instance, to Hoffstein and Pipper [8] or Galbraith [3] for more details. We denote \(\lfloor \mu \rceil =\lfloor \mu +1/2\rfloor\) the closest integer to the real number \(\mu\); note that in case that z is an integer and \(\mu =z+1/2\), then \(\lfloor \mu \rceil =z\).

Input A basis \(({\mathbf {u}},{\mathbf {v}})\) of a lattice L with \(\Vert {\mathbf {u}} \Vert \le \Vert {\mathbf {v}} \Vert\).

Output An optimal basis \(({\mathbf {b}}_1,{\mathbf {b}}_2)\) of L.

  1. 1

    Let \({\mathbf {b}}_1={\mathbf {u}}, \quad {\mathbf {b}}_2={\mathbf {v}}\),   \(h=\lfloor ({\mathbf {b}}_1\cdot {\mathbf {b}}_2)/\Vert {\mathbf {b}}_1 \Vert ^2\rceil\).

  2. 2

    If \(h=0\), then output \(({\mathbf {b}}_1,{\mathbf {b}}_2)\). End.

  3. 3

    If \(h\ne 0\), then \({\mathbf {b}}_2={\mathbf {b}}_2-h{\mathbf {b}}_1\).

  4. 4

    If \(\Vert {\mathbf {b}}_{2} \Vert <\Vert {\mathbf {b}}_{1} \Vert\) then swap \({\mathbf {b}}_{1}\) and \({\mathbf {b}}_{2}\).

  5. 5

    Repeat with the new input \(({\mathbf {b}}_1,{\mathbf {b}}_2)\).

Remark 3.1

Note that if \(({\mathbf {u}},{\mathbf {v}})\) is a basis of a lattice L with \(\Vert {\mathbf {u}} \Vert \le \Vert {\mathbf {v}} \Vert\), and the vectors \({\mathbf {u}}\) and \({\mathbf {v}}\) are ortogonal, then \(({\mathbf {u}},{\mathbf {v}})\) is an optimal basis.

Remark 3.2

Suppose that \(({\mathbf {u}},{\mathbf {v}})\) is a basis of a lattice L and that \({\mathbf {u}}\) is a shortest vector of L. Then, the Lagrange–Gauss algorithm takes at most one step to find an optimal basis. Indeed, we calculate \(\mu =({\mathbf {u}}\cdot {\mathbf {v}})/\Vert {\mathbf {u}} \Vert ^2\) and \(h=\lfloor \mu \rceil\). If \(h=0\), then \(({\mathbf {u}},{\mathbf {v}})\) is optimal. If not, the new value of h is \(h'=\lfloor \mu '\rceil\) where

$$\begin{aligned} \mu ' =\frac{1}{\Vert {\mathbf {u}} \Vert ^2}({\mathbf {u}}\cdot ({\mathbf {v}}-h{\mathbf {u}})) =\frac{1}{\Vert {\mathbf {u}} \Vert ^2}({\mathbf {u}}\cdot {\mathbf {v}}-h\Vert {\mathbf {u}} \Vert ^2) =\mu -h. \end{aligned}$$

As \(-1/2<\mu -h\le 1/2\), we have \(h'=\lfloor \mu '\rceil =\lfloor \mu -h\rceil =0\). Hence, \(({\mathbf {u}},{\mathbf {v}}-h'{\mathbf {u}})\) is an optimal basis of L.

As an immediate application of the algorithm, we consider the case of direct twills; that is, the satin lattices L(m, 1) with period \(m\ge 3\) and step \(a=1\). (Observe that the plain satin L(2, 1) has optimal basis \(((1,1),(-1,1))\).

Proposition 3.1

An optimal basis of the direct twill L(m, 1) is given by:

  1. (i)

    \(((1,1),(-m/2,m/2))\), if m is even;

  2. (ii)

    \(((1,1), (-(m-1)/2, (m+1)/2))\), if m is odd.

Proof

As \(m\ge 3\), the vector \({\mathbf {b}}_1=(1,1)\) has norm less or equal to the norm of \({\mathbf {b}}_2=(0,m)\). Suppose that m is even. In the first iteration,

$$\begin{aligned} h=\left\lfloor \frac{m}{2}\right\rceil =\frac{m}{2}. \end{aligned}$$

The new \({\mathbf {b}}_2\) is

$$\begin{aligned} {\mathbf {b}}_2=(0,m)-\frac{m}{2}(1,1)=\left( -\frac{m}{2},\ \frac{m}{2}\right) , \end{aligned}$$

which is orthogonal to (1, 1). Hence, \(((1,1),(-m/2,m/2))\) is an optimal basis. If m is odd, then

$$\begin{aligned} h=\left\lfloor \frac{m}{2}\right\rceil =\frac{m-1}{2}, \end{aligned}$$

and the new \({\mathbf {b}}_2\) is

$$\begin{aligned} {\mathbf {b}}_2=(0,m)-\frac{m-1}{2}(1,1)=\left( -\frac{m-1}{2},\ \frac{m+1}{2}\right) . \end{aligned}$$

For the next iteration,

$$\begin{aligned} {\mathbf {b}}_1\cdot {\mathbf {b}}_2=(1,1)\cdot \left( -\frac{m-1}{2},\ \frac{m+1}{2}\right) =1,\qquad \Vert {\mathbf {b}}_1 \Vert ^2=2. \end{aligned}$$

Therefore, \(h=\lfloor 1/2\rceil =0\) and we have that \(((1,1),(-(m-1)/2,(m+1)/2))\) is an optimal basis. \(\square\)

Two satins L(ma) and \(L(m,m-a)\) are called complementaries. The equivalences

$$\begin{aligned} (v,r)\in L(m,a)\&\Leftrightarrow \ av\equiv r\pmod {m} \Leftrightarrow (m-a)(-v)\equiv r\pmod {m} \\&\Leftrightarrow \ (-v,r)\in L(m,m-a)\ \Leftrightarrow \ (v,-r)\in L(m,m-a) \end{aligned}$$

show that the lattices L(ma) and \(L(m,m-a)\) are symmetrical with respect to the two coordinate axis. Then, properties of \(L(m,m-a)\) can be deduced from properties of L(ma) by symmetry. Thus, when necessary, we can restrict ourselves to the case \(a<m/2\). For instance, if \(a<m/2\) and \(((u_1,u_2),(v_1,v_2))\) is an optimal basis of L(ma), then \(((-u_1,u_2),(-v_1,v_2))\) is an optimal basis of \(L(m,m-a)\). In particular, as a consequence of Proposition 3.1, we have

Proposition 3.2

An optimal basis of the indirect twill \(L(m,m-1)\) of period m is given by:

  1. (i)

    \(((-1,1),(m/2,m/2))\), if m is even;

  2. (ii)

    \(((-1,1), ((m-1)/2, (m+1)/2))\), if m is odd.

4 Euclid's algorithm and the shortest vector

Consider the basis ((1, a), (0, m)) of the satin L(ma). Given vectors \({\mathbf {u}},{\mathbf {v}}\) in L(ma), one has that \(({\mathbf {u}},{\mathbf {v}})\) is another basis of L(ma) if and only if \(m=|\det ((1,a),(0,m))|=|\det ({\mathbf {u}},{\mathbf {v}})|\). We can see that a pair of consecutive vectors of E(ma) form a basis of L(ma).

Proposition 4.1

Let L(ma) be a satin and let \({\mathbf {e}}_0,\ldots ,{\mathbf {e}}_{n+1}\) be the vectors of E(ma). Then, for all \(i\in \{0,\ldots ,n\}\), the couple \(({\mathbf {e}}_i,{\mathbf {e}}_{i+1})\) is a basis of L(ma).

Proof

The vectors \({\mathbf {e}}_0=(0,m)\) and \({\mathbf {e}}_1=(1,a)\) are in L(ma). By induction, if \({\mathbf {e}}_{i-2}\) and \({\mathbf {e}}_{i-1}\) are vectors of L(ma), then \({\mathbf {e}}_{i+1}={\mathbf {e}}_{i-1}-q_i{\mathbf {e}}_i\in L(m,a)\). Then all the vectors of E(ma) are vectors of L(ma). By Theorem 2.1 (x), we have

$$\begin{aligned} |\det ({\mathbf {e}}_i,{\mathbf {e}}_{i+1})|=|v_ir_{i+1}-v_{i+1}r_i|=|(-1)^{i+1}m|=m. \end{aligned}$$

Hence, \(({\mathbf {e}}_i,{\mathbf {e}}_{i+1})\) is a basis of L(ma). \(\square\)

Our next goal is to show that we can found among the vectors of E(ma) one that is a shortest vector of L(ma). First, we get easy bounds on the coordinates of a shortest vector in L(ma).

Lemma 4.1

Let \({\mathbf {e}}=(v,r)\) be a shortest vector of the satin L(ma), with \(r\ge 0\). Then, one has

$$\begin{aligned} \Vert {\mathbf {e}} \Vert<m,\quad 0<r<m\,, \quad \text{ and }\quad 0<|v|<m. \end{aligned}$$

Proof

The conditions \(1\le a<m\) and \((1,a)\in L(m,a)\) imply \(\Vert {\mathbf {e}} \Vert ^2\le \Vert (1,a) \Vert ^2=1+a^2<(1+a)^2\le m^2.\) It follows \(\Vert {\mathbf {e}} \Vert <m\). The inequality \(m^2>\Vert {\mathbf {e}} \Vert ^2=v^2+r^2\) implies \(m>r\) and \(m>|v|\).

If \(0=|v|\), then \({\mathbf {e}}=(0,r)=x(0,m)+y(1,a)=(y,xm+ya)\) for some intergers x and y, which implies \(y=0\) and \(m>r=xm\ge m\), a contradiction. Hence, \(|v|>0\).

If \(r=0\), since \(av\equiv r\equiv 0 \pmod {m}\) and \(\gcd (a,m)=1\), we have \(v\equiv 0\pmod {m}\). Taking in account \(|v|<m\), we get \(v=0\). Thus, \({\mathbf {e}}=(v,r)=(0,0)\) is a contradiction. Hence, \(r>0\). \(\square\)

Next proposition is the adaptation to our context of the first part of the “Reconstruction Theorem” of Shoup [12, Theorem 4.9]. For the sake of completeness we include the proof, which is (almost) the same.

Proposition 4.2

Let L(ma) be a satin, and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Let \({\mathbf {e}}=(v,r)\in L(m,a)\) with \(r>0\) . If \(j=\min \{i:r\ge r_i\}\), then, \(|v|\ge |v_j|\) and \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert\).

Proof

If \(v=0\), the result is immediate with \(j=0\). Then, we can suppose \(v\ne 0\).

The sequence \(r_0=m,\ldots ,r_{n+1}=0\) is strictly decreasing. Hence j is a well defined integer and \(j\ge 1\).

The condition \((v,r)\in L(m,a)\) means that \(um+av=r\) for some \(u\in {\mathbb {Z}}\). By Theorem 2.1 (iii), we have \(\varepsilon =u_jv_{j-1}-u_{j-1}v_j\in \{\pm 1\}\). Then, the numbers

$$\begin{aligned} \sigma =\frac{1}{\varepsilon }(v_{j-1}u-u_{j-1}v),\quad \tau =\frac{1}{\varepsilon }(u_{j}v-v_{j}u) \end{aligned}$$

are integers. We have

$$\begin{aligned} u_j\sigma +u_{j-1}\tau&=\frac{1}{\varepsilon }(u_jv_{j-1}u-u_ju_{j-1}v+u_{j-1}u_jv-u_{j-1}v_ju)\\&=\frac{1}{\varepsilon }(u(u_jv_{j-1}-u_{j-1}v_j))\\&=\frac{1}{\varepsilon }u\varepsilon =u, \end{aligned}$$

and, analogously, one has \(v_j\sigma +v_{j-1}\tau =v\).

We have three possible cases. We shall see that in the first two we have \(|v|\ge |v_j|\) as required, and that the last one implies a contradiction.

  1. (i)

    \(\tau =0\). Then \(v_j\sigma =v\). Since \(v\ne 0\), we have \(|v|\ge |v_j|\).

  2. (ii)

    \(\sigma \tau <0\). From Theorem 2.1, we know that \(v_jv_{j-1}\le 0\). Also, \(\sigma\) and \(\tau\) have different sign. Then, \(v_j\sigma +v_{j-1}\tau =v\) implies \(|v|=|v_j|\cdot |\sigma |+|v_{j-1}|\cdot |\tau |\ge |v_j|\).

  3. (iii)

    \(\tau \ne 0\) i \(\sigma \tau \ge 0\). Multiplying \(u_j\sigma +u_{j-1}\tau =u\) by m and \(v_j\sigma +v_{j-1}\tau =v\) by a, we get

    $$\begin{aligned} mu_j\sigma +mu_{j-1}\tau =mu,\quad av_j\sigma +av_{j-1}\tau =av. \end{aligned}$$

    Adding both equalities, it follows

    $$\begin{aligned} \sigma (mu_j+av_j)+\tau (mu_{j-1}+av_{j-1})=mu+va=r, \end{aligned}$$

    that is, \(\sigma r_j+\tau r_{j-1}=r\). Since \(\sigma \tau \ge 0\) and \(r,r_{j-1},r_j\ge 0\), we have \(\sigma >0\), \(\tau >0\) and \(r=\sigma r_j+\tau r_{j-1}\ge \tau r_{j-1}\ge r_{j-1}>r\), which contradicts the definition of j.

Thus, we have \(r\ge r_j\) and \(|v|\ge |v_j|\). Hence, \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert\). \(\square\)

As a consequence, we have the following theorem.

Theorem 4.1

Let L(ma) be a satin. Then, one of the vectors of E(ma) is a shortest vector in L(ma).

Proof

Let \({\mathbf {e}}=(v,r)\) be a shortest vector of L(ma) with \(r\ge 0\), and let \({\mathbf {e}}_0,\ldots ,{\mathbf {e}}_{n+1}\) be the vectors of E(ma). From Lemma 4.1 we have \(r>0\). By applying Proposition 4.2 to the vector \({\mathbf {e}}=(v,r)\), we have \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert\) for some \(j\in \{0,\ldots ,n+1\}\). As \({\mathbf {e}}\) is a shortest vector, \(\Vert {\mathbf {e}}_j \Vert \ge \Vert {\mathbf {e}} \Vert\). Thus, \(\Vert {\mathbf {e}}_j \Vert = \Vert {\mathbf {e}} \Vert\) and \({\mathbf {e}}_j\) is a shortest vector. \(\square\)

Theorem 4.1 does not explain when, in the execution of Euclid's algorithm, the shortest vector has been reached. The remainder of this section is devoted to precise which of the vectors of E(ma) is the shortest.

The case of the plain satin is immediate. The lattice L(2, 1) has four shortest vectors: (1, 1), \((-1,1)\), \((1,-1)\) and \((-1,-1)\), and E(2, 1) has just three vectors \({\mathbf {e}}_0=(0,2)\), \({\mathbf {e}}_1=(1,1)\) and \({\mathbf {e}}_2=(-2,0)\), and \({\mathbf {e}}_1\) is a shortest vector. An optimal basis is \(((1,1), (-1,1))\). Thus, to the end of this section we consider only satins different from the plain satin, that is, with \(m>2\).

Next proposition shows some useful properties of the vectors of E(ma).

Proposition 4.3

Let L(ma) with \(m>2\) be a satin and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Then, it holds:

  1. (i)

    \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i>{\mathbf {e}}_{i}\cdot {\mathbf {e}}_{i+1}\) for all \(i\in \{1,\ldots ,n\}\).

  2. (ii)

    The number \(\ell =\min \{i: {\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i<0\}\) is well defined and it holds \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i\ge 0\) for \(i\le \ell -1\) and \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i<0\) for \(i\ge \ell\).

  3. (iii)

    The integer \(k=\min \{i: |v_i|>r_i\}\) is well defined and \(\ell -1\le k\le \ell\).

  4. (iv)

    \(\Vert {\mathbf {e}}_0 \Vert>\ldots >\Vert {\mathbf {e}}_{k-2} \Vert\).

  5. (v)

    If \(k=\ell\), then \(\Vert {\mathbf {e}}_k \Vert<\ldots <\Vert {\mathbf {e}}_{n+1} \Vert\).

  6. (vi)

    If \(k=\ell -1\), then \(\Vert {\mathbf {e}}_{k+1} \Vert<\ldots <\Vert {\mathbf {e}}_{n+1} \Vert\).

Proof

(i) By definition of \({\mathbf {e}}_i\), one has

$$\begin{aligned} {\mathbf {e}}_{i+1}\cdot {\mathbf {e}}_i =({\mathbf {e}}_{i-1}-q_i{\mathbf {e}}_i)\cdot {\mathbf {e}}_i ={\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i-q_i\Vert {\mathbf {e}}_i \Vert ^2 <{\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i. \end{aligned}$$

(ii) By (i), the sequence of scalar products \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i\) is strictly decreasing. Now, \({\mathbf {e}}_0\cdot {\mathbf {e}}_1=(0,m)\cdot (1,a)=ma>0\) and \({\mathbf {e}}_n\cdot {\mathbf {e}}_{n+1}=(v_n,1)\cdot (v_{n+1},0)=v_nv_{n+1}<0\). Hence, \(\ell\) is well defined and \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i\ge 0\) for \(i\le \ell -1\) and \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i<0\) for \(i\ge \ell\).

(iii) We have \(|v_0|=0<m=r_0\) and \(|v_{n+1}|=m>0=r_{n+1}\). Moreover, the sequence \((r_i)\) is strictly decreasing and the sequence \((|v_i|)\) is increasing. Hence, \(k=\min \{i: |v_i|>r_i\}\) is well defined and \(k\ge 1\).

By definition of k, we have \(|v_k|>r_k\) and \(|v_{k+1}|>r_{k+1}\). Taking in account that \(v_kv_{k+1}<0\), it follows

$$\begin{aligned} {\mathbf {e}}_{k}\cdot {\mathbf {e}}_{k+1}=v_kv_{k+1}+r_k r_{k+1}=-|v_k|\cdot |v_{k+1}|+r_k r_{k+1}<0. \end{aligned}$$

This implies \(\ell -1\le k\).

If \(\ell <k\), we have

$$\begin{aligned} 0> {\mathbf {e}}_{\ell -1}\cdot {\mathbf {e}}_{\ell }, \quad r_\ell \ge |v_\ell |,\quad r_{\ell -1}>r_\ell \ge |v_\ell |>|v_{\ell -1}|. \end{aligned}$$

Then, it follows

$$\begin{aligned} 0> {\mathbf {e}}_{\ell -1}\cdot {\mathbf {e}}_{\ell } =-|v_{\ell -1}|\cdot |v_{\ell }|+r_{\ell -1}r_{\ell }>0, \end{aligned}$$

a contradiction. Therefore, \(k\le \ell\). So, we have \(\ell -1\le k\le \ell\).

(iv) Certainly, \(\Vert {\mathbf {e}}_0 \Vert =m^2>1+a^2=\Vert {\mathbf {e}}_1 \Vert\). Suppose \(2\le i\le k-2\). Since \(k-2\in \{\ell -3,\ell -2\}\), the scalar product \({\mathbf {e}}_i\cdot {\mathbf {e}}_{i+1}\) is not negative and from the equality \({\mathbf {e}}_{i-1}=q_i{\mathbf {e}}_i+{\mathbf {e}}_{i+1}\) it follows

$$\begin{aligned} \Vert {\mathbf {e}}_{i-1} \Vert ^2=q_i^2\Vert {\mathbf {e}}_i \Vert ^2+\Vert {\mathbf {e}}_{i+1} \Vert ^2+2q_i{\mathbf {e}}_i\cdot {\mathbf {e}}_{i+1}>q_i\Vert {\mathbf {e}}_i \Vert ^2\ge \Vert {\mathbf {e}}_i \Vert ^2. \end{aligned}$$

(v) and (vi) Suppose \(i\ge \ell\). Since the scalar product \({\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i\) is negative, from \({\mathbf {e}}_{i+1}={\mathbf {e}}_{i-1}-q_i{\mathbf {e}}_i\), it follows

$$\begin{aligned} \Vert {\mathbf {e}}_{i+1} \Vert ^2 =\Vert {\mathbf {e}}_{i-1} \Vert ^2+q_i^2\Vert {\mathbf {e}}_i \Vert ^2-2q_i{\mathbf {e}}_{i-1}\cdot {\mathbf {e}}_i>\Vert {\mathbf {e}}_{i-1} \Vert +q_i^2\Vert {\mathbf {e}}_i \Vert ^2>\Vert {\mathbf {e}}_i \Vert ^2. \end{aligned}$$

In the case (v) we have \(i\ge k=\ell\), and in the case (vi) we have \(i\ge k+1=\ell\). In both cases, the statement follows. \(\square\)

Theorem 4.2

Let L(ma) be a satin with \(m>2\) and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Let \(k=\min \{i: |v_i|>r_i\}\). Then one of the four vectors \({\mathbf {e}}_{k-2}\), \({\mathbf {e}}_{k-1}\), \({\mathbf {e}}_{k}\), or \({\mathbf {e}}_{k+1}\) is a shortest vector of L(ma). Moreover,

  1. (i)

    if \({\mathbf {e}}_{k-2}\) is a shortest vector of L(ma), then either \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1})\) or \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k})\) is an optimal basis;

  2. (ii)

    if \({\mathbf {e}}_{k+1}\) is a shortest vector of L(ma), then either \(({\mathbf {e}}_{k+1},{\mathbf {e}}_{k})\) or \(({\mathbf {e}}_{k+1},{\mathbf {e}}_{k-1})\) is an optimal basis.

Proof

Note that \({\mathbf {e}}_0=(0,m)\) and \({\mathbf {e}}_1=(1,a)\). Hence \(k\ge 2\). By Theorem 4.1, one of the vectors of E(ma) is a shortest vector of L(ma). Thus, it suffices to prove that the vector of E(ma) with minimum norm is \({\mathbf {e}}_{k-2}\), \({\mathbf {e}}_{k-1}\), \({\mathbf {e}}_k\) or \({\mathbf {e}}_{k+1}\). By Proposition 4.3 (iv), (v) and (vi), we have

$$\begin{aligned} \Vert {\mathbf {e}}_{k-2} \Vert =\min \{\Vert {\mathbf {e}}_0 \Vert ,\ldots ,\Vert {\mathbf {e}}_{k-2} \Vert \}, \quad \Vert {\mathbf {e}}_{k+1} \Vert =\min \{\Vert {\mathbf {e}}_{k+1} \Vert ,\ldots ,\Vert {\mathbf {e}}_{n+1} \Vert \}. \end{aligned}$$

Hence

$$\begin{aligned} \min \{\Vert {\mathbf {e}}_0 \Vert ,\ldots ,\Vert {\mathbf {e}}_{n+1} \Vert \}= \min \{\Vert {\mathbf {e}}_{k-2} \Vert ,\Vert {\mathbf {e}}_{k-1} \Vert ,\Vert {\mathbf {e}}_{k} \Vert ,\Vert {\mathbf {e}}_{k+1} \Vert \}. \end{aligned}$$

(i) The vector \({\mathbf {e}}_0=(0,m)\) is not a shortest vector of L(ma). Then, since \({\mathbf {e}}_{k-2}\) is a shortest vector, it must be \(k\ge 3\) and \(|v_{k-2}|>0\).

Let \(\mu =({\mathbf {e}}_{k-2}\cdot {\mathbf {e}}_{k-1})/\Vert {\mathbf {e}}_{k-2} \Vert ^2\) and \(h=\lfloor \mu \rceil\). A second shortest vector of L(ma) is \({\mathbf {e}}={\mathbf {e}}_{k-1}-h{\mathbf {e}}_{k-2}\).

From Proposition 4.3 (ii) and (iii), we have \(0\le {\mathbf {e}}_{k-2}\cdot {\mathbf {e}}_{k-1}\). Since \(v_{k-2}v_{k-1}<0\), it holds

$$\begin{aligned} 0\le {\mathbf {e}}_{k-2}\cdot {\mathbf {e}}_{k-1} =-|v_{k-2}|\cdot |v_{k-1}|+r_{k-2}r_{k-1} \le r_{k-2}r_{k-1}<r_{k-2}^2\le \Vert {\mathbf {e}}_{k-2} \Vert ^2. \end{aligned}$$

Then, \(0\le \mu \le 1\) and \(h\in \{0,1\}\). If \(h=0\), then \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1})\) is an optimal basis. Consider the case \(h=1\). Then, \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1}-{\mathbf {e}}_{k-2})\) is an optimal basis. If \({\mathbf {e}}=(v,r)={\mathbf {e}}_{k-2}-{\mathbf {e}}_{k-1}\), then \(({\mathbf {e}}_{k-2},{\mathbf {e}})\) is optimal, too.

Since \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1})\) is not optimal, we have \(\Vert {\mathbf {e}}_{k-1} \Vert >\Vert {\mathbf {e}} \Vert\). Note that \(r=r_{k-2}-r_{k-1}>0\). Proposition 4.2 implies that if \(j=\min \{i: r\ge r_i\}\), then \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert\). From \(r=r_{k-2}-r_{k-1}<r_{k-2}\), it follows \(j\ge k-1\).

We can distinguish four cases \(j=k-1\), \(j=k\), \(j=k+1\) and \(j>k+1\). In the cases \(j=k\) and \(j=k+1\) we shall proof that \(({\mathbf {e}}_{k-2},{\mathbf {e}}_k)\) is an optimal basis, and that the other two cases are not possible.

If \(j=k\), we have \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_k \Vert\). If \(\Vert {\mathbf {e}} \Vert >\Vert {\mathbf {e}}_k \Vert\), then \(({\mathbf {e}}_{k-2},{\mathbf {e}})\) is not optimal. Hence, \(\Vert {\mathbf {e}} \Vert =\Vert {\mathbf {e}}_k \Vert\) and \(({\mathbf {e}}_{k-2},{\mathbf {e}}_k)\) is an optimal basis.

If \(j=k+1\), then \(r_{k-2}-r_{k-1}=r<r_{k-1}\) and \(r_{k-2}<2r_{k-1}\). It implies \(q_{k-1}=1\), so \({\mathbf {e}}={\mathbf {e}}_{k-2}-{\mathbf {e}}_{k-1}={\mathbf {e}}_{k-2}-q_{k-1}{\mathbf {e}}_{k-1}={\mathbf {e}}_k\). We have that \(({\mathbf {e}}_{k-2},{\mathbf {e}}_k)\) is an optimal basis.

If \(j=k-1\), we have \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_{k-1} \Vert >\Vert {\mathbf {e}} \Vert\), that is a contradiction.

Finally, if \(j>k+1\), we have \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert >\Vert {\mathbf {e}}_{k+1} \Vert\), again a contradiction.

(ii) Now we assume that \({\mathbf {e}}_{k+1}\) is a shortest vector. Let \(\mu =({\mathbf {e}}_{k}\cdot {\mathbf {e}}_{k+1})/\Vert {\mathbf {e}}_{k+1} \Vert ^2\) and \(h=\lfloor \mu \rceil\). A second shortest vector of L(ma) is \({\mathbf {e}}={\mathbf {e}}_{k}-h{\mathbf {e}}_{k+1}\).

Since \(v_{k}v_{k+1}< 0\) and \({\mathbf {e}}_k\cdot {\mathbf {e}}_{k+1}<0\), it follows

$$\begin{aligned} 0> {\mathbf {e}}_{k+1}\cdot {\mathbf {e}}_{k} =-|v_{k+1}|\cdot |v_{k}|+r_{k+1}r_{k} \ge -|v_{k+1}|\cdot |v_{k}| >-v_{k+1}^2\ge -\Vert {\mathbf {e}}_{k+1} \Vert ^2. \end{aligned}$$

Then, \(0> \mu \ \ge -1\) and \(h \in \{0,-1\}\). If \(h=0\) then \({\mathbf {e}}={\mathbf {e}}_k\) and \(({\mathbf {e}}_{k+1},{\mathbf {e}}_k)\) is optimal. Consider now the case \(h=-1\). If \({\mathbf {e}}=(v,r)={\mathbf {e}}_{k}+{\mathbf {e}}_{k+1}\), then \(({\mathbf {e}}_{k+1},{\mathbf {e}})\) is an optimal basis and \(\Vert {\mathbf {e}}_k \Vert >\Vert {\mathbf {e}} \Vert\).

As before, let \(j=\min \{i: r\ge r_i\}\). We have \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert\). Since \(r=r_{k}+r_{k+1}>r_k\), we have \(j\le k\). We can distinguish the four cases \(j<k-2\), \(j=k-2\), \(j=k-1\) and \(j=k\). We shall see that only \(j=k-1\) is possible and, in this case \(({\mathbf {e}}_{k+1},{\mathbf {e}}_{k-1})\) is an optimal basis.

If \(j=k-1\), then \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_{k-1} \Vert \ge \Vert {\mathbf {e}} \Vert\). Hence \(\Vert {\mathbf {e}} \Vert =\Vert {\mathbf {e}}_{k-1} \Vert\) and \(({\mathbf {e}}_{k+1},{\mathbf {e}}_{k-1})\) is an optimal basis.

If \(j<k-2\), then \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_j \Vert >\Vert {\mathbf {e}}_{k-2} \Vert\), which is a contradiction.

If \(j=k-2\), then

$$\begin{aligned} r_{k+1}+r_k=r\ge r_{k-2}=q_{k-1}r_{k-1}+r_k, \end{aligned}$$

and

$$\begin{aligned} r_{k-1}>r_{k+1}\ge q_{k-1}r_{k-1}+r_k\ge r_{k-1}, \end{aligned}$$

again a contradiction.

If \(j=k\), then \(\Vert {\mathbf {e}} \Vert \ge \Vert {\mathbf {e}}_k \Vert >\Vert {\mathbf {e}} \Vert\), a contradiction. \(\square\)

First part of Theorem 4.2 can be viewed as follows (see Fig. 2). For each vector \({\mathbf {e}}_i\) of E(ma), consider the point in the first quadrant \(\tilde{{\mathbf {e}}}_i=(|v_i|,r_i)\). Joining points with consecutive index, we obtain a polygonal from \(\tilde{{\mathbf {e}}}_0=(0,m)\) with each vertex lower and further on the right than the preceding one. The norm of \({\mathbf {e}}_i\) is the distance from \(\tilde{{\mathbf {e}}}_i\) to the origin. The first point after the polygonal crosses the bisector of the axes corresponds to the index k. The point closest to the origin is one of the four closest points to the bisector.

Fig. 2
figure 2

Ilustration of theorem 4.2

By Theorem 4.2, a shortest vector of L(ma) can be found by calculating the vectors \({\mathbf {e}}_i=(v_i,r_i)\) of E(ma) till we reach an index \(k+1\) such that \(|v_k|>r_k\), and select from the four vectors \({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1},{\mathbf {e}}_k\) and \({\mathbf {e}}_{k+1}\) the one with smaller norm, say \({\mathbf {e}}_s\). This is a shortest vector of L(ma). If \(s=k-2\), a second shortest vector of L(ma) is the shortest among the two vectors \({\mathbf {e}}_{k-1}\) and \({\mathbf {e}}_k\). Analogously, if \(s=k+1\), a second shortest vector of L(ma) is the shortest among the two vectors \({\mathbf {e}}_{k-1}\) and \({\mathbf {e}}_k\). If either \(s=k-1\) or \(s=k\), we can apply just one step the Lagrange-Gauss algorithm either to the basis \(({\mathbf {e}}_{k-1},{\mathbf {e}}_{k})\) if \(s=k-1\) or \(({\mathbf {e}}_{k},{\mathbf {e}}_{k-1})\) if \(s=k\) to obtain an optimal basis.

Table 1 gives some numerical examples; the values of m, a, k and the optimal basis are shown. When the second shortest vector is not a vector of E(ma), it is denoted by \({\mathbf {e}}\) without subindex.

Table 1 Optimal basis of some satins obtained by Euclid's algorithm

5 Square lattices

Probably square and symmetric satins are the most relevant classes of satins, and they have deserved special attention. For instance, they are the unique classes of the so-called isonemal satins (see Grünbaum and Shephard [6]), and the cited articles by Lucas study square and symmetric satins. We devote this section to square satins and the next one to symmetric satins.

A lattice L is called a square lattice if it satisfies one of the following three equivalent conditions:

  1. (a)

    The lattice L has an optimal basis \(({\mathbf {u}},{\mathbf {v}})\) such that \({\mathbf {u}}\cdot {\mathbf {v}}=0\) and \(\Vert {\mathbf {u}} \Vert =\Vert {\mathbf {v}} \Vert\). (Note that in this case \(\Vert {\mathbf {u}} \Vert ^2=\Vert {\mathbf {v}} \Vert ^2=|\det ({\mathbf {u}},{\mathbf {v}})|\)).

  2. (b)

    The lattice L is invariant by rotations of angle \(\pi /2\) around any point of L.

  3. (c)

    For all \((v,r)\in L\), we have \((-r,v)\in L\).

Conditions (a)–(c) are of geometric type. For satins L(ma), they are easily translated into an arithmetic condition.

Assume that a satin L(ma) is a square lattice. The condition \((1,a)\in L(m,a)\) implies \((-a,1)\in L(m,a)\). Then \(-a^2\equiv 1\pmod {m}\). Reciprocally, suposse that \(a^2+1\equiv 0\pmod {m}\). Then \(\gcd (m,a)=1\) and

$$\begin{aligned} (v,r)\in L(m,a)&\Leftrightarrow av\equiv r\pmod {m}\\&\Leftrightarrow v\equiv -ar\pmod {m}\\&\Leftrightarrow (-r,v)\in L(m,a). \end{aligned}$$

Thus, if \(a^2+1\equiv 0\pmod {m}\), then L(ma) is a square lattice. Therefore, a square satin is a satin L(ma) such that \(a^2+1\equiv 0\pmod {m}\). See the example in Fig. 3.

Fig. 3
figure 3

The draft and an optimal basis of the square lattice L (10, 3)

Historically, the main interest was to find m such that there exist steps a giving squared satins. In arithmetic terms, the problem is to find m such that \(-1\) is a quadratic residue modulus m. It is well known that such m are those with a factorization in product of primes of the form \(m=2^{\alpha _0}p_1^{\alpha _1}\ldots p_k^{\alpha _k}\) with \(\alpha _0\in \{0,1\}\) and \(p_i\equiv 1\pmod {4}\). Our goal here is to show that if L(ma) is a square lattice, then the extended Euclid's algorithm gives an optimal basis.

We have the following characterization of square lattices in terms of the penultimate vector of the Euclid's algorithm.

Lemma 5.1

Let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\) be the vectors of E(ma). Assume that \(a<m/2\). Then the lattice L(ma) is a square lattice if and only if \(v_n=-a\). In this case, n is even.

Proof

Assume that L(ma) is a square lattice. From the Bézout identity \(u_nm+v_na=1\) and \(a^2+1=x m\) for some integer x, we obtain \(u_nm+v_na=1=xm-a^2\) and \((u_n-x)m=-a(a+v_n)\). Since \(\gcd (m,a)=1\), it follows that m divides \(|a+v_n|\), that is, \(|a+v_n|=mq\) for some integer q. By Theorem 2.1 (xii), we have \(|v_n|\le m/2\). Then,

$$\begin{aligned} mq=|a+v_n|\le a+|v_n|<m/2+m/2=m. \end{aligned}$$

Therefore, \(q=0\) and \(v_n=-a<0\).

Reciprocally, if \(v_n=-a\), from \(u_nm+v_na=r_n=1\), we get \(-a^2\equiv 1\pmod {m}\), that is L(ma) is a square lattice.

By Theorem 2.1 (vi), \(v_n=-a<0\) implies n even. \(\square\)

If \(a=1\), the lattice L(ma) is a square lattice only if \(m=2\) (the plain satin) and, in this case, \(((1,1),(-1,1))\) is an optimal basis. We left apart this case. It is immediate that for \(m=3\) and \(m=4\) there are not square satins. Moreover, as said before, it is not restrictive to assume \(a<m/2\). If \(m\ge 5\), for the direct twill \(a=1\) we have \(a^2+1\equiv 2\pmod {m}\), so it is not a square lattice. Then, we can also assume \(1<a\).

Proposition 5.1

Let L(ma) be a square satin with \(m\ge 5\) and \(1<a<m/2\), and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Then:

  1. (i)

    \(|v_{n+1-i}|=r_i\) for \(i\in \{0,\ldots ,n+1\}\).

  2. (ii)

    \(\Vert {\mathbf {e}}_{n+1-i} \Vert =\Vert {\mathbf {e}}_i \Vert\) for \(i\in \{0,\ldots ,n+1\}\).

Proof

(i) By Theorem 2.1 (xi), we have \(|v_{n+1}|=m=r_0\). From Lemma 5.1, \(r_1=a=|v_n|\). By Proposition 2.1, \(|v_{i-1}|\) is the remainder of dividing \(|v_{i+1}|\) by \(|v_i|\) and \(q_i\) is the quotient (for \(i\in \{1,\ldots ,n\}\)). Then, the remainder of dividing \(r_0=|v_{n+1}|=m\) by \(r_1=|v_{n}|=a\) is \(r_2=|v_{n-1}|\). By induction, \(|v_{n+1-i}|=r_{i}\).

(ii) By (i), we have \(r_{n+1-i}=|v_i|\) and \(|v_{n+1-i}|=r_i\). It follows

$$\begin{aligned} \Vert {\mathbf {e}}_{n+1-i} \Vert =r_{n+1-i}^2+v_{n+1-i}^2=v_i^2+r_i^2=\Vert {\mathbf {e}}_i \Vert ^2. \end{aligned}$$

\(\square\)

Theorem 5.1

Let L(ma) be a square satin with \(m\ge 5\) and \(1<a<m/2\), and let \({\mathbf {e}}_0,\ldots ,{\mathbf {e}}_{n+1}\) be the vectors of E(ma). Let \(k=\min \{i: |v_i|>r_i\}\). Then, \(k=(n+2)/2\) and \(({\mathbf {e}}_{k-1},{\mathbf {e}}_k)\) is an optimal basis.

Proof

The number \(j=n/2\) is integer since n is even. The equality \(|v_{n+1-i}|=r_i\) for \(i=j\) and \(i=j+1\) gives \(|v_{j+1}|=r_{j}>r_{j+1}=|v_{j}|\). Thus, \(k=j+1=(n+2)/2\). We have \(\Vert {\mathbf {e}}_k \Vert =\Vert {\mathbf {e}}_{k-1} \Vert\). Moreover, \(v_{k-1}v_{k}<0\) implies

$$\begin{aligned} {\mathbf {e}}_{k-1}\cdot {\mathbf {e}}_{k}=v_{k-1}v_{k}+r_{k-1}r_{k}=-r_{k}r_{k-1}+r_{k-1}r_{k}=0. \end{aligned}$$

Hence, \(({\mathbf {e}}_{k-1},{\mathbf {e}}_{k})\) is an optimal basis. \(\square\)

Example 5.1

Consider the square satin L(65, 18). We calculate the vectors \({\mathbf {e}}_i=(v_i,r_i)\) till \(|v_i|>r_i\) or, equivalently, till we obtain a pair of consecutive orthogonal vectors.

$$\begin{aligned} \begin{array}{r|rrrrr} v_i &{} 0 &{} 1 &{} -3 &{} 4 &{} -7\\ q_i &{} &{} 3 &{} 1 &{} 1 &{} 1\\ \hline r_i &{} 65 &{} 18 &{} 11 &{} 7 &{} 4\\ &{} 11 &{} 7 &{} 4 &{} 3 \end{array} \end{aligned}$$

We obtain the optimal basis \(((4,7),(-7,4))\). As \(65-18=47\), an optimal basis of the complementary square satin L(65, 47) is \(((-4,7),(7,4))\).

6 Symmetric satins

A symmetric lattice is a lattice L such that for all \((x,y)\in {\mathbb {Z}}^2\), if \((x,y)\in L\), then \((y,x)\in L\). Geometrically, it is a lattice symmetric with respect to the line of equation \(y=x\). If a satin L(ma) is a symmetric lattice, then \((1,a)\in L(m,a)\) implies \((a,1)\in L(m,a)\) and, then, \(a^2\equiv 1\pmod {m}\); reciprocally, if \(a^2\equiv 1\pmod {m}\) then \(\gcd (m,a)=1\) and if \((v,r)\in L(m,a)\), we have \(av\equiv r\pmod {m}\) and \(v=a^2v=ar\pmod {m}\), so \((r,v)\in L(m,a)\) and it follows that L(ma) is a symmetric lattice. Thus, a symmetric satin is a satin L(ma) such that \(a^2-1\equiv 0\pmod {m}\). See the example in Fig. 4. Twills, for example, are symmetric satins.

Fig. 4
figure 4

The draft and an optimal basis of the symmetric satin L (8, 3)

A basis \(({\mathbf {u}},{\mathbf {v}})\) of a satin is rectangular if \({\mathbf {u}}\cdot {\mathbf {v}}=0\). Obviously, a rectangular basis is an optimal one. A satin is rectangular if it has a rectangular basis. For instance, twills with even period m are rectangular.

A basis \(({\mathbf {u}},{\mathbf {v}})\) of a satin is rombal if \(\Vert {\mathbf {u}} \Vert =\Vert {\mathbf {v}} \Vert\), that is, if the parallelogram of sides \({\mathbf {u}}\) and \({\mathbf {v}}\) is a rhombus. A satin is rombal if it has rombal basis. A satin is rombal optimal if it has a rombal optimal basis.

Twills with odd period m have optimal basis which are neither rectangular nor rombal (see Propositions 3.1 and 3.2 above). Nevertheless, they have a rombal basis: a direct twill of period m has second shortest vector \({\mathbf {a}}=(-(m-1)/2,(m+1)/2)\), and, by symmetry, the vector \({\mathbf {b}}=((m+1)/2,-(m-1)/2)\) belongs to the twill too. Moreover, \(\det ({\mathbf {a}},{\mathbf {b}})=m\). Thus, \(({\mathbf {a}},{\mathbf {b}})\) is a rombal basis. Analogously, an indirect twill of period m has a rombal basis \(({\mathbf {a}},{\mathbf {b}})\) where \({\mathbf {a}}=((m+1)/2,(m-1)/2))\) and \({\mathbf {b}}=((m-1)/2,(m+1)/2)\).

Next Proposition gives examples of rombal optimal basis.

Proposition 6.1

If \(4\le a<m-1\), then ((1, a), (a, 1)) is an optimal basis of the satin L(ma) if and only if \(a^2-1=m\).

Proof

If \(m=a^2-1\), then the satin L(ma) is symmetric and \((1,a),(a,1)\in L(m,a)\). Moreover \(\det ((a,1),(1,a))=a^2-1=m\). Hence, ((a, 1), (1, a)) is a basis. If we apply the Lagrange–Gauss algorithm to this basis, at the first step we heve

$$\begin{aligned} h=\left\lfloor \frac{2a}{a^2+1}\right\rceil . \end{aligned}$$

Now, \(a\ge 4\) implies \(2a/(a^2+1)\le 1/2\). It follows \(h=0\) and we conclude that the basis (1, a), (a, 1) is optimal. Reciprocally, if ((a, 1), (1, a)) is a basis, then \(m=|\det ((a,1),(1,a))|=a^2-1\). \(\square\)

Remark 6.1

For \(a=3\) and \(m=a^2-1=8\), it is esay to see that the basis ((3, 1), (1, 3)) is not optimal (the optimal one is \(((-2,2),(1,3))\)). Thus, the bound \(4\le a\) in the Proposition 6.1 is sharp.

It is known that every symmetric satin is rectangular or rombal. Grünbaum and Shepard give a sketch of the proof in [6]. Next, we provide a detailed proof with the goal to obtain, not only the classification, but also an optimal basis, and discriminate when a rombal basis is optimal or not. At the end of the section, we relate these results with the Euclid's algorithm.

The plain L(2, 1) has optimal basis \(((1,1),(-1,1))\), that is rectangular and rombal, so we exclude this case of the discussion.

Lemma 6.1

Let L(ma) be a symmetric satin with \(m>2\), and set

$$\begin{aligned} d=\gcd (m,a+1),\quad \text{ and }\quad m_1=m/d. \end{aligned}$$

Then, we have:

  1. (i)

    The vectors \({\mathbf {d}}=(d,d)\) and \(\mathbf {m_1}=(-m_1,m_1)\) are in L(ma).

  2. (ii)

    If m is even, then d is even and \({\mathbf {w}}=(d/2,d/2)\in L(m,a)\) if and only if \(a^2-1\equiv 0\pmod {2m}\).

  3. (iii)

    If m is even and \(a^2-1\not \equiv 0\pmod {2m}\) or if m is odd, then \(x_1=(d+m_1)/2\) is an integer and the vectors \({\mathbf {u}}=(d-x_1,x_1)\) and \({\mathbf {v}}=(x_1,d-x_1)\) are in L(ma).

Proof

(i) Due to the Bézout identity, one has \(um+v(a+1)=d\) for certain integers u and v. It follows \(av+v\equiv d\pmod {m}\). Then, \(ad\equiv a(av+v)=a^2v+av\equiv v+av\equiv d\), thus \({\mathbf {d}}=(d,d)\in L(m,a)\).

Let \(a_1=(a+1)/d\). We have \((a+1)m_1=a_1dm_1=a_1m\equiv 0\pmod {m}\). Then, \(a(-m_1)=-am_1\equiv m_1\pmod {m}\) and \(\mathbf {m_1}=(-m_1,m_1)\in L(m,a)\).

(ii) Since \(\gcd (m,a)=1\), if m is even, then a is odd and \(a+1\), \(a-1\) and d are even. We have the following equivalences:

$$\begin{aligned} {\mathbf {w}}=(d/2,d/2)\in L(m,a)&\Leftrightarrow a\frac{d}{2}\equiv \frac{d}{2}\pmod {m}\\&\Leftrightarrow (a-1)\frac{d}{2}\equiv 0\pmod {m} \\&\Leftrightarrow \frac{a-1}{2}\equiv 0\pmod {m/d} \\&\Leftrightarrow a_1\frac{a-1}{2}\equiv 0\pmod {m/d} \\&\Leftrightarrow \frac{a+1}{d}\cdot \frac{a-1}{2}\equiv 0\pmod {m/d} \\&\Leftrightarrow a^2-1\equiv 0\pmod {2m}. \end{aligned}$$

(iii) We shall see that \(x_1=(d+m_1)/2\) is an integer and also that \(ax_1\equiv d-x_1\pmod {m}\). Note that \(d-x_1=(d-m_1)/2\).

Consider first the case when m is even and \(a^2-1\not \equiv 0\pmod {2m}\); that is, m is even and \(a^2-1=qm\) with q an odd integer. We claim that \(m_1\) is even. Indeed,

$$\begin{aligned} a-1=\frac{qm}{a+1}=\frac{qdm_1}{da_1}=\frac{qm_1}{a_1} \end{aligned}$$

implies \(qm_1=(a-1)a_1\). Since \(a-1\) is even, we have that \(qm_1=(a-1)a_1\) is even, but q is odd. Hence, \(m_1\) is even.

Also, note that from the equality \(qm_1=(a-1)a_1\) and \(\gcd (m_1,a_1)=1\), it follows \(a_1|q\). Thus, \(a_1\) is odd.

Because d and \(m_1\) are even, the number \(x_1=(d+m_1)/2\) is an integer. We shall see that \(ax_1\equiv d-x_1\pmod {m}\). From \(ad\equiv d\pmod {m}\), it follows \((a-1)d=\alpha m\) for some integer \(\alpha\). Multiplying by \(a+1\), we get \((a^2-1)d= \alpha (a+1)m\). Then, \(qmd=\alpha a_1dm\), and \(q=\alpha a_1\). As q is odd, \(\alpha\) is odd too. Analogously, from \(am_1\equiv -m_1\pmod {m}\) we get \((a+1)m_1=\beta m\) for some integer \(\beta\). Dividing by \(m_1\), we obtain \(a+1=\beta d\) and \(\beta =(a+1)/d=a_1\), which is odd. Now, \(\alpha\) and \(\beta\) are odd, so \(\alpha +\beta\) is even, say \(\alpha +\beta =2\gamma\). Then adding, \(ad=d+\alpha m\) and \(am_1=-m_1+\beta m\) we obtain \(a(d+m_1)=d-m_1+(\alpha +\beta )m=d-m_1+2\gamma m\) and dividing by 2,

$$\begin{aligned} ax_1=a\frac{d+m_1}{2}=\frac{d-m_1}{2}+\gamma m\equiv \frac{d-m_1}{2}=d-x_1 \pmod {m}. \end{aligned}$$
(6.1)

Consider now the case when m is odd. Then, d and \(m_1\) are odd and \(d+m_1\) is even, so \(x_1=(d+m_1)/2\) is an integer. The congruences \(ad\equiv d\pmod {m}\) and \(am_1\equiv -m_1\pmod {m}\) imply \(a(d+m_1)-(d-m_1)=\alpha m\) for some integer \(\alpha\). Because d and \(m_1\) are odd, the numbers \(d+m_1\) and \(d-m_1\) are even and \(\alpha m\) is even. But m is odd, hence, \(\alpha\) must be even say \(\alpha =2\gamma\). Then, like in (6.1), we have \(ax_1=d-x_1\).

Thus, in both cases, we have that \({\mathbf {v}}=(x_1,d-x_1)\) and \({\mathbf {u}}=(d-x_1,x_1)\) are vectors of L(ma). \(\square\)

Associated with a symmetric satin L(ma), we define the parameters and vectors of Lemma 6.1:

$$\begin{aligned}&d=\gcd (m,a+1),\quad {\mathbf {d}}=(d,d).\\&m_1=m/d, \quad \mathbf {m_1}=(-m_1,m_1).\\&\text{ If } \text{ m } \text{ is } \text{ even } \text{ and } a^2-1\equiv 0\pmod {2m},\quad {\mathbf {w}}=(d/2,d/2).\\&\text{ If } \text{ m } \text{ is } \text{ even } \text{ and } a^2-1\not \equiv 0\pmod {2m}, \text{ or } \text{ if } \text{ m } \text{ is } \text{ odd }, \\&\qquad \quad x_1=(d+m_1)/2,\quad {\mathbf {u}}=(d-x_1,x_1), \quad {\mathbf {v}}=(x_1,d-x_1). \end{aligned}$$

Under the above conditions, the following properties are immediate.

  1. (i)

    \({\mathbf {u}}+{\mathbf {v}}={\mathbf {d}}\),   \({\mathbf {u}}-{\mathbf {v}}={\mathbf {m}}_1\).

  2. (ii)

    \(\Vert {\mathbf {d}} \Vert ^2=2d^2\),   \(\Vert \mathbf {m_1} \Vert ^2=2m_1^2\),    \(\Vert {\mathbf {u}} \Vert ^2=\Vert {\mathbf {v}} \Vert ^2=(d^2+m_1^2)/2\).

  3. (iii)

    \(\det ({\mathbf {u}},{\mathbf {d}})=\det ({\mathbf {u}},{\mathbf {m}}_1)=\det ({\mathbf {v}},{\mathbf {u}})=m\). In particular, \(({\mathbf {d}},{\mathbf {u}})\), \((\mathbf {m_1},{\mathbf {u}})\) and \(({\mathbf {v}},{\mathbf {u}})\) are basis of L(ma).

  4. (iv)

    \({\mathbf {d}}\cdot {\mathbf {u}}=d^2\),   \(\mathbf {m_1}\cdot {\mathbf {u}}=m_1^2\),   \({\mathbf {u}}\cdot {\mathbf {v}}=(d^2-m_1^2)/2\).

Lemma 6.2

The unique symmetric satin with \(d=m_1\) is the direct twill of period \(m=4\).

Proof

The condition \(d=m_1=m/d\) implies \(m=d^2\). The condition \({\mathbf {d}}\in L(m,a)\) implies \(ad\equiv d\pmod {d^2}\), so \(a\equiv 1\pmod {d}\). Then, \(a+1=2+pd\) for some integer p. Since d divides \(a+1\), we have d|2. Hence, \(d=1\) or \(d=2\). If \(d=1\), then \(m=d^2=1\), a contradiction. If \(d=2\) then \(m=4\), and the condition \(2=d=\gcd (a+1,m)=(a+1,4)\) implies \(a=1\). \(\square\)

Plane and twill satins have been considered above. Next theorem considers symmetric satins other than plain and twills, so \(m\ge 5\) and \(1<a<m-1\).

Theorem 6.1

Let L(ma) be a symmetric satin with \(m\ge 5\) and \(m-1>a>1\).

  1. (i)

    If m is even and \(a^2-1\equiv 0\pmod {2m}\), then the satin is rectangular. In this case, d is even and \(d/2\ne m_1\). Moreover, an optimal rectangular basis is \(({\mathbf {w}},\mathbf {m_1})\) if \(d/2< m_1\) or \((\mathbf {m_1},{\mathbf {w}})\) if \(m_1<d/2\).

  2. (ii)

    If m is even and \(a^2-1\not \equiv 0\pmod {2m}\), or if m is odd, then \(({\mathbf {u}},{\mathbf {v}})\) is a rombal basis of L(ma). In this case, \(({\mathbf {d}},{\mathbf {u}})\) and \((\mathbf {m_1},{\mathbf {u}})\) are basis too, the three vectors \({\mathbf {d}}\), \(\mathbf {m_1}\) and \({\mathbf {u}}\) have different norm, and if \({\mathbf {e}}\) denotes the one with smallest norm, exactly one of the three cases hold:

    1. (ii.1)

      \({\mathbf {e}}={\mathbf {d}}\), \(3d^2<m_1^2\), and \(({\mathbf {d}},{\mathbf {u}})\) is an optimal basis.

    2. (ii.2)

      \({\mathbf {e}}=\mathbf {m_1}\), \(3m_1^2<d^2\), and \((\mathbf {m_1},{\mathbf {u}})\) is an optimal basis.

    3. (ii.3)

      \({\mathbf {e}}={\mathbf {u}}\), \(m_1^2<3d^2\), \(d^2<3m_1^2\), and \(({\mathbf {u}},{\mathbf {v}})\) is an optimal rombal basis.

Proof

(i) By hypothesis, \(a^2-1\equiv 0\pmod {2m}\), so \({\mathbf {w}}=(d/2,d/2)\in L(m,a)\). We have seen that \(\mathbf {m_1}=(-m_1,m_1)\in L(m,a)\). The vectors \({\mathbf {w}}\) and \(\mathbf {m_1}\) are in L(ma), they are orthogonal and \(\det ({\mathbf {w}},\mathbf {m_1})=dm_1/2+dm_1/2=dm_1=m\). Thus, they form a rectangular (and optimal) basis. If \(d/2<m_1\), the shortest vector is \({\mathbf {w}}\) and the optimal basis is \(({\mathbf {w}},\mathbf {m_1})\); if \(m_1<d\), the shortest vector is \(\mathbf {m_1}\) and an optimal basis is \((\mathbf {m_1},{\mathbf {w}})\). The condition \(d/2=m_1\) is not possible: in this case, \(d/2\equiv a(d/2)=am_1\equiv -m_1=-d/2\) and we obtain \(d\equiv 0\pmod {m}\). Then, \(m=d\le a+1<m\), a contradiction.

(ii) The vectors \({\mathbf {u}}\) and \({\mathbf {v}}\) belong to L(ma), have the same norm, and \(\det ({\mathbf {v}},{\mathbf {u}})=m\). Therefore, \(({\mathbf {u}},{\mathbf {v}})\) is a rombal basis. Also, we have noticed that \(({\mathbf {d}},{\mathbf {u}})\), \(({\mathbf {u}},\mathbf {m_1})\) are basis too. (But \(\det ({\mathbf {d}},\mathbf {m_1})=2dm_1=2m\), so \(({\mathbf {d}},\mathbf {m_1})\) is not a basis.)

We check that the three norms

$$\begin{aligned} \Vert {\mathbf {d}} \Vert ^2=2d^2,\quad \Vert {\mathbf {m}}_1 \Vert ^2=2m_1^2,\quad \Vert {\mathbf {u}} \Vert ^2=\frac{1}{2}(d^2+m_1^2) \end{aligned}$$

are different. Indeed, \(\Vert {\mathbf {d}} \Vert =\Vert \mathbf {m_1} \Vert\) is not possible by Lemma 6.2. The equality \(\Vert {\mathbf {d}} \Vert =\Vert {\mathbf {u}} \Vert\) implies \(3d^2=m_1^2\), but \(m_1^2\) is a square and \(3d^2\) is not; thus, \(\Vert {\mathbf {d}} \Vert \ne \Vert {\mathbf {u}} \Vert\). Finally, \(\Vert \mathbf {m_1} \Vert =\Vert {\mathbf {u}} \Vert\) implies \(3m_1^2=d^2\), also a contradiction. Note the equivalences

$$\begin{aligned} \begin{array}{llll} &{}{\mathbf {e}}={\mathbf {d}} \ &{}\Leftrightarrow \ d<m_1 \text{ and } 3d^2<m_1^2 \ &{}\Leftrightarrow \ 3d^2<m_1^2\\ &{}{\mathbf {e}}=\mathbf {m_1} \ &{}\Leftrightarrow \ m_1<d \text{ and } 3m_1^2<d^2 \ &{}\Leftrightarrow \ 3m_1^2<d^2\\ &{}{\mathbf {e}}={\mathbf {u}} \ &{}\Leftrightarrow \ m_1^2<3d^2 \text{ and } d^2<3m_1^2. \end{array} \end{aligned}$$

If \({\mathbf {e}}={\mathbf {d}}\), we have

$$\begin{aligned} {\mathbf {d}}\cdot {\mathbf {u}}=d^2\quad \text{ and } \quad h=\left\lfloor \frac{{\mathbf {d}}\cdot {\mathbf {u}}}{\Vert {\mathbf {d}} \Vert ^2}\right\rceil =\left\lfloor \frac{d^2}{2d^2}\right\rceil =\left\lfloor \frac{1}{2}\right\rceil =0. \end{aligned}$$

Then, \(({\mathbf {d}},{\mathbf {u}})\) is an optimal basis.

If \({\mathbf {e}}={\mathbf {m}}_1\), we have,

$$\begin{aligned} {\mathbf {m}}_1\cdot {\mathbf {u}}=m_1^2\quad \text{ i } \quad h=\left\lfloor \frac{{\mathbf {m}}_1\cdot {\mathbf {u}}}{\Vert {\mathbf {m}}_1 \Vert ^2}\right\rceil =\left\lfloor \frac{m_1^2}{2m_1^2}\right\rceil =\left\lfloor \frac{1}{2}\right\rceil =0. \end{aligned}$$

Then, \(({\mathbf {m}}_1,{\mathbf {u}})\) is an optimal basis.

If \({\mathbf {e}}={\mathbf {u}}\), we have

$$\begin{aligned} (d^2+m_1^2)/2=\Vert {\mathbf {u}} \Vert ^2<\Vert {\mathbf {d}} \Vert ^2\le 2d^2 \quad \Leftrightarrow \quad m_1^2<3d^2. \end{aligned}$$
(6.2)

and

$$\begin{aligned} (d^2+m_1^2)/2=\Vert {\mathbf {u}} \Vert ^2<\Vert \mathbf {m_1} \Vert ^2\le 2m_1^2 \quad \Leftrightarrow \quad d^2<3m_1^2. \end{aligned}$$
(6.3)

Then,

$$\begin{aligned} {\mathbf {u}}\cdot {\mathbf {v}}=\frac{1}{2}(d^2-m_1^2) \quad {and}\quad h=\left\lfloor \frac{{\mathbf {u}}\cdot {\mathbf {v}}}{\Vert {\mathbf {u}} \Vert ^2}\right\rceil =\left\lfloor \frac{(d^2-m_1^2)/2}{(d^2+m_1^2)/2}\right\rceil =\left\lfloor \frac{d^2-m_1^2}{d^2+m_1^2}\right\rceil . \end{aligned}$$

To show that \(h=0\), it suffices to proof that

$$\begin{aligned} \left| \frac{d^2-m_1^2}{d^2+m_1^2}\right| <\frac{1}{2} \end{aligned}$$

or, equivalently, \(2|d^2-m_1^2|<d^2+m_1^2\). If \(d>m_1\), this condition is equivalent to \(2(d^2-m_1^2)<d^2+m_1^2\) and to \(d^2<3m_1^2\), which holds by (6.3). Analogously, if \(m_1>d\), the condition is equivalent to \(2(m_1^2-d^2)<d^2+m_1^2\) and to \(m_1^2<3d^2\), which holds by  (6.2). Therefore, we conclude that \(h=0\) and that \(({\mathbf {u}},{\mathbf {v}})\) is an optimal rombal basis.\(\square\)

Example 6.1

Consider the symmetric satin L(36, 17). Since \(a^2-1=288\equiv 0\pmod {2\cdot 36}\), it is a rectangular satin. The parameters are \(d=\gcd (m,a+1)=\gcd (36,18)=18\) and \(m_1=m/d=36/18=2\). Then, \({\mathbf {w}}=(d/2,d/2)=(9,9)\) and \(\mathbf {m_1}=(-2,2)\). The optimal basis is \((\mathbf {m_1},{\mathbf {u}})\).

Example 6.2

Consider the symmetric satin L(8, 5). The period m is even, but \(a^2-1=24\not \equiv 0\pmod {16}\). The satin is rombal. The parameters are \(d=\gcd (m,a+1)=\gcd (8,6)=2\), \(m_1=m/d=4\), and \(x_1=(d+m_1)/2=6/2=3\). The rombal basis is \(({\mathbf {u}},{\mathbf {v}})\) with \({\mathbf {u}}=(d-x_1,x_1)=(-1,3)\) and \({\mathbf {v}}=(3,-1)\). As \(3d^2=12<16=m_1^2\), the optimal basis is \(({\mathbf {d}},{\mathbf {u}})=((2,2),(-3,1))\).

Example 6.3

Consider the symmetric satin L(15, 4). The period m is odd, so it is a rombal satin. We have \(d=\gcd (m,a+1)=\gcd (15,5)=5\), \(m_1=m/d=3\) and \(x_1=(d+m_1)/2=8/2=4\). The rombal basis is \(({\mathbf {u}},{\mathbf {v}})=((11,4),(4,11))\). As \(d^2=25<27=3m_1^2\), and \(m_1^2=9<75=3m_1^2\), the optimal basis is the rombal one.

Next, we turn to the Euclid's algorithm again. Next Lemma and Proposition show certain properties of the vectors of E(ma) for a symmetric satin. We skip the proofs because they are very similar to those of Lemma 5.1 and Proposition 5.1, respectively.

Lemma 6.3

Let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Then the lattice L(ma) is a symmetric lattice if and only if \(v_n=a\). In this case, n is odd.

Proposition 6.2

Let L(ma) be a symmetric satin with \(1<a<m/2\) and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Then, we have:

  1. (i)

    \(|v_{n+1-i}|=r_i\) for \(i\in \{0,\ldots ,n+1\}\).

  2. (ii)

    \(|v_j|=r_j\) for \(j=(n+1)/2\).

  3. (iii)

    \(\Vert {\mathbf {e}}_{n+1-i} \Vert =\Vert {\mathbf {e}}_{i} \Vert\) for \(i\in \{0,\ldots ,n+1\}\).

Theorem 6.2

Let L(ma) be a symmetric satin with \(1<a<m/2\) and let \({\mathbf {e}}_i=(v_i,r_i)\), \(i\in \{0,\ldots ,n+1\}\), be the vectors of E(ma). Let \(k=\min \{i:|v_i|>r_i\}\). Then, we have:

  1. (i)

    \(k=(n+3)/2\).

  2. (ii)

    If \({\mathbf {e}}_{k-2}\) is a shortest vector, then \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k})\) is an optimal rombal basis of L(ma).

Proof

(i) By Proposition 6.2, if \(j=(n+1)/2\) we have \(|v_j|=r_j\). Hence \(k=j+1=(n+3)/2\).

(ii) If \({\mathbf {e}}_{k-2}\) is the shortest vector, then \(\Vert {\mathbf {e}}_k \Vert =\Vert {\mathbf {e}}_{k-2} \Vert\) and \({\mathbf {e}}_k\) is a shortest vector too. Then, one has

$$\begin{aligned} \Vert {\mathbf {e}}_{k} \Vert ^2 =\Vert {\mathbf {e}}_{k-2} \Vert ^2+q_{k-1}^2\Vert {\mathbf {e}}_{k-1} \Vert ^2-2q_{k-1}{\mathbf {e}}_{k-2}\cdot {\mathbf {e}}_{k-1}. \end{aligned}$$

Simplifying, and using that \({\mathbf {e}}_{k-2}\) and \({\mathbf {e}}_{k-1}\) are linear independent, we get

$$\begin{aligned} q_{k-1}\Vert {\mathbf {e}}_{k-1} \Vert ^2 =2|{\mathbf {e}}_{k-2}\cdot {\mathbf {e}}_{k-1}| <2|\Vert {\mathbf {e}}_{k-1} \Vert ^2. \end{aligned}$$

Thus, \(q_{k-1}=1\) and

$$\begin{aligned} |\det ({\mathbf {e}}_{k-2},{\mathbf {e}}_{k})| =|\det ({\mathbf {e}}_{k-2},{\mathbf {e}}_{k}-{\mathbf {e}}_{k-1})| =|\det ({\mathbf {e}}_{k-2},{\mathbf {e}}_{k-1})| =m. \end{aligned}$$

This means that \(({\mathbf {e}}_{k-2},{\mathbf {e}}_{k})\) is a rombal optimal basis. \(\square\)