# Integrate the function $\int\large\frac{x^2+x+1}{(x+1)^2(x+2)}$

Toolbox:
• If the integral function is a proper rational function, then it can be resolved into its partial fraction,$(ie)\frac{1}{(x+a)(x+b)^2}=\frac{A}{(x+a)}+\frac{B}{(x+b)}+\frac{c}{(x+b)^2}$
Step 1:
$\large\frac{x^2+x+1}{(x+1)^2(x+2)}=\frac{A}{(x+1)}+\frac{B}{(x+1)^2}+\frac{c}{(x+2)}$-------(1)
$(x^2+x+1)=A(x+1)(x+2)+B(x+2)+C(x+1)^2$
$(x^2+x+1)=A(x^2+3x+2)+B(x+2)+C(x^2+2x+1)$
$(x^2+x+1)=(A+C)x^2+(3A+B+2C)x+(2A+2B+C)$
On comparing the coefficients of like powers on both sides we get,
$A+C=1$-----(2)
$3A+B+2C=1$-----(3)
$2A+2B+C=1$------(4)
Step 2:
On solving these equations we get,
$A+C=1$
$A=1-C$-----(5)
$3(1-C)+B+2C=1$
$3-3C+B+2C=1$
$B-C=1-3$
$B-C=-2$
$B=-2+C$-----(6)
Substituting this in equ(4) we get
$2A+2B+C=1$
$2(1-C)+2(-2+C)+C=1$
$2-2C+(-4+2C+C)=1$
$-2-2C-4+2C+C=1$
$-2+C=1$
$C=3$
Substituting the value of $C$ in equ(5) we get,
$A=1-3$
$A=-2$
Substituting the value of $C$ in equ(6) we get,
$B=-2+C$
$B=-2+3$
$B=1$
Step 3:
From equ(1) we get
$\large\frac{x^2+x+1}{(x+1)^2(x+2)}=\frac{-2}{(x+1)}+\frac{1}{(x+1)^2}+\frac{3}{(x+2)}$
$\qquad\qquad\;\;\;=-2\int\large\frac{dx}{x+1}$$+\int \large\frac{dx}{(x+1)^2}$$+3\int \large\frac{dx}{(x+2)}$