Find the remainder when $f(x)$ divided by $(x^2 + x + 1)(x+1)$. When a polynomial $f(x)$ is divided by $x^2 + x + 1$ and $(x+1)^2$, the remainder are $x+5$ and $x-1$ respectively. Find the remainder when $f(x)$ is divided by $(x^2 + x + 1)(x+1)$.
First, I let the remainder be $Ax^2 + Bx +C$, then I try to find the values of $A$, $B$ and $C$. There is $3$ unknowns so we need three equations but I can only get two equations. 

Write $$ f(x)=k(x)(x^2+x+1)+x+5$$
and $$ f(x)=q(x)(x+1)^2+x-1 \Longrightarrow f(-1) = -2$$
So $$-2 = f(-1) = k(-1)\cdot 1 +4 \Longrightarrow k(-1) = -6$$
thus
$$ k(x) = p(x)(x+1)-6 $$ and finally 
\begin{eqnarray}
f(x) &= &(p(x)(x+1)-6)(x^2+x+1)+x+5 \\
&=& p(x)(x+1)(x^2+x+1)-6x^2-5x-1
\end{eqnarray}
