# Sum of four squares modulo a prime

With $p$ a prime integer, I am interested in showing the existence of four non-negative integers $\alpha_0,\alpha_1,\alpha_2,\alpha_3$, not all zero, such that $$\alpha_0^2+\alpha_1^2+\alpha_2^2+\alpha_3^2\equiv 0\mod p.$$ I am, of course, aware of the Lagrange four square theorem of which this is a special case. However, the fact that I am concerned with only prime $p$, and also that I have the looser modulo condition, leads me to hope that there is a simpler, more direct way of proving this.

My thoughts so far have been directed towards trying to tie quadratic residues into some sort of pigeonhole principle argument. That hasn't panned out. This question is motivated by a (double-star) problem in Herstein's Topics in Algebra. Ideally I am looking for hints rather than anything fleshed out. Thanks in advance.

• Just a quick idea: If $p \equiv 1 \pmod{4}$, let $i$ be the element such that $i^2 \equiv - 1\pmod{p}$. Then, you can take $\alpha_0 = \alpha_1 = 1$ and $\alpha_2 = \alpha_3 = i$. – JavaMan Nov 21 '12 at 5:31

## 1 Answer

Hardy and Wright derive this from their Theorem 87, page 70 in fifth edition:

If $p$ is an odd prime, then there are numbers $x,y$ such that $$1 + x^2 + y^2 = m p,$$ where $0 < m < p.$

Note that Theorem 86 on the same page says you may take $y = 0$ if $p = 4k+1.$

I would characterize the proof, roughly, as counting the squares $\pmod p,$ but care is needed.

• Thanks for the reference, it was exactly what I needed. In fact the method of Hardy and Wright's proof of Thm 87 is exactly what I was trying -- guess I should have tried harder! – Jonathan Nov 21 '12 at 5:53
• @Jonathan, fair enough. I was unable to find the double star exercise in Herstein. Plus, for what it's worth, both he and H+W eventually switch to the Hurwitz quaternions to reduce the needed special cases in the four square theorem. – Will Jagy Nov 21 '12 at 6:23
• Sorry, my first iteration of that comment was worded really clumsily. Your post pointed me in exactly the right direction. The problem in Topics in Algebra is 3.4.13b in my edition, showing quaternions over $\mathbb{Z}/p\mathbb{Z}$ are not a division ring. – Jonathan Nov 21 '12 at 6:59