A positive integer $n$ is a perfect square. Prove that it cannot be of the form $4k+3$, where $k$ is an integer.
I tried to prove this by proof by contradiction: if $n$ is a perfect square, then its square root, say $x$, is an integer. Suppose $n$ is of the form $4k+3$. Then $$x^2= 4k+3$$ which we can also write as $$x^2\equiv3 \mod 4$$ However, this congruence has no solutions. Therefore our initial assumption that $n$ is of the form $4k+3$ was false and $n$ cannot be of the form $4k+3$.
I know there's something missing or wrong in this proof but I don't know what. Any help would be appreciated.