Am not following algebra in a proof - what am I missing here? So I understand the majority of the proof, but am not fully following why consequently $n^2=9a^2$. Is this because we can take our value for $n$ (which is $n=3a$) and square it, which gives us $9a^2$?
I'm almost positive that's what it is, but it seems like such a loose relationship to me. Just want to make sure I'm fully understanding it.

9. Proposition Suppose $n\in\Bbb Z$. If $3\nmid n^2$, then $3\nmid n$.
Proof. (Contrapositive) Suppose it is not the case that $3\nmid n$, so $3\mid n$. This means that $n=3a$ for some integer $a$. Consequently $n^2=9a^2$, from which we get $n^2=3(3a^2)$. This shows that there is an integer $b=3a^2$ for which $n^2=3b$, which means $3\mid n^2$. Therefore it is not the case that $3\nmid n^2$. $\blacksquare$

Thanks!
 A: You're just squaring both sides of the equation:
$$ x = y \Rightarrow x^2 = y^2 $$
$$ n=3a \Rightarrow n^2 = 9a^2$$
So yes, you are understanding it correctly.
A: I think you are tied up with the contrapositive part. This is that to prove that if $P$ then $Q$ is the same as proving that if not $Q$ then not $P$. In this particular case, the original is "if $3 \nmid a^2$ then $3 \nmid a$". The conterpositive to this is "if $3 \mid a$ then $3 \mid a^2$", and that is what is proven here.
I'd suggest that if you use some proof strategy like this one, you say so clearly at the beginning, and if (as in this case) what you need to prove isn't directly the original, you state what you ae going to prove. I.e., I'd write:
Theorem: If $3 \nmid a^2$, then $3 \nmid a$
Proof: We prove the conterpositive: If $3 \mid a$ then $3 \mid a^2$.
If $3 \mid a$, then we can write $a = 3 u$ for some integer $u$. But then $a^2 = (3 u)^2 = 9 u^2 = 3 \cdot (3 u^2)$, and so $3 \mid a^2$, as was to be proved. $\square$
As you can see, no big mistery. And probably one would write the proof more compactly, not this much detail.
A: $(3a)^2 = 9a^2$.  That's all there is to it.
A: Or, it's a special case of  multiplicativity of divisibility relations.
$\begin{eqnarray} \rm Notice\ \ \ \,  &&\rm\ 3\,|\,n,\,\ 1\,|\,n &\,\Rightarrow\ &\rm 3\,|\,n^2\ \ \ \rm by  \\
\\
{\rm\bf Lemma} &&\rm\ a\,|\, A,\, b\,|\,B &\,\Rightarrow\,&\rm ab\,|\,AB \end{eqnarray}$
$\rm{\bf Proof}\quad\,\  \frac{A}a,\,\frac{B}b\,\in\,\Bbb Z\ \Rightarrow\ \frac{AB}{ab} = \frac{A}a\frac{B}b \in \Bbb Z $
i.e. integers are closed under times $\Rightarrow$ divisibility relations are too.
