Evaluate the following integral:
$\int \frac{x^{2}+1}{(2 x+1)\left(x^{2}-1\right)} d x$
Denominator is factorized, so let separate the fraction through partial fraction, hence let
$\frac{x^{2}+1}{(2 x+1)\left(x^{2}-1\right)}$
$=\frac{x^{2}+1}{(2 x+1)(x-1)(x+1)}$
$\frac{\mathrm{x}^{2}+1}{(2 \mathrm{x}+1)(\mathrm{x}-1)(\mathrm{x}+1)}=\frac{\mathrm{A}}{2 \mathrm{x}+1}+\frac{\mathrm{B}}{\mathrm{x}-1}+\frac{\mathrm{C}}{\mathrm{x}+1} \ldots \ldots$ (i)
$\Rightarrow \frac{x^{2}+1}{(2 x+1)(x-1)(x+1)}$
$=\frac{\mathrm{A}(\mathrm{x}-1)(\mathrm{x}+1)+\mathrm{B}(2 \mathrm{x}+1)(\mathrm{x}+1)+\mathrm{C}(2 \mathrm{x}+1)(\mathrm{x}-1)}{(2 \mathrm{x}+1)(\mathrm{x}-1)(\mathrm{x}+1)}$
$\Rightarrow x^{2}+1=A(x-1)(x+1)+B(2 x+1)(x+1)+C(2 x+1)(x-1) \ldots \ldots$ (ii)
We need to solve for $A, B$ and $C$. One way to do this is to pick values for $x$ which will cancel each variable.
Put $x=1$ in the above equation, we get
$\Rightarrow 1^{2}+1=A(1-1)(1+1)+B(2(1)+1)(1+1)+C(2(1)+1)(1-1)$
$\Rightarrow 2=0+6 B+0$
$\Rightarrow \mathrm{B}=\frac{1}{3}$
Now put $\mathrm{x}=-\frac{1}{2}$ in equation (ii), we get
$\Rightarrow\left(-\frac{1}{2}\right)^{2}+1$
$=A\left(\left(-\frac{1}{2}\right)-1\right)\left(-\frac{1}{2}+1\right)+B\left(2\left(-\frac{1}{2}\right)+1\right)\left(-\frac{1}{2}+1\right)$
$+C\left(2\left(-\frac{1}{2}\right)+1\right)\left(-\frac{1}{2}-1\right)$
$\Rightarrow \frac{5}{4}=-\frac{3}{4} \mathrm{~A}+0+0$
$\Rightarrow \mathrm{A}=-\frac{5}{3}$
Now put $x=-1$ in equation (ii), we get
$\Rightarrow(-1)^{2}+1=A(-1-1)(-1+1)+B(2(-1)+1)(-1+1)+C(2(-1)+1)(-1-1)$
$\Rightarrow 2=0+0+2 C$
$\Rightarrow C=1$
We put the values of $A, B$, and $C$ values back into our partial fractions in equation (i) and replace this as the integrand. We get
$\int\left[\frac{\mathrm{x}^{2}+1}{(2 \mathrm{x}+1)(\mathrm{x}-1)(\mathrm{x}+1)}\right] \mathrm{dx}$
$\Rightarrow \int\left[\frac{\mathrm{A}}{2 \mathrm{x}+1}+\frac{\mathrm{B}}{\mathrm{x}-1}+\frac{\mathrm{C}}{\mathrm{x}+1}\right] \mathrm{dx}$
$\Rightarrow \int\left[\frac{-\frac{5}{3}}{2 \mathrm{x}+1}+\frac{\frac{1}{3}}{\mathrm{x}-1}+\frac{1}{\mathrm{x}+1}\right] \mathrm{dx}$
Split up the integral,
$\Rightarrow-\frac{5}{3} \int\left[\frac{1}{2 x+1}\right] d x+\frac{1}{3} \int\left[\frac{1}{x-1}\right] d x+\int\left[\frac{1}{x+1}\right] d x$
Let substitute
$u=x-1 \Rightarrow d u=d x$
$y=x+1 \Rightarrow d y=d x$ and
$z=2 x+1 \Rightarrow d z=2 d x$ so the above equation becomes,
$\Rightarrow-\frac{5}{3} \int \frac{\left[\frac{1}{z}\right] d z}{2}+\frac{1}{3} \int\left[\frac{1}{u}\right] d u+\int\left[\frac{1}{y}\right] d y$
On integrating we get
$\Rightarrow-\frac{5}{6} \log |z|+\frac{1}{3} \log |u|+\log |y|+C$
Substituting back, we get
$\Rightarrow-\frac{5}{6} \log |2 x+1|+\frac{1}{3} \log |x-1|+\log |x+1|+C$
Note: the absolute value signs account for the domain of the natural log function $(x>0)$.
Hence,
$\int \frac{x^{2}+1}{(2 x+1)\left(x^{2}-1\right)} d x$
$=-\frac{5}{6} \log |2 x+1|+\frac{1}{3} \log |x-1|+\log |x+1|+C$