TITLE: Characterizing differences of squares in $\mathbb Z[x]$
QUESTION [5 upvotes]: It is well known that a natural number can be written as a difference of two squares iff it is not of the form $4k+2$. 

I'm wondering if there is any characterization of which polynomials $f(x)\in\mathbb Z[x]$ with integer coefficients can be written as a difference $g(x)^2-h(x)^2$, for $f,g\in \mathbb Z[x]$. 

I tried googling this, but any search involving "difference of squares" and "polynomial" invariably returns a list of pages explaining the simple algebraic rule $a^2-b^2=(a+b)(a-b)$.

REPLY [4 votes]: I don't know if this is the type of characterization you are looking for:
Lemma Let $f(x) \in \mathbb Z[x]$ be a polynomial. Then $f$ is a difference of two squares if and only if $f$ can be factored as 
$$f(x)=u(x)v(x) \mbox{ with } \\
u(x), v(x) \in \mathbb Z[x] \mbox{ and } u(x)-v(x) \in 2 \mathbb Z[x]$$
The proof is trivial, set $u=g-h$ and $v=g+h$.
So the problem reduces to the factorization of $f$. If $f$ is primitive and irreducible for example then it can be written as a difference of squares if and only is $f+1 \in 2\mathbb Z[x]$.
Also if $f$ is non-primitive, and we write $f=ag$ with $a \in \mathbb Z, g \in \mathbb Z[x]$, $g$ primitive, the answer is trivial if $a$ is even: if $a=4k$ then the answer is yes, while if $a=4k+2$ the answer is no.  
But if $f$ has many factors, there might be many cases to check.