Evaluate the following integral:
$\int \frac{2 x}{\left(x^{2}+1\right)\left(x^{2}+3\right)} d x$
Denominator is factorized, so let separate the fraction through partial fraction, hence let
$\frac{2 x}{\left(x^{2}+1\right)\left(x^{2}+3\right)}=\frac{A x+B}{\left(x^{2}+1\right)}+\frac{C x+D}{x^{2}+3} \ldots \ldots$ (i)
$\Rightarrow \frac{2 x}{\left(x^{2}+1\right)\left(x^{2}+3\right)}=\frac{(A x+B)\left(x^{2}+3\right)+(C x+D)\left(x^{2}+1\right)}{\left(x^{2}+1\right)\left(x^{2}+3\right)}$
$\Rightarrow 2 \mathrm{x}=(\mathrm{Ax}+\mathrm{B})\left(\mathrm{x}^{2}+3\right)+(\mathrm{Cx}+\mathrm{D})\left(\mathrm{x}^{2}+1\right)$
$\Rightarrow 2 \mathrm{x}=\mathrm{Ax}^{3}+3 \mathrm{Ax}+\mathrm{Bx}^{2}+3 \mathrm{~B}+\mathrm{Cx}^{3}+\mathrm{Cx}+\mathrm{Dx}^{2}+\mathrm{D}$
$\Rightarrow 2 \mathrm{x}=(\mathrm{A}+\mathrm{C}) \mathrm{x}^{3}+(\mathrm{B}+\mathrm{D}) \mathrm{x}^{2}+(3 \mathrm{~A}+\mathrm{C}) \mathrm{x}+(3 \mathrm{~B}+\mathrm{D})$ .......(ii)
By equating similar terms, we get
$A+C=0 \Rightarrow A=-C \ldots \ldots \ldots \ldots$ (iii)
$B+D=0 \Rightarrow B=-D \ldots \ldots \ldots \ldots$ (iv)
$3 \mathrm{~A}+\mathrm{C}=2$
$\Rightarrow 3(-C)+C=2$ (from equation(iii))
$\Rightarrow C=-1$
So equation(iii) becomes $A=1$
And also $3 B+D=0$ (from equation (ii))
$\Rightarrow 3(-D)+D=0($ from equation (iv))
$\Rightarrow D=0$
So equation (iv) becomes, $B=0$
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{2 \mathrm{x}}{\left(\mathrm{x}^{2}+1\right)\left(\mathrm{x}^{2}+3\right)}\right] \mathrm{dx}$
$\Rightarrow \int\left[\frac{\mathrm{Ax}+\mathrm{B}}{\left(\mathrm{x}^{2}+1\right)}+\frac{\mathrm{Cx}+\mathrm{D}}{\mathrm{x}^{2}+3}\right] \mathrm{dx}$
$\Rightarrow \int\left[\frac{(1) \mathrm{x}+0}{\left(\mathrm{x}^{2}+1\right)}+\frac{(-1) \mathrm{x}+0}{\mathrm{x}^{2}+3}\right] \mathrm{dx}$
Split up the integral,
$\Rightarrow \int \frac{\mathrm{x}}{\left(\mathrm{x}^{2}+1\right)} \mathrm{dx}-\int\left[\frac{\mathrm{x}}{\mathrm{x}^{2}+3}\right] \mathrm{dx}$
Let substitute
$u=x^{2}+1 \Rightarrow d u=2 x d x \Rightarrow d x=\frac{1}{2 x} d u$
$v=x^{2}+3 \Rightarrow d v=2 x d x \Rightarrow d x=\frac{1}{2 x} d v$
so the above equation becomes,
$\Rightarrow \frac{1}{2} \int \frac{1}{(u)} d u-\frac{1}{2} \int\left[\frac{1}{v}\right] d v$
On integrating we get
$\Rightarrow \frac{1}{2} \log |\mathrm{u}|-\frac{1}{2} \log |\mathrm{v}|+\mathrm{C}$
Substituting back, we get
$\Rightarrow \frac{1}{2} \log \left|\mathrm{x}^{2}+1\right|-\frac{1}{2} \log \left|\mathrm{x}^{2}+3\right|+\mathrm{C}$
$\Rightarrow \frac{1}{2}\left[\log \left|\mathrm{x}^{2}+1\right|-\log \left|\mathrm{x}^{2}+3\right|\right]+\mathrm{C}$
Applying the logarithm rule we get
$\Rightarrow \frac{1}{2}\left[\log \left|\frac{\left(x^{2}+1\right)}{x^{2}+3}\right|\right]+C$
Note: the absolute value signs account for the domain of the natural log function $(x>0)$.
Hence,
$\int \frac{2 x}{\left(x^{2}+1\right)\left(x^{2}+3\right)} d x=\frac{1}{2}\left[\log \left|\frac{\left(x^{2}+1\right)}{x^{2}+3}\right|\right]+C$