Fermat’s Two Squares for polynomials Is there an analog of Fermat’s Two Squares theorem over polynomial rings $\Bbb Z[x]$ by considering a version for non-negative polynomials? 
Fermat two squares says primes $p$ is sum of two squares iff $-1$ is quadratic residue mod $p$. Is there a sum of two squares formulation over polynomial rings using quadratic residues?
 A: $\def\QQ{\mathbb{Q}}$Yes. From this answer, I learn of the following result of Davenport, Lewis and Schinzel:

If $f(x)$ is a polynomial with integer coefficients such that every
  arithmetic progression contains an integer $n$ for which $f(n)$ is a
  sum of squares, then $f(x) = u(x)^2+v(x)^2$ where $u$ and $v$ are
  polynomials with integer coefficients.

In particular, if $f(n)$ is a sum of squares for all $n$, then $f(x) = u(x)^2+v(x)^2$.

I believe what actually comes out of the proof is the following criterion. Write $f(x) = c g(x)^2 \prod_j h_j(x)$ with $c \in \QQ$ and the $h_j$ distinct monic irreducible polynomials. Let $K_j$ be the field $\QQ[\alpha]/h_j(\alpha)$. Then $f(x)$ is a sum of squares if and only if 


*

*$c$ is a sum of squares and

*$\sqrt{-1}$ is in the field $K_j$ for all $j$.


The point is that, by a theorem of Bauer (see e.g. Theorem 2.6 here), if $\sqrt{-1}$ is NOT in $K_j$ then one can find a prime $p \equiv 3 \bmod 4$ such that $h_j$ has a root $\bar{u}$ mod $p$. By some elementary arguments (see the paper) one can lift $\bar{u}$ to an integer $u$ so that $f(u)$ is divisible by $p$ exactly once, showing that $f(u)$ is not a sum of squares.
If your goal were to use this to check that a given polynomial is a sum of squares, you'd want an effective version of Bauer's theorem. This is more or less the same as an effective version of the Cebatarov density theorem. Such exist, but there are better ways to check whether one number field contains another. 
More precisely, consider the question of whether $L$ contains a subfield isomorphic to $K$, for $K$ and $L$ number fields. My understanding (and this is NOT an area I am very knowledgeable about) is that one first generates lots of primes $p$ in search of a prime which splits in $L$ but not in $K$. If one finds such a prime, the answer is "NO" and you are done. However, I believe that, if the search fails, it is worth switching to other methods long before one has searched far enough for the failed search to constitute a proof that $K \subseteq L$.
