Evaluate the following integral:
Question:

Evaluate the following integral:

$\int \frac{x+1}{x\left(1+x e^{x}\right)} d x$

Solution:

Let, $\mathrm{I}=\int \frac{\mathrm{x}+1}{\mathrm{x}\left(1+\mathrm{xe}^{\mathrm{x}}\right)} \mathrm{dx}$

$\Rightarrow \quad I=\int \frac{(x+1)\left(1+x e^{x}-x e^{x}\right)}{x\left(1+x e^{x}\right)} d x$

$\Rightarrow, \quad I=\int \frac{(x+1)\left(1+x e^{x}\right)}{x\left(1+x e^{x}\right)} d x-\int \frac{(x+1)\left(x e^{x}\right)}{x\left(1+x e^{x}\right)} d x$

$\Rightarrow, \quad \mathrm{I}=\int \frac{(\mathrm{x}+1)}{\mathrm{x}} \mathrm{dx}-\int \frac{(\mathrm{x}+1)\left(\mathrm{e}^{\mathrm{x}}\right)}{\left(1+\mathrm{xe}^{\mathrm{x}}\right)} \mathrm{dx}$

$\Rightarrow \quad I=\log \left|x e^{x}\right|-\log \left|1+x e^{x}\right|+c$

$\Rightarrow \quad I=\log \left|\frac{x e^{x}}{1+x e^{x}}\right|+c$

Hence, $\int \frac{\mathrm{x}+1}{\mathrm{x}\left(1+\mathrm{xe}^{\mathrm{x}}\right)} \mathrm{dx}=\log \left|\frac{\mathrm{xe}^{\mathrm{x}}}{1+\mathrm{xe}^{\mathrm{x}}}\right|+\mathrm{c}$