Find polynomials $M_1(x)$ and $M_2(x)$ such that $(x+1)^2M_1(x) + (x^2 + x + 1)M_2(x) = 1$ I have been trying to solve this with no success. Could you suggest me a solution?

Here is an alternate basic approach based upon coefficient comparison of polynomials. We are looking for polynomials $M_1(x), M_2(x)$ so that the identity
\begin{align*}
\left(x^2+2x+1\right)M_1(x)+\left(x^2+x+1\right)M_2(x)=1\tag{1}
\end{align*}
is valid.
We start with some observations:

*

*Since the right-hand side of (1) is a polynomial of degree zero, the left-hand side has also to be a polynomial of degree zero.


*We are looking for polynomials $M_1$ and $M_2$ which have smallest possible degree. We observe setting $M_1(x)=1$ and $M_2(x)=-1$ is not appropriate since we get rid of the square terms but not of the linear terms.


*Ansatz: We start with linear polynomials
\begin{align*}
M_1(x)=ax+b\qquad M_2(x)=cx+d
\end{align*}
with unknown coefficients $a,b,c,d\in\mathbb{R}$, multiply out and make a comparison of coefficients of LHS and RHS of (1).
We denote with $[x^n]$ the coefficient of $x^n$ of a polynomial and obtain from (1)
\begin{align*}
[x^3]:\qquad\qquad &a+c&=0\\
[x^2]:\qquad\qquad&(2a+b)+(c+d)&=0\\
[x^1]:\qquad\qquad&(a+2b)+(c+d)&=0\\
[x^0]:\qquad\qquad&b+d&=1\\
\end{align*}
Coefficient comparison of $[x^3]$ gives: $c=-a$. Putting this in the other three equations results in
\begin{align*}
a+b+d&=0\\
2b+d&=0\\
b+d&=1\\
\end{align*}
from which we easily find $a=-1, b=-1, c=1, d=2$.

We finally obtain
\begin{align*}
\color{blue}{M_1(x)=-x-1\quad M_2(x)=x+2}
\end{align*}
in accordance with the other given answer.

