Find all values of $x$ at which $P(x)=x^4-4x^3+22x^2-36x+18$ is a perfect square Find all values  of  positive  integer  $x$ at which  the following  expression is perfect  square 
$$P(x)=x^4-4x^3+22x^2-36x+18$$
I tried  to assume $P= (x^2+ax+b)^2$  ;  and  comparing the cofactors , get that $a= -2 ; b= 9$ 
, but when expand the $x^2-2x+9$,  I didn't get  the same as $P$
What is wrong in my work? 
 A: As Jyrki Lahtonen mentioned in comments, my bounds can be improved to
$$(x^2-2x-14)^2 < P(x) < (x^2-2x-13)^2,$$
or in expanded form:
$$196 + 56 x - 24 x^2 - 4 x^3 + x^4 < 18 - 36 x - 22 x^2 - 4 x^3 + x^4 < 169 + 52 x - 22 x^2 - 4 x^3 + x^4$$
for sufficiently large values of $x$ ($x \ge 48$ in first inequality, $x \ge -1$ in the second one). But these bounds are actually squares of adjacent integers, so after inspection of finitely many cases ($x = 1, 2, \ldots, 47$) we can surelz say that $P(x)$ is never a square.
A: If $x$ is an integer, then
$$x^4-4x^3-22x^2-36x+18$$
$\qquad$is congruent to $2$ mod $4$ if $x$ is even, 

$\qquad$and is congruent to $5$ mod $8$ if $x$ is odd, 

hence can't be a perfect square.

(Even squares are congruent to $0$ mod $4$, and odd squares are congruent to $1$ mod $8$.)

Some details . . .

If $x$ is even, all the terms are multiples of $4$ except $18$, so
\begin{align*}
&x^4-4x^3-22x^2-36x+18\\[4pt]
\equiv\;&18\;(\text{mod}\;4)\\[4pt]
\equiv\;&2\;(\text{mod}\;4)\\[4pt]
\end{align*}
If $x$ is odd, then $x^2 \equiv 1\;(\text{mod}\;8)$, hence
\begin{align*}
&x^4-4x^3-22x^2-36x+18\\[4pt]
\equiv\;&x^4-4x^3-6x^2-4x+2\;(\text{mod}\;8)\\[4pt]
\equiv\;&(x^2)^2-4(x^2)x-6x^2-4x+2\;(\text{mod}\;8)\\[4pt]
\equiv\;&(1)^2-4(1)x-6(1)-4x+2\;(\text{mod}\;8)\\[4pt]
\equiv\;&-3-8x\;(\text{mod}\;8)\\[4pt]
\equiv\;&5\;(\text{mod}\;8)\\[4pt]
\end{align*}
