I am reading ring theory (a beginner) and I stumbled upon a problem which I can't understand
The ideal $\langle x^2+1\rangle$ is not prime in $\mathbb{Z}_2[x]$, since it contains $(x+1)^2=x^2+2x+1=x^2+1$ , but does not contain $x+1$ .
$\langle x^2+1\rangle$ denotes the principal ideal generated by $x^2+1$ i.e. $$\langle x^2+1\rangle=\{f(x)(x^2+1)\mid f(x)\subset \mathbb{R}[x]\}$$ $\mathbb{R}[x]$ denotes the ring of polynomials with real coefficients.
My doubt:
How can $x^2+1+2x$ be written in the form $f(x)(x^2+1)\mid f(x)\subset \mathbb{R}[x]$ ?
Note that $\langle x^2 + 1\rangle = \{ f(x)(x^2 + 1)\,|\, f(x)\in\mathbb Z_2[x]\}$ which means that coefficients are in the ring $\mathbb Z_2$, and not $\mathbb R$. Hence, we have that $2x = 0$ in $\mathbb Z_2[x]$ (but obviously not in $\mathbb R[x]$) and $$x^2 + 1 = x^2 + 2x + 1 = (x+1)^2$$ but then $\langle x^2 + 1\rangle$ can't be prime, since $(x+1)(x+1)\in \langle x^2 + 1\rangle$, but $x+1\notin \langle x^2 + 1\rangle$.
(Recall the definition of prime ideal in commutative setting: $ab\in P\implies a\in P\vee b\in P$)
Edit: One could now find numerous similar ways to show the same thing, for example, $x^2 + 1 = x^2 - 1 = (x-1)(x+1)$, but neither $x-1$ nor $x+1$ are in $\langle x^2 + 1\rangle$.
But, there is also something hidden in the above choice, namely, prime ideals are radical, i.e. $f^n\in P\implies f\in P$ for any $n$, which can easily be proved by induction for prime ideals. Since $\langle x^2 + 1\rangle$ is not radical, it is not prime.