How to evaluate the integral $\int \sqrt{1+\sin(x)} dx$

$$(1+\sin x)=\left(\cos\dfrac x2+\sin\dfrac x2\right)^2$$

$$\implies\sqrt{1+\sin x}=\left|\cos\dfrac x2+\sin\dfrac x2\right|$$


In the first quadrant,

$$\sqrt{1+\sin x}=\sqrt\frac{1-\sin^2x}{1-\sin x}=\pm\frac{\sin'x}{\sqrt{1-\sin x}}$$ which you can integrate mentally, giving $\mp2\sqrt{1-\sin x}$.


\since, $$1=\sin^2\left(\frac{x}{2}\right)+\cos^2\left(\frac{x}{2}\right)$$
$$\sin (x)=2\sin\left(\frac{x}{2}\right)\cos\left(\frac{x}{2}\right)$$ Therefore, we can put the above values of $1$ and $\sin (x)$ in the question.
Now, we have. $$\int \sqrt{\sin^2\left(\frac{x}{2}\right)+ \cos^2\left(\frac{x}{2}\right)+2\sin\left(\frac{x}{2}\right) \cos\left(\frac{x}{2}\right)} \,dx$$
And,$$\sin^2\left(\frac{x}{2}\right)+\cos^2\left(\frac{x}{2}\right)+2\sin\left(\frac{x}{2}\right)\cos\left(\frac{x}{2}\right)=\left(\sin\left(\frac{x}{2}\right)+\cos\left(\frac{x}{2}\right)\right)^2$$ By putting the above value, we get
$$\int\sqrt{\left(\sin\left(\frac{x}{2}\right)+ \cos\left(\frac{x}{2}\right)\right)^2}\, dx$$
$$=\int \sin\left(\frac{x}{2}\right)+\cos\left(\frac{x}{2}\right)\,\,dx$$ $$=-2\cos\left(\frac{x}{2}\right)+2\sin\left(\frac{x}{2}\right)+C$$