I am trying to prove that $\mathbb{Z}[i]\cong \mathbb{Z}[x]/(x^2+1)$.
My initial plan was to use the first isomorphism theorem. I showed that there is a map $\phi: \mathbb{Z}[x] \rightarrow \mathbb{Z}[i]$, given by $\phi(f)=f(i).$ This map is onto and homorphic. The part I have a question on is showing that the $ker(\phi) = (x^{2}+1)$.
One containment is trivial, $(x^2+1)\subset ker(\phi)$. To show $ker(\phi)\subset (x^2+1)$, let $f \in ker(\phi)$, then f has either $i$ or $-i$ as a root. Sot $f=g(x-i)(x+i)=g(x^2+1).$ How can I prove that $f \in \mathbb{Z}[x]\rightarrow g \in \mathbb{Z}[x]$?