# (p) is prime in $\mathbb Z[i]$ if and only if there is no such $\mathbb a \in \mathbb F_p$ such that $\mathbb a^2+1=0$

I need some help with the following: I have already proved that $\mathbb Z[i]/(p) \cong \mathbb F_p[x]/(x^2+1)$ however, I cannot figure out how to prove that:

1. (p) is prime in $\mathbb Z[i]$ if and only if there is no such $\mathbb a \in \mathbb F_p$ such that $\mathbb a^2+1=0$
2. It happens if and only if $\mathbb p\equiv 3\pmod 4$

I managed to do one direction of the first of these. Since if there was such an $\mathbb a$ one could consider $\mathbb (x-a)(x+a)$ which gives $\mathbb 0$ as a result in $\mathbb F_p[x]/(x^2+1)$ while both of the factors are nonzero thus $\mathbb F_p[x]/(x^2+1)$ is not an integral domain, which means that $\mathbb Z[i]/(p)$ is not an integral domain either, which in turn gives us that $\mathbb (p)$ is not a prime ideal of $\mathbb Z[i]$.
However, I am stuck with the other direction and the second part. Could you help me out? Thanks!

1. You have already provided one direction. For the other, suppose there is no such $a$. $F_p[x]$ is a UFD so $x^2+1$ is prime if and only if it is irreducible, which since it is degree two, occurs if and only if it is has some linear factor, i.e. a root. But our assumption that there is no such $a$ exactly says that there is no root, so $x^2+1$ is prime, so $F_p[x]/(x^2+1)$ is an integral domain, so $\mathbb{Z}[i]/(p)$ is an integral domain.
2. So we need to prove -1 is a non-square in $\mathbb{Z}/(p)$ if and only if $p$ is 3 mod 4. -1=1 is a square mod 2, so we can assume $p$ is odd. See any algebra book for a proof that the multiplicative group of $\mathbb{Z}/(p)$ is cyclic. It is necessarily of order $p-1$. Let $g$ be a generator. Then the (nonzero) squares are exactly the elements of the form $g^s$ for $s$ even. Write $-1 = g^r$. Then $r \neq 0$ mod $p-1$, but $2r = 0$ mod $p-1$, so we get $r = (p-1)/2$. This is odd if and only if $p = 3$ mod 4.