Cannot find $\displaystyle \int_0^{\frac{\pi}{6}} \frac{1}{\sin x-\cos x} \, dx$ I am asked to find:
$$\int_0^{\frac{\pi}{6}} \frac{1}{\sin x-\cos x} \, dx$$
I have tried:
$$A=\int_0^{\frac{\pi}{6}} \frac{\sin x+\cos x}{\sin^2 x-\cos^2 x} \, dx$$
$$A=\int_0^{\frac{\pi}{6}} \frac{\sin x}{2\sin^2 x-1} \, dx + \int_0^{\frac{\pi}{6}} \frac{\cos x}{1-2\cos^2 x} \, dx$$
$$u=\sin x$$
$$du=\cos x\,dx$$
$$v=\cos x$$
$$dv=-\sin x \,dx$$
$$A=\int_0^{\frac{\pi}{6}} \frac{du}{2u^2-1} \, dx + \int_0^{\frac{\pi}{6}} \frac{dv}{2v^2-1} \, dx$$
But I am unable to move forward.
 A: If nothing else works, there's always the "universal trig substitution" $t=\tan\frac{x}{2}$, because then, due to trig identities, $\sin x=\frac{2t}{1+t^2}$, $\cos x=\frac{1-t^2}{1+t^2}$, and (just in case) $\tan x=\frac{2t}{1-t^2}$. That will take you to the realm of integrating rational functions, for which there's a standard (albeit lengthy) algorithm.
A: HINT:
$$\sin(x)-\cos(x)=\sqrt 2 \sin(x-\pi/4)$$
and integrate the cosecant function.
If you wish to proceed as in the OP, then we have
$$\begin{align}
\int_0^{\pi/6}\frac{1}{\sin(x)-\cos(x)}\,dx&=\int_0^{\pi/6}\frac{\sin(x)+\cos(x)}{\sin^2(x)-\cos^2(x)}\,dx\\\\
&=\int_1^{\sqrt 3/2}\frac{1}{2u^2-1}\,du+\int_0^{1/2}\frac{1}{2v^2-1}\,du\\\\
&=\frac12 \int_1^{\sqrt 3/2}\left(\frac{1}{\sqrt 2 u-1}-\frac{1}{\sqrt 2 u+1}\right)\,du+\frac12 \int_0^{1/2}\left(\frac{1}{\sqrt 2 v-1}-\frac{1}{\sqrt 2 v+1}\right)\,dv\\\\\
\end{align}$$
Can you finish now?
A: \begin{align}
& \int_0^{\pi/6} \frac{\sin x}{2\sin^2 x-1} \, dx = \int_0^{\pi/6} \frac{\sin x}{1 - 2\cos^2 x} \, dx & & \text{since }\sin^2 x = 1-\cos^2 x \\[15pt]
= {} & \int_1^{\sqrt 3/2} \frac{-dw}{1-2w^2} = \int_1^{\sqrt 3/2} \frac{-dw}{\left( 1 - w\sqrt 2\right)\left( 1 + w\sqrt2\right)} & & \text{and then use partial fractions.}
\end{align}
