Number Theory: Problems with Integer Squares

I have these problems assigned for homework, I was able to get through the rest of the homework fine but I'm stuck on these two. Prove that

1. If $n\equiv 6\pmod9$, then $n$ cannot be a sum of two integer squares.
2. If $n\in\mathbb{N}$ is not the sum of two integer squares, then it is not the sum of two rational squares.

I've been trying to use these theorems from class but I haven't gotten far:

Theorem 8.2: For $p$ an odd prime, there exists $a\in\mathbb{N}$ so $a^2\equiv -1\pmod{p}$.

Theorem 8.3: For $p$ an odd prime, there exist $a,b\in\mathbb{N}$ so $p=a^2+b^2\iff p\equiv 1\pmod4$.

Theorem 8.4: $n\in\mathbb{N}$ is a sum of two squares in $\mathbb{Z}\iff$ every prime divisor $p$ of $n$ with $p\equiv 3\pmod4$ occurs an even number of times in the prime factorization of $n$.

• For 1. Use the fact that any square number is either $0, 1, 4$ or $7$ modulo $9$. – user85798 Oct 25 '15 at 18:28
• Question 2: math.stackexchange.com/questions/582188/… – user85798 Oct 25 '15 at 18:30
• "Theorem 8.2" is false.If prime $p\equiv 3 \pmod 4$ then $a^2\not \equiv -1 \pmod p$. – DanielWainfleet Oct 25 '15 at 20:40
• (1) follows from Theorem 8.4 for $p=3$, but in fact it's easier to just consider $n\mod 3$ directly to deduce that if $n=a^2+b^2$, then $a,b\equiv 0 \mod 3$ (since $-1$ is not a square $\mod 3$), so $n\equiv 0\mod 9$. – user138530 Oct 26 '15 at 3:13
• Thank you so much! I just finished both problems. – MathQuestion Oct 26 '15 at 5:33

A well-known theorem states a positive integer sums to two squares iff, including multiplicity, it has an even number of prime factors $\in4\mathbb{N}-1$. We solve the second problem by showing that, if $n$ is a sum of rational squares, an integer $k>0$ exists for which $k^2n$ is the sum of two squares. The aforementioned theorem then implies, by considering the parity of prime factors $\in4\mathbb{N}-1$, $n$ will also be a sum of integer squares.

Write $n=\left(\frac{a}{b}\right)^2+\left(\frac{c}{d}\right)^2$ for integers $a,\,b,\,c,\,d$ where without loss of generality $a,\,c\ge 0,\,b,\,d>0,\,\left( a,\,b\right)=\left( c,\,d\right)=1$. In the result $\left( bd\right)^2n=\left( ad\right)^2+\left( bc\right)^2$, any prime dividing $b$ or $d$ divides each side at least twice. A prime factor of $b$ (and hence not of $a$) must divide $\left( ad\right)^2=\left( bd\right)^2n-\left( bc\right)^2$ so divides $d$, and vice versa. Write $b=kb',\,d=kd',\,\left( b,\,d\right)=1$ so $k^2n=\left(\frac{a}{b'}\right)^2+\left(\frac{c}{d'}\right)^2$. Repeating the above logic implies $b',\,d'$ have the same prime factors, so they have none i.e. $b'=d'=1,\,b=d=k$. Hence $k^2n=a^2+c^2$.

For the first problem we know that $(\forall (a,b) \in \mathbb{N}^2)\ a + b = c$ where $c \in \mathbb{N}$.

So $(a + b)^2 = c^2$.

Then take $n$ and $m$ which are natural numbers, so is $n \equiv m \pmod 9$ so $m \in \{0;1;2;3;4;5;6;7;8\}$ and because $n^2 \equiv m^2 \pmod 9$ we get that $m^2 \in \{0;1;4;7\}$.

So we remark that $n^2 \not\equiv 6 \pmod 9$ and if we change n to c we get that $c^2 \not\equiv 6 \pmod 9 \iff (a+b)^2 \not\equiv 6 \pmod 9$. $\square$

And we're done !

PS: We can said that if $n \equiv 6 \pmod 9$ so, $n$ cannot be the sum of integers squares.