I'd like to know if my proof is a valid way of proving this and additionally if there is a better way of going about this? I'm relatively new to discrete mathematics so any critique would be very helpful for me to improve my style and general way of going about these proofs.
Proof:
Suppose not. That is, suppose $a\in\mathbb{Z}$ and $9\mid(a^2-3)$. By definition of divisibility, $a^2-3=9p$ for some $p\in\mathbb{Z}$. By the quotient-remainder theorem, $a$ can be written in one of the forms $$3q\text{ or }3q+1\text{ or }3q+2$$ for some $q\in\mathbb{Z}$.
Case 1 ($a=3q$ for some $q\in\mathbb{Z}$): Since $a=3q$, $$a^2-3=(3q)^2-3=9q^2-3=9p\Rightarrow9(q^2-p)=3\Rightarrow3(q^2-p)=1\text{.}$$ $q^2-p\in\mathbb{Z}\because\mathbb{Z}$ is closed under addition and multiplication but $q^2-p=1/3\notin\mathbb{Z}\Rightarrow$ a contradiction.
Case 2 ($a=3q+1$ for some $q\in\mathbb{Z}$): Since $a=3q+1$, $$a^2-3=(3q+1)^2-3=9q^2+6q-2=9p\Rightarrow3(3q^2+2q-3p)=2\text{.}$$ $3q^2+2q-3p\in\mathbb{Z}\because\mathbb{Z}$ is closed under addition and multiplication but $3q^2+2q-3p=2/3\notin\mathbb{Z}\Rightarrow$ a contradiction.
Case 3 ($a=3q+2$ for some $q\in\mathbb{Z}$): Since $a=3q+2$, $$a^2-3=(3q+2)^2-3=9q^2+12q+1=9p\Rightarrow3(3q^2+4q-3p)=-1\text{.}$$ $3q^2+4q-3p\in\mathbb{Z}\because\mathbb{Z}$ is closed under addition and multiplication but $3q^2+4q-3p=-1/3\notin\mathbb{Z}\Rightarrow$ a contradiction. $$\tag*{$\blacksquare$}$$
One way is to observe that $$a^2-3 = 9p \implies a^2 = 3(3p+1) \implies 3|a^2 \implies 3|a\implies a=3q.$$ Then you use the reasoning you mentioned for Case 1.