I am practising exam questions and have come across the following.
Prove that $n^2$ is even if and only if $n$ is even
A contrapositive proof comes to mind, since it must be the case that if $n$ isn't odd then $n$ is even. So $n^2 = (2k+1)^2 = 4k^2 + 4k + 1$ which is odd, hence $n^2$ must be even.
Is this correct?
For an if-and-only-if proof, you need to show both ways - you have only done $n$ even $\implies$ $n^2$ even, which is correct. You must show that
if $n=2k$ for some integer $k$, $n^2=4k^2=2(2k^2)$ is even, which is true
if $n^2=2t$ for some integer $t$ but $n=2s+1$ is odd for some integer $s$, $$(2s+1)^2=2t\implies 4s^2+4s-2t=2(2s^2+2s-t)=-1$$ is a contradiction as the parities on LHS and RHS are different