# Cannot find $\displaystyle \int_0^{\frac{\pi}{6}} \frac{1}{\sin x-\cos x} \, dx$

$$\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.

• "Dr. MV" 's answer is perhaps the quickest way to reduce this to known integrals. Notice the trigonometric identity: $$A\cos x + B\sin x = \sqrt{A^2+B^2}\Big( \frac A{\sqrt{A^2+B^2}} \cos x + \frac B{\sqrt{A^2+B^2}} \sin x \Big)$$ $$= \sqrt{A^2+B^2} \Big( \sin\varphi\cos x + \cos\varphi\sin x \Big) = \sqrt{A^2+B^2} \sin(x+\varphi).$$ – Michael Hardy Mar 8 '16 at 19:41
• $\ldots\,$ However, "Dr. MV" 's way is not the only way. I've posted a different one that starts where you leave off; see below. $\qquad$ – Michael Hardy Mar 8 '16 at 19:47
• @MichaelHardy Michael, I actually covered the partial fraction expansion approach too. ;-)) - Mark – Mark Viola Mar 8 '16 at 19:49

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?

• There is also a typo in your first identity. – Nicolas Mar 8 '16 at 19:45
• @Nicolas Yep. Edited! Much appreciative. - Mark – Mark Viola Mar 8 '16 at 19:47
• I found $$\frac{\ln{\tan{\frac{\frac{\pi}{6}-\frac{\pi}{4}}{2}}}}{\sqrt{2}} + C$$ Is that right? – Marcel Mar 8 '16 at 19:56
• That should be $$\frac{\ln{\tan{\frac{x-\frac{\pi}{4}}{2}}}}{\sqrt{2}} + C$$ – Marcel Mar 8 '16 at 20:08

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.

\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}