Evaluate $\displaystyle \int \dfrac{dx}{\left(x + 1\right)^2 \left(x^2 + 1\right)}$
Let $I = \displaystyle \int \dfrac{dx}{\left(x + 1\right)^2 \left(x^2 + 1\right)}$ $\;\;\;\cdots \; (1)$
Let $\dfrac{1}{\left(x + 1\right)^2 \left(x^2 + 1\right)} = \dfrac{A}{x + 1} + \dfrac{B}{\left(x + 1\right)^2} + \dfrac{C x + D}{x^2 + 1}$ $\;\;\; \cdots \; (2)$
$\begin{aligned}
\text{i.e. } 1 & = A \left(x + 1\right) \left(x^2 + 1\right) + B \left(x^2 + 1\right) + \left(C x + D\right) \left(x + 1\right)^2 \\\\
& = A x^3 + A x^2 + A x + A + Bx^2 + B + C x^3 + 2 C x^2 + C x + D x^2 + 2 D x + D \\\\
& = x^3 \left(A + C\right) + x^2 \left(A + B + 2 C + D\right) + x \left(A + C + 2 D\right) + \left(A + B + D\right)
\end{aligned}$
Comparing the constant term gives
$A + B + D = 1$ $\;\;\; \cdots \; (3a)$
Comparing the coefficients of the $x$ term gives
$A + C + 2 D = 0$ $\;\;\; \cdots \; (3b)$
Comparing the coefficients of the $x^2$ term gives
$A + B + 2 C + D = 0$ $\;\;\; \cdots \; (3c)$
Comparing the coefficients of the $x^3$ term gives
$A + C = 0$ $\implies$ $C = - A$ $\;\;\; \cdots \; (3d)$
Substituting equation $(3d)$ in equation $(3b)$ gives
$2 D = 0$ $\implies$ $D = 0$
Substituting the value of D in equation $(3a)$ gives
$A + B = 1$ $\;\;\; \cdots \; (4a)$
In view of equation $(3d)$ and $D = 0$, equation $(3c)$ becomes
$A + B -2 A = 0$ $\implies$ $B - A = 0$ $\;\;\; \cdots \; (4b)$
Adding equations $(4a)$ and $(4b)$ gives
$2 B = 1$ $\implies$ $B = \dfrac{1}{2}$
$\therefore$ From equation $(4b)$, $A = \dfrac{1}{2}$
$\therefore$ From equation $(3d)$, $C = \dfrac{-1}{2}$
Substituting the values of A, B, C and D in equation $(2)$ gives
$\dfrac{1}{\left(x + 1\right)^2 \left(x^2 + 1\right)} = \dfrac{1}{2 \left(x + 1\right)} + \dfrac{1}{2 \left(x + 1\right)^2} - \dfrac{x}{2 \left(x^2 + 1\right)}$ $\;\;\; \cdots \; (5)$
$\therefore$ In view of equation $(5)$, equation $(1)$ becomes
$I = \dfrac{1}{2} \displaystyle \int \dfrac{dx}{x + 1} + \dfrac{1}{2} \displaystyle \int \dfrac{dx}{\left(x + 1\right)^2} - \dfrac{1}{2} \displaystyle \int \dfrac{x \; dx}{x^2 + 1}$
i.e. $I = \dfrac{1}{2} \log \left|x + 1\right| - \dfrac{1}{2 \left(x + 1\right)} - \dfrac{1}{2} \displaystyle \int \dfrac{x \; dx}{x^2 + 1}$ $\;\;\; \cdots \; (6)$
Consider $\displaystyle \int \dfrac{x \; dx}{x^2 + 1}$ $\;\;\; \cdots \; (7)$
Let $x^2 + 1 = t$ $\;\;\; \cdots \; (7a)$
Differentiating equation $(7a)$ gives
$2 x \; dx = dt$ $\implies$ $x \; dx = \dfrac{dt}{2}$ $\;\;\; \cdots \; (7b)$
$\therefore$ $\;$ In view of equations $(7a)$ and $(7b)$, equation $(7)$ becomes
$\begin{aligned}
\displaystyle \int \dfrac{x \; dx}{x^2 + 1} & = \dfrac{1}{2} \displaystyle \int \dfrac{dt}{t} \\\\
& = \dfrac{1}{2} \log \left|t\right| + c \\\\
& = \dfrac{1}{2} \log \left|x^2 + 1\right| + c \;\;\; \cdots \; (8) \;\;\; \left[\text{from equation }(7a)\right]
\end{aligned}$
$\therefore$ $\;$ We have from equations $(6)$ and $(8)$
$I = \dfrac{1}{2} \log \left|x + 1\right| - \dfrac{1}{2 \left(x + 1\right)} - \dfrac{1}{4} \log \left|x^2 + 1\right| + c$