# Integrating $\frac{x dx}{\sin x+\cos x}$

I am trying to carry out this integration but I seem to be going wrong:

$$I=\int_{0}^{\frac{\pi}{2}}\frac{x dx}{\sin x+\cos x}=\int_{0}^{\frac{\pi}{2}}\frac{(\frac{\pi}{2}-x) dx}{\sin(\frac{\pi}{2}-x)+\cos (\frac{\pi}{2}-x)} \implies 2I=\frac{\pi}{2}\int_{0}^{\frac{\pi}{2}}\frac{ dx}{\sin x+\cos x}$$

I am not able to proceed from here.

-
To evaluate $\int_{0}^{\frac{\pi}{2}}\frac{ dx}{\sin x+\cos x}$, I think you can use the substitution $t=\tan(\frac{x}{2})$. –  Paul Oct 25 '12 at 7:44
$$\dfrac1{\sin(x) + \cos(x)} = \dfrac1{\sqrt{2}} \left(\dfrac1{\dfrac1{\sqrt{2}}\sin(x) + \dfrac1{\sqrt{2}}\cos(x)} \right) = \dfrac1{\sqrt{2}} \sec(x - \pi/4)$$ Now integrate, $$\int_0^{\pi/2} \dfrac{dx}{\sin(x) + \cos(x)} = \dfrac1{\sqrt{2}}\int_0^{\pi/2} \sec(x-\pi/4)dx = \dfrac1{\sqrt{2}}\int_{-\pi/4}^{\pi/4} \sec(x)dx$$ and finish it off.