[Math] Prove that for all integers $n$ if $3 \mid n^2$, then $3 \mid n$

proof-explanationproof-writingsolution-verification

Prove that for all integers $n$ if $3$ | $n^2$, then $3$ | $n$.

I figured using contrapostive was the best method by using the definition "an integer $k$ is not divisible by 3 if and only if there exists an integer $k$ such that $n=3k+1$ or $n=3k+2$. Also using the definition $a$ divides $b$ written $a$|$b$ if $b=ac$ for some $c$ in integers.

Here it goes:

$$3\nmid n$$

$$3k+1=3n$$

$$\frac{3k+1}{3}=n$$

Best Answer

You don't need to resort to proving the contrapositive; it's possible to prove the statement directly:

If we take as given that $3$ divides (exactly) one of the three consecutive numbers $n-1$, $n$, and $n+1$, then $3$ divides their product, $(n-1)n(n+1)=n^3-n$. Now if $3$ divides $n^2$, then it also divides $n^3$, and thus it divides the difference, $n^3-(n^3-n)=n$.

Related Question