Question:
Evaluate the following integral:
$\int \frac{x^{2}+x-1}{(x+1)^{2}(x+2)} d x$
Solution:
$I=\int \frac{x^{2}+x-1}{(x+1)^{2}(x+2)} d x$
$\frac{\mathrm{x}^{2}+\mathrm{x}-1}{(\mathrm{x}+1)^{2}(\mathrm{x}+2)}=\frac{\mathrm{A}}{\mathrm{x}+1}+\frac{\mathrm{B}}{(\mathrm{x}+1)^{2}}+\frac{\mathrm{c}}{\mathrm{x}+2}$
$x^{2}+x-1=A(x+1)(x+2)+B(x+2)+C(x+1)^{2}$
Put $x=-2$
$1=C$
$C=1$
Put $x=-1$
$-1=B$
$B=-1$
Equating coefficients of constants
$-1=2 A+2 B+C$
$-1=2 A-2+1$
$A=0$
Thus,
$I=0 \times \int \frac{d x}{x+1}+(-1) \int \frac{d x}{(x+1)^{2}}+\int \frac{d x}{x+2}$
$I=-\left(\frac{-1}{(x+1)}\right)+\log |x+2|+C$
$=\left(\frac{1}{(x+1)}\right)+\log |x+2|+C$