Solve $ \int\frac{1}{\sin(x)-\cos(2x)}dx $ ... Weierstrass substitution :
$$\tan(\frac{x}{2})=t$$ $$\sin(x)=(\frac{2t}{1+t^2})$$ $$\cos(x)=(\frac{1-t^2}{1+t^2})$$ $$dx=(\frac{2\,dt}{1+t^2})$$
Than : $$\cos(2x)=\cos^2(x)-\sin^2(x)$$
P.s I tried using these substitutions, but I couldn't get so far .
Need a bit help to solve this problem, if it's possible by using these substitutions.
Thank you in advance :)
 A: Since $\cos2x=2\cos^2x-1=\frac{1-6t^2+t^4}{(1+t^2)^2}$, $\sin x-\cos 2x=\frac{-1+2t+6t^2+2t^3-t^4}{(1+t^2)^2}$, so your integral is$$\int\frac{2(1+t^2)}{-1+2t+6t^2+2t^3-t^4}dt.$$Sincce $-1+2t+6t^2+2t^3-t^4=-(t^2-4t+1)(t+1)^2$ (the repeated root is easily guessed with the rational root theorem), we seek a partial fraction decomposition:$$\begin{align}\frac{-2(1+t^2)}{(t^2-4t+1)(t+1)^2}&=\frac{At+B}{t^2-4t+1}+\frac{Ct+D}{t^2-4t+1},\\-2(1+t^2)&=(At+B)(t+1)^2+(Ct+D)(t^2-4t+1)\\&=(A+C)t^3+(2A+B-4C+D)t^2\\&+(A+2B+C-4D)t+B+D.\end{align}$$Since $A+C=0,\,2A+B-4C+D=-2,\,A+2B+C-4D=0,\,B+D=-2$, the solution is$$\int\frac{-2(1+t^2)dt}{(t^2-4t+1)(t+1)^2}=\int\left(\frac{-4/3}{t^2-4t+1}+\frac{-2/3}{(t+1)^2}\right)dt,$$which you can finish.
A: Hint
$$\sin x-\cos2x=2s^2+s-1=(s+1)(2s-1)$$ where $s=\sin x$
Now use https://mathworld.wolfram.com/PartialFractionDecomposition.html for $$\dfrac1{2s^2+s-1}=\dfrac a{s+1}+\dfrac b{2s-1}$$
Now $1+\sin x=1+\cos(\pi/2-x)=\dfrac2{\sec^2(\pi/4-x/2)}$
For the other integral, use https://en.m.wikipedia.org/wiki/Weierstrass_substitution#The_substitution
A: hint
$$\sin(x)-\cos(2x)=$$
$$\sin(x)-1+2\sin^2(x)=$$
$$(\sin(x)+1)(2\sin(x)-1)$$
and
$$\frac{1}{\sin(x)-\cos(2x)}=$$
$$\frac 13\Bigl(\frac{-1}{\sin(x)+1}+\frac{2}{2\sin(x)-1}\Bigr)$$
A: It is better to have the half-angle substitution after the partial decomposition and on $t= \frac\pi2 -x $ instead, as seen below
\begin{align}
 \int\frac{1}{\sin x-\cos 2x}dx
 & =-\int \frac{1}{\cos t+2\cos^2t -1}dt\\
& =\int \frac{1}{(1-2\cos t)(1+\cos t )}dt\\
&= \frac13 \int \left(\frac1{1+\cos t}+ \frac1{\frac12- \cos t}\right)dt\\
&= \frac13 \int \left(\frac12\sec^2\frac t2 -\frac{\frac23 \sec^2\frac t2}{\frac13-\tan^2\frac t2}\right)dt\\
&= \frac13 \tan\frac t2 -\frac4{3\sqrt3} \tanh^{-1}(\sqrt3\tan \frac t2)+C
\end{align}
