Evaluate the following integral:
$\int \frac{1}{x\left(x^{n}+1\right)} d x$
$\frac{1}{x\left(x^{n}+1\right)}$
Multiply numerator and denominator by $x^{n-1}$, we get
$\int \frac{1}{x\left(x^{n}+1\right)} d x \Rightarrow \int \frac{x^{n-1}}{x\left(x^{n}+1\right) x^{n-1}} d x \Rightarrow \int \frac{x^{n-1}}{x^{n}\left(x^{n}+1\right)} d x$
Let $x^{n}=t \Rightarrow n x^{n-1} d x=d t$
So the above equation becomes,
$\int \frac{\mathrm{x}^{\mathrm{n}-1}}{\mathrm{x}^{\mathrm{n}}\left(\mathrm{x}^{\mathrm{n}}+1\right)} \mathrm{dx} \Rightarrow \frac{1}{\mathrm{n}} \int \frac{1}{\mathrm{t}(\mathrm{t}+1)} \mathrm{dt}$
The denominator is factorized, so let separate the fraction through partial fraction, hence let
$\frac{1}{t(t+1)}=\frac{A}{t}+\frac{B}{t+1} \ldots \ldots(i)$
$\Rightarrow \frac{1}{t(t+1)}=\frac{A(t+1)+B t}{t(t+1)}$
$\Rightarrow 1=\mathrm{A}(\mathrm{t}+1)+\mathrm{Bt} \ldots \ldots$ (ii)
Put $t=0$ in above equations we get
$1=A(0+1)+B(0)$
$\Rightarrow A=1$
Now put $t=-1$ in equation (ii) we get
$1=A(-1+1)+B(-1)$
$\Rightarrow B=-1$
We put the values of $A$ and $B$ values back into our partial fractions in equation (i) and replace this as the integrand. We get
$\int \frac{\mathrm{x}^{\mathrm{n}-1}}{\mathrm{x}^{\mathrm{n}}\left(\mathrm{x}^{\mathrm{n}}+1\right)} \mathrm{dx} \Rightarrow \frac{1}{\mathrm{n}} \int \frac{1}{\mathrm{t}(\mathrm{t}+1)} \mathrm{dt}$
$\Rightarrow \frac{1}{n} \int\left[\frac{A}{t}+\frac{B}{t+1}\right] d t$
$\Rightarrow \frac{1}{n} \int\left[\frac{1}{t}+\frac{-1}{t+1}\right] d t$
Split up the integral,
$\Rightarrow \frac{1}{n}\left[\int \frac{1}{t} d t-\int \frac{1}{t+1} d t\right]$
Let substitute
$\mathrm{u}=\mathrm{t}+1 \Rightarrow \mathrm{du}=\mathrm{dt}$, so the above equation becomes,
$\Rightarrow \frac{1}{\mathrm{n}}\left[\int \frac{1}{\mathrm{t}} \mathrm{dt}-\int \frac{1}{\mathrm{u}} \mathrm{du}\right]$
Substituting back the values of $u$, we get
$\Rightarrow \frac{1}{\mathrm{n}}[\log |\mathrm{t}|-\log (|\mathrm{t}+1|)]+\mathrm{C}$
Substituting back the values of $t$, we get
$\Rightarrow \frac{1}{n}\left[\log \left|x^{n}\right|-\log \left|x^{n}+1\right|\right]+C$
Applying the logarithm rules, we get
$\Rightarrow \frac{1}{n}\left[\log \left|\frac{x^{n}}{x^{n}+1}\right|\right]+C$
Note: the absolute value signs account for the domain of the natural log function $(x>0)$.
Hence,
$\int \frac{1}{x\left(x^{n}+1\right)} d x=\frac{1}{n}\left[\log \left|\frac{x^{n}}{x^{n}+1}\right|\right]+C$