Question:
$\int \frac{x^{2}+x+1}{(x+1)^{2}(x+2)} d x$
Solution:
$=\int \frac{x^{2}+x+1}{(x+1)^{2}(x+2)} d x$
by partial fraction,
$\frac{x^{2}+x+1}{(x+1)^{2}(x+2)}=\frac{A}{x+1}+\frac{B}{(x+1)^{2}}+\frac{C}{x+2}$
So we get these three equations,
$2 \mathrm{~A}+2 \mathrm{~B}+\mathrm{C}=1$
$3 \mathrm{~A}+\mathrm{B}+2 \mathrm{C}=1$
$\mathrm{A}+\mathrm{C}=1$
So the values are $A=-2 ; C=3 ; B=1$
$\int \frac{x^{2}+x+1}{(x+1)^{2}(x+2)} d x=\int\left(-\frac{2 d x}{x+1}\right)+\int \frac{d x}{(x+1)^{2}}+\int \frac{3 d x}{x+2}$
$=-2 \log (x+1)+3 \log (x+2)-\frac{1}{x+1}+c$