Question:
Evaluate the following integral:
$\int \frac{5}{\left(x^{2}+1\right)(x+2)} d x$
Solution:
$I=\int \frac{5}{\left(x^{2}+1\right)(x+2)}$
$\frac{5}{\left(x^{2}+1\right)(x+2)}=\frac{A x+B}{x^{2}+1}+\frac{C}{x+2}$
$5=(A x+B)(x+2)+C\left(x^{2}+1\right)$
Equating constants
$5=2 B+C$
Equating coefficients of $x$
$0=2 A+B$
Equating coefficients of $x^{2}$
$0=A+C$
Solving, we get
$A=-1, B=2, C=1$
Thus
$I=\int \frac{-x+2}{x^{2}+1} d x+\int \frac{d x}{x+2}$
$=\int \frac{-\mathrm{xdx}}{\mathrm{x}^{2}+1}+2 \int \frac{\mathrm{dx}}{\mathrm{x}^{2}+1}+\int \frac{\mathrm{dx}}{\mathrm{x}+2}$
$I=-\frac{1}{2} \log \left|x^{2}+1\right|+2 \tan ^{-1} x+\log |x+2|+C$