<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] $\bf{My\; Solution::}$ Let $\displaystyle I = \int\frac{1}{1+\sin x}dx = \int\frac{1}{1+\cos \left(\frac{\pi}{2}-x\right)}dx = \int\frac{1}{2\cos^2 \left(\frac{\pi}{4}-\frac{x}{2}\right)}dx$
So $\displaystyle I = \frac{1}{2}\int \sec^2 \left(\frac{\pi}{4}-\frac{x}{2}\right)dx = -\frac{1}{2}\tan \left(\frac{\pi}{4}-\frac{x}{2}\right)+\mathbf{C} = -\frac{1}{2}\cdot \left(\frac{1-\tan \frac{x}{2}}{1+\tan \frac{x}{2}}\right)+\mathbb{C}$
So $\displaystyle I = \int\frac{1}{1+\sin x} = \frac{1}{2}\left(\frac{\tan \frac{x}{2}-1}{1+\tan \frac{x}{2}}\right)+\mathbb{C} = \left(\frac{-2}{1+\tan \frac{x}{2}}\right)+1+\mathbb{C}$
</s>