Complete the square of a 4th degree expression $k^4 + 2k^3 -k^2 - 2k + 1$ I was reading the solution of a problem and I can't figure out how to go from here:
$k^4 + 2k^3 -k^2 - 2k + 1$
to:
$((k^2 + k) -1)^2$
I guess it's using the complete-the-square method but I've only used that with quadratic expressions.
 A: The symmetry of the sequence of coefficients $(1,2,-1,-2,1)$ with respect to its middle term suggests to use the change of variables $x=k-\frac1k$. The fourth degree polynomial $P(k)$ you are interested in is $P(k)=k^2Q(k)$ with $Q(k)=k^2+2k-1-\frac2k+\frac1{k^2}$. One recognizes $2k-\frac2k=2x$. To deal with $k^2+\frac1{k^2}$, note that $x^2=k^2-2+\frac1{k^2}$ hence $Q(k)=x^2+2x+1=(x+1)^2$. 
Hence, $P(k)=k^2(x+1)^2=(kx+k)^2=(k^2-1+k)^2$.
Likewise, every polynomial $$
P(k)=a_0+a_1k+a_2k^2+\cdots+(-1)^{n-2}a_{2}k^{n-2}+(-1)^{n-1}a_{1}k^{2n-1}+(-1)^na_{0}k^{2n}
$$ of degree $2n$ is $P(k)=k^nQ(x)$ where $Q(x)$ is a polynomial of degree $n$ and $x=k-\frac1k$ and every polynomial
$$
P(k)=a_0+a_1k+a_2k^2+\cdots+a_{2}k^{n-2}+a_{1}k^{2n-1}+a_{0}k^{2n}
$$ 
of degree $2n$ is $P(k)=k^nR(y)$ where $R(y)$ is a polynomial of degree $n$ and $y=k+\frac1k$. The polynomials are easily computed using the expressions of $x^i$ and $y^i$ as sums of powers of $k$ and $\frac1k$, for successive integer values of $i\geqslant0$.
A: $k^4+2k^3−k^2−2k + 1 = k^4 + (k^2 - 2k^2) + 2k^3 - 2k + 1 \quad \Rightarrow$
$k^4+2k^3−k^2−2k + 1 = (k^4 - 2k^2 + 1) + 2k(k^2 - 1) + k^2$ 
$= (k^2 - 1)^2 + 2(k^2 - 1)k + k^2 = (k^2 - 1 + k)^2 = ((k^2 + k) - 1)^2$
