Evaluating $\int\sqrt{1+\sin x}dx$. The integral is:$$\int\sqrt{1+\sin x} dx$$
My first attempt was to multiply by: 
$$\frac{\sqrt{1-\sin x}}{\sqrt{1-\sin x}}$$
giving:
$$\int\frac{\sqrt{1-\sin^2(x)}}{\sqrt{1-\sin x}}dx$$
which is:
$$\int\frac{\cos x}{\sqrt{1-\sin x}}dx$$
then make the substitution:
$$u=1-\sin x$$
which gives
$$\int\frac{-1}{\sqrt{u}}du$$
which gives:
$$-2\sqrt{u}+c$$
so:
$$I=-2\sqrt{1-\sin x}+c$$
but I am not sure if this is correct.
Also sorry if the formatting is a bit rubbish
 A: $$I = \int \sqrt{1+\sin x}dx$$
Apply substitution $ u=\tan \left(\frac{x}{2}\right)$ 
(Tangent half-angle substitution)
$$\int \frac{2\sqrt{\left(u+1\right)^2}}{\left(1+u^2\right)\sqrt{u^2+1}}du$$
$$2\int \frac{u+1}{\left(1+u^2\right)\sqrt{u^2+1}}du$$
$$2\left(\underbrace{\int \frac{u}{\left(1+u^2\right)\sqrt{u^2+1}}du}_{I_1}+\underbrace{\int \frac{1}{\left(1+u^2\right)\sqrt{u^2+1}}du}_{I_2}\right)$$
Set $v=1+u^2$
$$I_1 = \int \frac{1}{2v\sqrt{v}}dv = \frac{1}{2}\int v^{-\frac{3}{2}}dv =\frac{1}{2}\frac{v^{\left(-\frac{3}{2}+1\right)}}{\left(-\frac{3}{2}+1\right)} =-\frac{1}{\sqrt{v}}=  -\frac{1}{\sqrt{1+u^2}}$$

By Trigonometric substitution $u=\tan \left(v\right)$
$$I_2 = \int \frac{1}{\left(u^2+1\right)^{\frac{3}{2}}}du= \int \frac{\sec ^2\left(v\right)}{\left(\tan ^2\left(v\right)+1\right)^{\frac{3}{2}}}dv = \int \frac{\sec ^2\left(v\right)}{\sec ^3\left(v\right)}dv =\int \frac{1}{\sec \left(v\right)}dv =\int \cos \left(v\right)dv =\sin \left(v\right) +C$$
$$I_2 = \sin \left(v\right) = \sin \left(\arctan \left(u\right)\right) = \frac{u}{\sqrt{1+u^2}}$$
So
$$ I = 2\left(-\frac{1}{\sqrt{1+u^2}}+\frac{u}{\sqrt{1+u^2}}\right) +C$$

$$I = 2\left(-\frac{1}{\sqrt{1+\tan ^2\left(\frac{x}{2}\right)}}+\frac{\tan \left(\frac{x}{2}\right)}{\sqrt{1+\tan ^2\left(\frac{x}{2}\right)}}\right) +C$$

