Evaluate the following integrals -
$\int(x+2) \sqrt{x^{2}+x+1} d x$
Let $I=\int(x+2) \sqrt{x^{2}+x+1} d x$
Let us assume $x+2=\lambda \frac{d}{d x}\left(x^{2}+x+1\right)+\mu$
$\Rightarrow x+2=\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{nx}^{\mathrm{n}-1}$ and derivative of a constant is 0 .
$\Rightarrow x+2=\lambda\left(2 x^{2-1}+1+0\right)+\mu$
$\Rightarrow x+2=\lambda(2 x+1)+\mu$
$\Rightarrow x+2=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=2$
$\Rightarrow \frac{1}{2}+\mu=2$
$\therefore \mu=\frac{3}{2}$
Hence, we have $x+2=\frac{1}{2}(2 x+1)+\frac{3}{2}$
Substituting this value in I, we can write the integral as
$I=\int\left[\frac{1}{2}(2 x+1)+\frac{3}{2}\right] \sqrt{x^{2}+x+1} d x$
$\Rightarrow \mathrm{I}=\int\left[\frac{1}{2}(2 \mathrm{x}+1) \sqrt{\mathrm{x}^{2}+\mathrm{x}+1}+\frac{3}{2} \sqrt{\mathrm{x}^{2}+\mathrm{x}+1}\right] \mathrm{dx}$
$\Rightarrow \mathrm{I}=\int \frac{1}{2}(2 \mathrm{x}+1) \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}+\int \frac{3}{2} \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}$
$\Rightarrow \mathrm{I}=\frac{1}{2} \int(2 \mathrm{x}+1) \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}+\frac{3}{2} \int \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}$
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
$\mathrm{I}_{1}=\frac{1}{2} \int \sqrt{\mathrm{t} \mathrm{dt}}$
$\Rightarrow \mathrm{I}_{1}=\frac{1}{2} \int \mathrm{t}^{\frac{1}{2}} \mathrm{dt}$
Recall $\int x^{n} d x=\frac{x^{n+1}}{n+1}+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 $\mathrm{I}_{2}=\frac{3}{2} \int \sqrt{\mathrm{x}^{2}+\mathrm{x}+1} \mathrm{dx}$
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}$