Solution: We recall the following two results:
1. We need to prove that $\frac{\mathbb{Z} _3[x]}{\langle x^2+1 \rangle }$ is a field. We will use the above results to show this. We need to show that ideal $\langle x^{2} +1 \rangle$ is maximal which is equivalent to show that the polynomial $p(x)=x^{2} +1$ is irreducible over $\mathbb{Z} _3$. As the polynomial is quadratic, it is irreducible if and only if it has a root in $\mathbb{Z} _3$. We have
\begin{align*}
p(0) & = 1 \mod 3 = 1 \\
p(1) & = 2 \mod 3 = 2 \\
p(2) & = 5 \mod 3 = 2 .
\end{align*}
Therefore, the polynomial is irreducible and hence the ideal generated is maximal.
Note that the polynomial $x^2+1$ is a quadratic polynomial and is irreducible and hence the extension degree of the field $\mathbb{Z} _3[x]/\langle x^2 +1 \rangle $ over $\mathbb{Z} _3$ is $2$. Therefore, the number of elements in the field will be $3^2=9$.
Let $I = \langle x^2 +1 \rangle $. As $ax+b+I$ is a non-zero element, we assume that $cx+d+I$ is the inverse. So we have, \begin{align*} & (ax+b+I)(cx+d+I) = 1+I \\ \implies & (ax+b)(cx+d) = 1 \\ \implies & acx^2 + (ad+bc)x+bd = 1 \\ \implies & ac(-1) + (ad+bc)x + bd = 1 \quad \boxed{x^2 = -1 \in \mathbb{Z} _3 [x]/\langle x^2+1 \rangle }. \end{align*} Thus, we got \begin{equation}\label{eq:bd-ac=1} bd-ac = 1, \end{equation} \begin{equation}\label{eq:ad+bc=0} ad+bc = 0. \end{equation} As $ax+b+I \neq I$, so $ax+b\neq 0$. Therefore, either of $a$ or $b$ will be non-zero.
Case I: $a\neq 0$. From \eqref{eq:ad+bc=0}, \begin{align*} d = -\frac{bc}{a}. \end{align*} Substituting this in \eqref{eq:bd-ac=1}, \begin{align*} b \left( -\frac{bc}{a} \right) -ac = 1 \implies -c \left( \frac{a^2+b^2}{a} \right) =1. \end{align*} Note That $a\neq 0\implies a=1 \text{ or }a=2$, which implies $a^2 =1$ in $\mathbb{Z} _3$. Also, the square of any element of $\mathbb{Z} _3$ can not be equal to $2$ and hence $a^2+b^2 \neq 0$. Therefore, \[ c = -\frac{a}{a^2+b^2} \implies d = \frac{b}{a^2 +b^2}. \] Thus, we got the inverse.
Case II: $a = 0$. If $a=0$, then the inverse of $ax+b=b$ is $\frac{1}{b}$.
Some other remarks: Suppose that $p(x)\in \mathbb{Z} _p[x]$ is irreducible, where $p$ is a prime. If $\deg (p(x)) = n$, then $\mathbb{Z} _p[x]/\langle p(x) \rangle $ is a field with $p^n$ elements.