<s>[INST] 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. 
 [/INST] We know that
$$f(x)=Q_1(x)(x^2 + x + 1)+x+5=Q_2(x)(x+1)^2+x-1$$
for some polynomials $Q_1$ and $Q_2$.
Moreover, for some polynomial $Q_3$,
$$f(x)=Q_3(x)(x^2 + x + 1)(x+1)+Ax^2+Bx+C.$$
Hence
$$f(-1)=-1-1=A(-1)^2+B(-1)+C.$$
Now consider the complex zeros $w_1$ and $w_2$ of $x^2 + x + 1$. Then
$$f(w_1)=w_1+5=Aw_1^2+Bw_1+C\quad,\quad f(w_2)=w_2+5=Aw_2^2+Bw_2+C.$$
By solving the linear system of the three equations we find that $A = -6$, $B = -5$, $C = -1$.
</s>