6

For which integers $n$ there exists integers $0\le a,b,c < n$ such that $n^2=a^2+b^2+c^2$?

I made the following observations:

  • For $n=1$ and $n=0$ those integers doesn't exist.

  • If $n$ is a power of 2 those integers doesn't exist. Let $n=2^m$ with $m>0$ the smallest power of 2 for which there exists $a,b,c$ such that $\left (2^m\right )^2=4^m=a^2+b^2+c^2$. Since $4^m$ is divisible by 4, $a^2+b^2+c^2$ has to be divisible by 4 too. This is only possible if $a^2\equiv b^2\equiv c^2\equiv 0\pmod 4$, so we can write $a=2a',b=2b',c=2c'$ with $a',b',c'\in \mathbb{N}$. But then we get $\left (2^{m-1}\right )^2=4^{m-1}=a'^2+b'^2+c'^2$, so $m=1$, otherwise $2^m$ wouldn't be the smallest power of two with this property. It is easy to check that $n=2$ doesn't work, so for $n=2^m$ the statement doesn't hold.

  • I suspect (but can't prove) that for all other values the statement holds. It would be enough to prove that for all odd primes $p$ there exists $a,b,c$ such that $p^2=a^2+b^2+c^2$, since for all other values of $n$ there exist some $p,m$ such that $n=pm$. Then we get $n^2=(pm)^2=(ma)^2+(mb)^2+(mc)^2$.

  • Hint: Pythagorean triples would help. – Aligator Aug 05 '20 at 14:53
  • Does This answer your question? https://math.stackexchange.com/questions/3344080/conjecture-any-sufficiently-big-sum-of-three-squares-can-be-written-as-a-square – Aligator Aug 05 '20 at 15:31
  • See also https://math.stackexchange.com/q/1040843, https://math.stackexchange.com/q/105558, https://en.wikipedia.org/wiki/Pythagorean_quadruple – Integrand Aug 05 '20 at 15:32
  • @Integrand very interesting links, but I didn't really got a proof that $a,b,c$ exists for every $n$. I tried something with Pythagorean quadruples and the for square theorem that may be interesting, but doesn't work. I will add it in the original post. – Amos Nicodemus Aug 05 '20 at 16:08
  • @Jan The second answer of the post almost does. It doesn't really give a proof, but it uses the same ideas as I used in my proof below. – Amos Nicodemus Aug 07 '20 at 08:38

4 Answers4

5

Some Pythagorean triples:

$3^2+4^2=5^2$

$5^2+12^2=13^2$

So: $3^2+4^2+12^2=13^2$

Generalize that:

$(3t)^2+(4t)^2+(12t)^2=(13t)^2$

$n=13t$ , $t> 0 $

Aligator
  • 1,454
  • 1
    This may be true but it misses a large class of these objects such as $2^2+3^2+6^2=7^2$ or $1^2+4^2+8^2=9^2$ that are not otherwise Pythagorean triples. As such, I think this answer is somewhat incomplete and I'm downvoting it. – Integrand Aug 05 '20 at 15:18
  • That's true, but I don't really see how this helps in the general case. If you want to use an other number prime number than 13, you still need the fact that is is writable as the sum of three squares via the Pythagorean triples. As far as I know not every odd prime can be the hypothenuse of a right triangle, so then this trick doesn't work all the time. – Amos Nicodemus Aug 05 '20 at 15:20
5

You are correct: If $p > 2$ is prime, then $p^2$ can always be written as the sum of three squares at least two of which are non-zero.

Let $s(n)$ denote the number of ways of writing $n = a^2 + b^2 + c^2$, where $a$, $b$, and $c$ are integers (positive or negative) and not accounting for symmetries. One has $s(1) = 6$.

If $p > 2$ is prime, then $p^2$ can be written as a sum of three squares (including degenerate examples) in

$$6\left(p + 1 - \left( \frac{-1}{p} \right)\right)$$

ways. (For a reference, see https://mathoverflow.net/questions/3596/is-there-a-simple-way-to-compute-the-number-of-ways-to-write-a-positive-integer). For example, if $p = 3$, then $(-1/3) = -1$ so we get $30$ ways, and indeed

$$3^2 = (\pm 3)^2 + 0^2 + 0^2 = 0^2 + (\pm 3)^2 + 0^2 = 0^2 + 0^2 + (\pm 3)^2,$$

giving $3 \times 2 = 6$ ways, and

$$3^2 = (\pm 2)^2 + (\pm 2)^2 + (\pm 1)^2 = (\pm 2)^2 + (\pm 1)^2 + (\pm 2)^2 = (\pm 1)^2 + (\pm 2)^2 + (\pm 2)^2$$

giving $3 \times 8 = 24$ ways. The examples you wish to rule out at the ones where either $a$, $b$, or $c$ is $\pm p$, and this gives $6$ solutions. Hence you simply need to observe that $p + 1 - (-1/p) > 1$, which is always true.

2

If we want $a^2+b^2+c^2=n^2$, then $a^2+b^2=n^2-c^2=(n-c)(n+c)$.

So a way to generate solutions is to choose $a$ and $b$ and then try to find $n$ and $c$ that work.

Example: $a=10$, $b=11$. So $a^2+b^2=100+121=221$.

Now $221=13*17=(15-2)(15+2)$. So a solution should be $10^2+11^2+2^2=15^2$.

You could also write $221=221=1*221=(111-110)(111+110)=111^2-110^2$. So another solution would be $10^2+11^2+110^2=111^2$.

I will leave it to you to explore this idea further if you wish.

paw88789
  • 40,402
2

I think I found the solution. Lebesgue's identity says $(k^2 + l^2 + m^2 + n^2)^2 = (2kn + 2lm)^2 + (2ln - 2km)^2 + (k^2 + l^2 - m^2 - n^2)^2$, so if every odd prime $p$ can be written as the sum of four primes such that non of the right-hand-side terms is equal to $p^2$ the question is solved.

Lagrange's four square theorem says that every integer can be written as the sum of four squares. We check that if $p=k^2+l^2+m^2+n^2$ then none of the right hand side terms is necessarily $p^2$.

  • $(k^2 + l^2 + m^2 + n^2)^2 = (2km + 2ln)^2$ only if $m=k$ and $n=l$, but then $p$ should be even, so this is not possible.
  • $(k^2 + l^2 + m^2 + n^2)^2 = (2ln - 2km)^2$ only if $n=l$ and $m=k=0$, which would give again that $p$ is even.
  • $(k^2 + l^2 + m^2 + n^2)^2 = (k^2 + l^2 - m^2 - n^2)^2$ only if $m=n=0$ or $k=l=0$. Since $p$ can't be a perfect square (it's prime), at least 2 of $k,l,m,n$ aren't 0. So we can swap them in such a way that nor $k=l=0$ nor $m=n=0$.

Thus every square of an odd prime can be written as the sum of four squares. Because of the third observation in the question it follows that every number that isn't a power of 2 can be written as the sum of 3 squares.

KCd
  • 46,062