Every positive integer can be written as the sum of 4 squares $n = a\_1^2 + a\_2^2 + a\_3^2 + a\_4^2$ however, if we only allow [sum of 3 squares](http://oeis.org/A000408) some numbers have to be left out:



> 
> $n = a^2 + b^2 + c^2$ $\longleftrightarrow$ $n \equiv 4^a (8k+7)$
> 
> 
> 


Excuse me for using the same letter twice to mean different things... 




---


I am trying trying to find a proof of this result from within Cassels' [Rational Quadratic Forms](http://rads.stackoverflow.com/amzn/click/0486466701), but it's not always the easiest to read. In that book **Legendre's Theorem** is stated in a very general way:



> 
> Let $g(x) = \color{lightgry}{a}\_1 \,x\_1^2 + a\_2\, x\_2^2 + a\_3\, x\_3^2$ with $a\_1, a\_2, a\_3 \in \mathbb{Z}$ and $a\_1 a\_2 a\_3$ is squarefree...
> 
> 
> * blah
> * blah
> * blah
> 
> 
> Then where are $b\_1, b\_2, b\_3 \in \mathbb{Z}$ not all of them zero with $a\_1 \,b\_1^2 + a\_2\, b\_2^2 + a\_3\, b\_3^2 = 0$ 
> 
> 
> 


From what I gather, this Legendre theorem is strong form of the [Hasse Principle](https://en.wikipedia.org/wiki/Hasse_principle) and it can be proven using the [geometry of numbers](https://en.wikipedia.org/wiki/Geometry_of_numbers) - which is the style I am endorsing today.


By the middle of Chapter 9 - Section 5 to be exact - we get the claim that proof of this theorem is complete. Because $x\_1^2 + x\_2^2 + x\_3^2$ is the only quadratic form in it's genus. And that in indeed rested on the Hasse principle.




---


Come to think of it there is a rather serious question here. Mis-using the Hasse principle slightly we could way:



> 
> The only obstruction to having representation as sum of three squares $n = a^2 + b^2 + c^2 $ happens in the 2-adic numbers $\mathbb{Q}\_2$.
> 
> 
> 


How could a statement like this possible be proven geometrically? Minkowski's geometry of numbers is decidedly a Euclidean result and so the only possible completion that should be useful is $\mathbb{R}$.


In the case of sum of 2-squares the role of the Hasse principle is even more obvious since we can use multiplication identities like:


\begin{eqnarray} (a+bi)(c+id) &=& (ac-bd) + i(ad+bc) \\
(a^2 + b^2)(c^2 + d^2)&=& (ac-bd)^2 + (ad+bc)^2 
\end{eqnarray}
and check each time that $n = x\_1^2 + x\_2^2 \mod p$ and multiply the result. By Minkowski theorem this only works when $p = 4k+1$.




---


I am going to keep reading, but does anyone know what polyhedron or oval or other geometric shape leads to a proof of the sum of 3 squares theorem?



Proving Legendre's Sum of 3 Squares Theorem via Geometry of Numbers
A proof of the three squares theorem by the geometry of numbers was given by Ankeny in 1957. His paper is available [here](http://www.ams.org/journals/proc/1957-008-02/S0002-9939-1957-0085275-8/S0002-9939-1957-0085275-8.pdf).


**P.S.** Also, I think Legendre's proof was incomplete: he assumed Dirichlet's theorem about primes in arithmetic progressions, which was not known at that time. The first correct proof was given by Gauss. I admit I might be wrong here.


