<s>[INST] Trignometric integral : $\int \frac{dx}{\sin x + \sec x}$ The integral I am trying to compute is : 
$$\int \dfrac{dx}{\sin x + \sec x}$$
I have tried manipulating trignometric functions and it took me nowhere. Then finally I tried putting $\tan\dfrac{x}{2} = t$, and subsequently:
$$=\int\dfrac{1-t^2}{(1+t^2)^2-2t(t^2-1)}dt$$
I cannot see how to approach after this, I know we have to factor out two quadratics, but cant see how to.
Also, if there was another method instead of this substitution, please hint on that too! Thanks!
 [/INST] As Michael Wang commented $$A=(1+t^2)^2-2t(t^2-1)=t^4-2 t^3+2 t^2+2 t+1$$ Computing the roots of the quartic equation (all are complex), you end with
$$A=\left(t^2+(\sqrt{3}-1)t-\sqrt{3}+2\right)\left(t^2-(\sqrt{3}+1) t+\sqrt{3}+2\right)$$ Partial fraction decomposition then leads to 
$$\dfrac{1-t^2}{(1+t^2)^2-2t(t^2-1)}=\frac{1+t}{t^2+(\sqrt{3}-1)t-\sqrt{3}+2}+\frac{1+t}{t^2-(\sqrt{3}+1) t+\sqrt{3}+2}$$ which makes the problem workable.
Edit
Being less lazy, write $$(t^2+at+b)(t^2+ct+d)-(t^4-2 t^3+2 t^2+2 t+1)=0$$ Expand and group terms to get $$(a+c+2)t^3+ (a c+b+d-2)t^2+ (a d+b c-2)t+(b d-1)=0$$ So the equations to be solved are $$a+c+2=0\tag 1$$ $$a c+b+d-2=0\tag 2$$ $$a d+b c-2=0\tag 3$$ $$bd-1=0\tag 4$$ Using $(4)$, then $d=\frac 1b$. Using $(1)$, then $c=-2-a$. Replace in $(2)$ to get $$\frac{a}{b}-(a+2) b-2=0\implies a=\frac{2 b}{1-b}$$ Now, plug everything in $(3)$ to get $$\frac{(b^2-4b+1) \left(b^2+1\right)}{(b-1)^2 b}=0\implies b^2-4b+1=0$$
</s>