Skip to main content
2 of 5
clarification: 0 \in \mathbb{N}
Sebastien Palcoux
  • 27k
  • 5
  • 74
  • 186

Legendre's three-square theorem and squared norm of integer matrices

Consider the following two sets (we assume $0 \in \mathbb{N}$):
$$E_n= \left\{ \sum_{i=1}^na_i^2 \ | \ a_i \in \mathbb{N} \right\} \ \text{ and } \ F_n=\left\{ \Vert A \Vert^2 \ | \ A \in M_n(\mathbb{N}) \right\},$$ with $\Vert A \Vert$ the operator norm. If $A = (u,0,\cdots, 0)$ then $\Vert A \Vert^2 = \Vert u \Vert^2$. It follows that $E_n \subseteq F_n$.

The case $n=3$ is exceptional in the sense that $E_n= F_n$ $\forall n \neq 3$ whereas $E_3 \subsetneq F_3$:

  • obviously $E_1=F_1$,
  • it is proved here that $E_2=F_2$,
  • for $n \ge 4$, $E_n=F_n$ because $E_4 = \mathbb{N}$, by Lagrange's four square theorem,
  • finally, $E_3 \subsetneq F_3$ because $E_3E_3 \subseteq F_3$ (see investigation below) and

Legendre's three-square theorem: $E_3 = \mathbb{N} \setminus \{ 4^a(8b+7) \ | \ a,b \in \mathbb{N} \}$.

The computation below shows that $F_3$ contains every natural number less than $10^6$; leading to:

Question: Does the form $\Vert A \Vert^2$ cover every natural number for $A \in M_3(\mathbb{N})$?

Remark: It is proved here for $A \in M_3(\mathbb{Z})$.



Investigation

Note that $\Vert A \Vert^2$ is the largest eigenvalue of $A^*A$. Assume that $A=(u_1,u_2,u_3)$ with $u_i \in \mathbb{N}^3$. Then, observe that the characteristic polynomial of $A^*A$ is $$P(x) = x^3-\left(\sum_{i=1}^3 \Vert u_i \Vert^2 \right)x^2 + \left( \sum_{i<j} \Vert u_i \times u_j \Vert^2 \right)x - \left( u_1 \cdot (u_2 \times u_3) \right)^2 $$ with $u \times v$ the cross product and $u \cdot v$ the dot product.

Assume that the vectors $u_1, u_2, u_3$ are linearly dependent. Then

$$\Vert A \Vert^2 = \frac{1}{2} \left( \sum_{i=1}^3 \Vert u_i \Vert^2 + \sqrt{\left( \sum_{i=1}^3 \Vert u_i \Vert^2 \right)^2 -4 \sum_{i<j} \Vert u_i \times u_j \Vert^2} \right)$$

Assume that $u_1, u_2, u_3$ are collinear, i.e. there is $u \in \mathbb{N}^3$ and $k_i \in \mathbb{N}$ such that $u_i = k_iu$. Then $$\Vert A \Vert^2 = \Vert u \Vert^2 \sum_{i=1}^3 k_i^2$$ It follows that $F_3$ contains the set $E_3E_3$. Observe that $E_3E_3 = \mathbb{N} \setminus I $ with $I$ the set of natural numbers $n$ of the form $8a-1$ whose prime factors are of the form $8b \pm 1$. The first elements of $I$ are $7, 23, 31, 47, 71, 79, 103, 119, 127, 151, 167, 191, 199, \dots$

Now assume just that $u_3=0$. Then \begin{align*} \Vert A \Vert^2&=\frac{1}{2} \left( \Vert u_1 \Vert^2 + \Vert u_2 \Vert^2 + \sqrt{\left( \Vert u_1 \Vert^2 + \Vert u_2 \Vert^2 \right)^2 -4 \Vert u_1 \times u_2 \Vert^2} \right)\\ &=\frac{1}{2} \left( \Vert u_1 \Vert^2 + \Vert u_2 \Vert^2 + \sqrt{\left( \Vert u_1 \Vert^2 - \Vert u_2 \Vert^2 \right)^2 + 4 (u_1 \cdot u_2)^2} \right) \end{align*} If moreover, $\Vert u_1 \Vert = \Vert u_2 \Vert$ then $\Vert A \Vert^2 = \Vert u_1 \Vert^2 + (u_1 \cdot u_2) = \frac{1}{2} \Vert u_1+u_2 \Vert^2 $, and we know by this post that this form covers every odd less than $90000$, except those in $\{ 5, 23, 29, 65, 167 \}$.
So the above models together with the following equalities covers every $n<90000$. $$ 23 = \left\| \pmatrix{0&2&0\\ 1&4&0 \\ 2&1&0} \right\|^2 \ \text{ and } \ 167 = \left\| \pmatrix{0&7&0\\ 2&5&0 \\ 8&7&0} \right\|^2.$$ If $u_1=(a,b,c)$, $u_2 = (b,c,a)$ and $u_3=0$, then $2\Vert A \Vert^2 = (a+b)^2+(b+c)^2+(c+a)^2$.
Observe (after this comment of Hagen von Eitzen) that we are reduced to show that $\forall n \in I$ with $n \ge 90000$, $2n$ is a sum of three squares $x^2+y^2+z^2$ (which is true by Legendre's three-square theorem) with the additional assumption that $x,y,z$ are the integer sides of a triangle (i.e. $x \le y \le z \le x+y $), which is checked below for $2543<n<10^6$.

Remark: This stronger version of Legendre's three-square theorem is suspected to be true for every $2n$ with $n$ odd greater than $5969$ (see this post), and in general, every sufficiently large element of $E_3$.


Computation

sage: ModelOutEE(2544,1000000)
[]

Code

cpdef legendre_inter(int i):
    cdef int n,a,b,c,j
    n=isqrt(i)
    for a in range(n+1):
        for b in range(a+1):
            j=i-a**2-b**2
            if j>=0:
                c=isqrt(j)
                if c**2==j:
                    if c<=a and a<=b+c:
                        return True
                    if c>a and c<=a+b:
                        return True
    return False

cpdef is_EE(int i):
    cdef int a,l
    cdef list f
    cdef tuple j
    if not Integer(i).mod(8)==7:
        return True
    b=0
    f=list(factor(i))
    for j in f:  
        a=j[0]
        if not Integer(a).mod(8) in [1,7]:
            return True
    return False

cpdef ModelOutEE(int r1, int r2):
    cdef int i
    cdef list L
    L=[]
    for i in range(r1,r2):
        if not is_EE(i):
            if not legendre_inter(2*i):
                L.append(i)
    return L
Sebastien Palcoux
  • 27k
  • 5
  • 74
  • 186