Evaluate the following integrals -
$\int(x+1) \sqrt{x^{2}+x+1} d x$
Let $I=\int(x+1) \sqrt{x^{2}+x+1} d x$
Let us assume $x+1=\lambda \frac{d}{d x}\left(x^{2}+x+1\right)+\mu$
$\Rightarrow x+1=\lambda\left[\frac{d}{d x}\left(x^{2}\right)+\frac{d}{d x}(x)+\frac{d}{d x}(1)\right]+\mu$
We know $\frac{\mathrm{d}}{\mathrm{dx}}\left(\mathrm{x}^{\mathrm{n}}\right)=\mathrm{n} \mathrm{x}^{\mathrm{n}-1}$ and derivative of a constant is 0 .
$\Rightarrow x+1=\lambda\left(2 x^{2-1}+1+0\right)+\mu$
$\Rightarrow x+1=\lambda(2 x+1)+\mu$
$\Rightarrow x+1=2 \lambda x+\lambda+\mu$
Comparing the coefficient of $x$ on both sides, we get
$2 \lambda=1 \Rightarrow \lambda=\frac{1}{2}$
Comparing the constant on both sides, we get
$\lambda+\mu=1$
$\Rightarrow \frac{1}{2}+\mu=1$
$\therefore \mu=\frac{1}{2}$
Hence, we have $x+1=\frac{1}{2}(2 x+1)+\frac{1}{2}$
Substituting this value in I, we can write the integral as
$I=\int\left[\frac{1}{2}(2 x+1)+\frac{1}{2}\right] \sqrt{x^{2}+x+1} d x$
$\Rightarrow I=\int\left[\frac{1}{2}(2 x+1) \sqrt{x^{2}+x+1}+\frac{1}{2} \sqrt{x^{2}+x+1}\right] d x$
$\Rightarrow I=\int \frac{1}{2}(2 x+1) \sqrt{x^{2}+x+1} d x+\int \frac{1}{2} \sqrt{x^{2}+x+1} d x$
$\Rightarrow I=\frac{1}{2} \int(2 x+1) \sqrt{x^{2}+x+1} d x+\frac{1}{2} \int \sqrt{x^{2}+x+1} d x$
Let $\mathrm{I}_{1}=\frac{1}{2} \int(2 \mathrm{x}+1) \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}$
Now, put $x^{2}+x+1=t$
$\Rightarrow(2 x+1) d x=d t$ (Differentiating both sides)
Substituting this value in $\mathrm{I}_{1}$, we can write
$I_{1}=\frac{1}{2} \int \sqrt{t} d t$
$\Rightarrow I_{1}=\frac{1}{2} \int t^{\frac{1}{2}} d t$
Recall $\int \mathrm{x}^{\mathrm{n}} \mathrm{dx}=\frac{\mathrm{x}^{\mathrm{n}+1}}{\mathrm{n}+1}+\mathrm{c}$
$\Rightarrow \mathrm{I}_{1}=\frac{1}{2}\left(\frac{\mathrm{t}^{\frac{1}{2}+1}}{\frac{1}{2}+1}\right)+\mathrm{c}$
$\Rightarrow \mathrm{I}_{1}=\frac{1}{2}\left(\frac{\mathrm{t}^{\frac{3}{2}}}{\frac{3}{2}}\right)+\mathrm{c}$
$\Rightarrow \mathrm{I}_{1}=\frac{1}{2} \times \frac{2}{3} \mathrm{t}^{\frac{3}{2}}+\mathrm{c}$
$\Rightarrow \mathrm{I}_{1}=\frac{1}{3} \mathrm{t}^{\frac{3}{2}}+\mathrm{c}$
$\therefore \mathrm{I}_{1}=\frac{1}{3}\left(\mathrm{x}^{2}+\mathrm{x}+1\right)^{\frac{3}{2}}+\mathrm{c}$
Let $I_{2}=\frac{1}{2} \int \sqrt{x^{2}+x+1} d x$
We can write $x^{2}+x+1=x^{2}+2(x)\left(\frac{1}{2}\right)+\left(\frac{1}{2}\right)^{2}-\left(\frac{1}{2}\right)^{2}+1$
$\Rightarrow x^{2}+x+1=\left(x+\frac{1}{2}\right)^{2}-\frac{1}{4}+1$
$\Rightarrow x^{2}+x+1=\left(x+\frac{1}{2}\right)^{2}+\frac{3}{4}$
$\Rightarrow x^{2}+x+1=\left(x+\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}$
Hence, we can write $I_{2}$ as
$I_{2}=\frac{1}{2} \int \sqrt{\left(x+\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}} d x$
Recall $\int \sqrt{x^{2}+a^{2}} d x=\frac{x}{2} \sqrt{x^{2}+a^{2}}+\frac{a^{2}}{2} \ln \left|x+\sqrt{x^{2}+a^{2}}\right|+c$
$\Rightarrow I_{2}=\frac{1}{2}\left[\frac{\left(x+\frac{1}{2}\right)}{2} \sqrt{\left(x+\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}}\right.$
$\left.+\frac{\left(\frac{\sqrt{3}}{2}\right)^{2}}{2} \ln \left|\left(x+\frac{1}{2}\right)+\sqrt{\left(x+\frac{1}{2}\right)^{2}+\left(\frac{\sqrt{3}}{2}\right)^{2}}\right|\right]+c$
$\Rightarrow I_{2}=\frac{1}{2}\left[\frac{2 x+1}{4} \sqrt{x^{2}+x+1}+\frac{3}{8} \ln \left|x+\frac{1}{2}+\sqrt{x^{2}+x+1}\right|\right]+c$
$\therefore \mathrm{I}_{2}=\frac{1}{8}(2 \mathrm{x}+1) \sqrt{\mathrm{x}^{2}+\mathrm{x}+1}+\frac{3}{16} \ln \left|\mathrm{x}+\frac{1}{2}+\sqrt{\mathrm{x}^{2}+\mathrm{x}+1}\right|+\mathrm{c}$
Substituting $I_{1}$ and $I_{2}$ in $I$, we get
$I=\frac{1}{3}\left(x^{2}+x+1\right)^{\frac{3}{2}}+\frac{1}{8}(2 x+1) \sqrt{x^{2}+x+1}+\frac{3}{16} \ln \left|x+\frac{1}{2}+\sqrt{x^{2}+x+1}\right|+c$
Thus, $\int(x+1) \sqrt{x^{2}+x+1} d x=\frac{1}{3}\left(x^{2}+x+1\right)^{\frac{2}{2}}+\frac{1}{8}(2 x+1) \sqrt{x^{2}+x+1}+$
$\frac{3}{16} \ln \left|x+\frac{1}{2}+\sqrt{x^{2}+x+1}\right|+c$