Evaluate the following integral:
$\int \frac{x}{\left(x^{2}+1\right)(x-1)} d x$
Denominator is factorized, so let separate the fraction through partial fraction, hence let
$\frac{\mathrm{x}}{\left(\mathrm{x}^{2}+1\right)(\mathrm{x}-1)}=\frac{\mathrm{Ax}+\mathrm{B}}{\left(\mathrm{x}^{2}+1\right)}+\frac{\mathrm{Cx}+\mathrm{D}}{\mathrm{x}-1} \ldots \ldots$ (i)
$\Rightarrow \frac{\mathrm{x}}{\left(\mathrm{x}^{2}+1\right)(\mathrm{x}-1)}=\frac{(\mathrm{Ax}+\mathrm{B})(\mathrm{x}-1)+(\mathrm{Cx}+\mathrm{D})\left(\mathrm{x}^{2}+1\right)}{\left(\mathrm{x}^{2}+1\right)(\mathrm{x}-1)}$
$\Rightarrow x=(A x+B)(x-1)+(C x+D)\left(x^{2}+1\right)$
$\Rightarrow x=A x^{2}-A x+B x-B+C x^{2}+C x+D x^{2}+D$
$\Rightarrow x=(C) x^{2}+(A+D) x^{2}+(B-A+C) x+(D-B) \ldots \ldots(i i)$
By equating similar terms, we get
$C=0$............(iii)
$A+D=0 \Rightarrow A=-D$ .....(iv)
$B-A+C=1$
$\Rightarrow B-(-D)+0=2($ from equation(iii) and (iv))
$\Rightarrow B=2-D \ldots \ldots \ldots .(v)$
$D-B=0 \Rightarrow D-(2-D)=0 \Rightarrow 2 D=2 \Rightarrow D=1$
So equation(iv) becomes $A=-1$
So equation (v) becomes, $B=2-1=1$
We put the values of A, B, C, and D values back into our partial fractions in equation (i) and replace this as the integrand. We get
$\int\left[\frac{x}{\left(x^{2}+1\right)(x-1)}\right] d x$
$\Rightarrow \int \frac{\mathrm{Ax}+\mathrm{B}}{\left(\mathrm{x}^{2}+1\right)}+\frac{\mathrm{Cx}+\mathrm{D}}{\mathrm{x}-1} \mathrm{dx}$
$\Rightarrow \int\left[\frac{(-1) \mathrm{x}+1}{\left(\mathrm{x}^{2}+1\right)}+\frac{(0) \mathrm{x}+1}{\mathrm{x}-1}\right] \mathrm{dx}$
Split up the integral,
$\Rightarrow \int \frac{1}{\left(x^{2}+1\right)} d x-\int \frac{x}{\left(x^{2}+1\right)} d x+\int\left[\frac{1}{x-1}\right] d x$
Let substitute
$u=x^{2}+1 \Rightarrow d u=2 x d x \Rightarrow x d x=\frac{1}{2} d u$
$\mathrm{v}=\mathrm{x}-1 \Rightarrow \mathrm{dv}=\mathrm{dx}$
so the above equation becomes,
$\Rightarrow \int \frac{1}{\left(x^{2}+1\right)} d x-\frac{1}{2} \int \frac{1}{(u)} d u+\int\left[\frac{1}{v}\right] d v$
On integrating we get
$\Rightarrow \tan ^{-1} \mathrm{x}-\frac{1}{2} \log |\mathrm{u}|+\log |\mathrm{v}|+\mathrm{C}$
(the standard integral of $\frac{1}{\mathrm{x}^{2}+1}=\tan ^{-1} \mathrm{x}$ )
Substituting back, we get
$\Rightarrow \tan ^{-1} x-\frac{1}{2} \log \left|x^{2}+1\right|+\log |x-1|+C$
Note: the absolute value signs account for the domain of the natural $\log$ function $(x>0)$.
Hence,
$\int \frac{x}{\left(x^{2}+1\right)(x-1)} d x=\tan ^{-1} x-\frac{1}{2} \log \left|x^{2}+1\right|+\log |x-1|+C$