I want to use this as a lemma in a different proof, but I'm not sure if it holds. I would suspect it does, since: $n^2 \mod 5$ is in $\{0, 1, 4\}$ for all integers $n$, and only $0$ puts $0$ in this set, but I don't think this is enough to prove it. Can this be proved, or am I wrong?
-
Yeah. It's true. Brut force tells you $n\equiv 0,\pm 1,\pm 2 \mod 5$ and $n^2\ equiv 0, 1 ,4\mod 5$. – fleablood Oct 22 '17 at 05:13
-
That is to prove it. – Arthur Oct 22 '17 at 05:14
-
The method you used works for best for the general case; note that for $p$ prime, $p\mid n^2\Rightarrow p\mid n$. One way to prove this is to show that $p\mid ab, a,b\in Z\Rightarrow p\mid a\ OR\ p\mid b$ – Oct 22 '17 at 05:17
-
Possible duplicate of Proof verification: If $\gcd(a,b)=1$, then $\gcd(a^2,b^2)=1$ – Davood Oct 22 '17 at 11:25
-
Suppose on contrary that $\gcd(a,5)=1$, which implies that $5 \mid \gcd(a^2,5) \mid \gcd(a^2,25)=1$; which is an obvious contradiction! – Davood Oct 22 '17 at 11:35
4 Answers
$n^2 \equiv 0 \pmod p \implies p | n$ holds for all prime $p$ (so, yes, it does hold for your case of $p=5$).
It does not necessarily hold for composite $p$, e.g. consider $n^2 \equiv 0 \pmod 4$ and see if it's necessarily true that $4 | n$?

- 26,801
-
Yes, $2$ puts another $0$ in the set for $\bmod 4$ so it makes sense that it doesn't hold for that. Can you prove that it actually holds for all primes $p$ though? – user2059300 Oct 22 '17 at 05:15
-
Why not try it yourself as a simple exercise? Consider the prime factorisation of a square number. – Deepak Oct 22 '17 at 05:16
-
Thanks @Deepak, I figured out the proof. You were right -- it was trivial since $p$ is prime. Thanks! – user2059300 Oct 22 '17 at 05:21
-
There are only 5 equivalence classes. Brute force will verify $n\equiv 0 \mod 5\iff n^2\equiv 0\mod 5$.
This is overkill, but if $p $ is prime, then of the $p $ equivalence classes $0 \mod p $ is the only divisor of zero[1] and so $n \times m\equiv 0$ only if either $n $ or $m \equiv 0 \mod p $. Therefore $n^k\equiv 0\iff n\equiv 0\mod p $.
So,yes, you can state that.
[1] $n \times m\equiv 0 \implies n \times m=kp\implies p|n \times m $ but as $p $ is prime either $p|n $ or $p|m $, i.e. either $n $ or $m \equiv 0 \mod p$.
Simple proof: by contrapositive.
Harder proof but still valid: using the Fundamental Theorem of Arithmetic
Forst is useful, second is kinda fun to work with

- 2,146
Euclid's Lemma:
If $p$, prime, divides $ab$, then $p|a$ or $p|b.$
Hence: $p|n^2$ $ \rightarrow$ $p|n.$

- 20,344
- 2
- 17
- 28