A tricky Definite Integral What is the value of $$\int_{\pi/4}^{3\pi/4}\frac{1}{1+\sin x}\operatorname{d}x\quad ?$$
The book from which I have seen this has treated it as a problem of indefinite integral and then directly put the values of the limits. I am not sure that this is the correct way.
Kindly help. 
 A: The integrand itself has no singularity at $x=\pi/2$. If there are any troubles, they arise because of the way the antiderivative is computed (for example if one multiplies by $1-\sin x$ in the numerator and denominator; this factor is zero at $x=\pi/2$).
One way of avoiding this is to set $t=\pi/2-x$ and continue as follows:
$$
\int_{\pi/4}^{3\pi/4}\frac{dx}{1+\sin x}
=
\int_{\pi/4}^{-\pi/4}\frac{-dt}{1+\cos t}
=
\int_{-\pi/4}^{\pi/4}\frac{dt}{1+(2\cos^2\frac{t}{2}-1)}
=
\left[\tan\frac{t}{2}\right]_{-\pi/4}^{\pi/4}
=
2 \tan\frac{\pi}{8}
=
2(\sqrt{2}-1)
.
$$
A: $$\frac1{1+\sin x}=\frac1{1+\sin x}\cdot\overbrace{\frac{1-\sin x}{1-\sin x}}^1=\frac{1-\sin x}{1-\sin^2x}=\frac{1-\sin x}{\cos^2x}=\frac1{\cos^2x}-\frac{\sin x}{\cos^2x}=$$
$$=\frac{\sin^2x+\cos^2x}{\cos^2x}+\frac{\cos'x}{\cos^2x}=(1+\tan^2x)-\left(\frac1{\cos x}\right)'=\tan'x-\left(\frac1{\cos x}\right)'\iff$$

$$\iff\int_\frac\pi4^\frac{3\pi}4\frac{dx}{1+\sin x}=\left[\tan x+\frac1{\cos x}\right]_\frac\pi4^\frac{3\pi}4=\left[\tan\frac{3\pi}4-\frac1{\cos\frac{3\pi}4}\right]-\left[\tan\frac\pi4-\frac1{\cos\frac\pi4}\right]=$$
$$=\left[-1-\frac1{-1/\sqrt2}\right]-\left[1-\frac1{1/\sqrt2}\right]=-2+2\sqrt2.$$
A: Any integral involving rational functions of trig functions can be evaluated using the Weierstrass substitution
  $u=\tan(x/2)$, the resulting integral is 
$$
\int_{\tan(\pi/8)}^{\tan(3\pi/8)} \frac{2\mathrm{d}u}{1+u^2+2u} = 2\int_{\sqrt{2}-1}^{\sqrt{2}+1} \frac{\mathrm{d}u}{{(1+u)^2}} 
$$
which is of course
$$
\left[-\frac{2}{1+u}\right]_{\sqrt{2}-1}^{\sqrt{2}+1} = -\frac{2}{2+\sqrt{2}} + \frac{2}{\sqrt{2}} = \frac{2\sqrt{2}}{2+\sqrt{2}} = 2\sqrt{2}-2.
$$
