<s>[INST] Integration of $1/(1+\sin x)$ I solved it using $t=\tan(\frac{x}{2})$ substitution and got $-2/(1+\tan(x/2))+C$, but in my math book solution is $\tan(x/2-\pi/4)+C$. Are those the same expressions and if they are, how do I transform from one to another, or are one(or both) solutions incorrect ? 
 [/INST] Here is the integral with the Weierstrass substitution:
$$
\begin{align}
\int\frac{\mathrm{d}x}{1+\sin(x)}
&=\int\frac1{1+\frac{2z}{1+z^2}}\frac{2\,\mathrm{d}z}{1+z^2}\\
&=\int\frac{2\,\mathrm{d}z}{1+2z+z^2}\\
&=\frac{-2}{1+z}+C\\
&=\frac{-2}{1+\tan(x/2)}+C
\end{align}
$$
so your answer is correct. Now consider
$$
\begin{align}
\tan(x/2-\pi/4)
&=\frac{\tan(x/2)-1}{1+\tan(x/2)}\\
&=\frac{-2}{1+\tan(x/2)}+1
\end{align}
$$

Here is another approach, without Weierstrass substitution:
$$
\begin{align}
\int\frac{\mathrm{d}x}{1+\sin(x)}
&=\int\frac{1-\sin(x)}{1-\sin^2(x)}\mathrm{d}x\\
&=\int\frac{\mathrm{d}x}{\cos^2(x)}+\int\frac{\mathrm{d}\cos(x)}{\cos^2(x)}\\[4pt]
&=\tan(x)-\sec(x)+C
\end{align}
$$
and again
$$
\begin{align}
\tan(x)-\sec(x)
&=\frac{\sin(x)-1}{\cos(x)}\\
&=\frac{\frac{2\tan(x/2)}{1+\tan^2(x/2)}-1}{\frac{1-\tan^2(x/2)}{1+\tan^2(x/2)}}\\
&=\frac{-1+2\tan(x/2)-\tan^2(x/2)}{1-\tan^2(x/2)}\\
&=\frac{\tan(x/2)-1}{1+\tan(x/2)}\\
&=\frac{-2}{1+\tan(x/2)}+1
\end{align}
$$
</s>