I am trying to find the following integral: $$\int \frac {dx}{\sin^2 x + \tan^2x}$$
I have tried the common thing to do when encountering rational functions that contains rational functions and converting everything in terms of $\tan \frac{x}{2}$ then substituting it.
$$\tan\frac{x}{2}=t\Rightarrow \sin x=\frac{2t}{1+t^2},\ \cos x=\frac{1-t^2}{1+t^2},\ dx=\frac{2}{1+t^2}dt$$ $$\Rightarrow \int \frac{dx}{\sin^2 x + \frac{\sin^2 x}{\cos^2 x}}=\int \frac{\frac{2}{1+t^2}}{\left(\frac{2t}{1+t^2}\right)^2+\left(\frac{2t}{1-t^2}\right)^2}dt$$ However I am stuck. Is there perhaps an easier way to approach it?
Let $t=\tan(x)$, then $dx=dt/(1+t^2)$ and $\sin^2(x)=t^2/(1+t^2)$. Hence $$\int \frac {dx}{\sin^2 x + \tan^2x}=\int \frac {dt}{(t^2+ (1+t^2)t^2)}=\int \frac {dt}{t^2(2+t^2)}=\frac{1}{2}\int \frac {dt}{t^2}-\frac{1}{2}\int \frac {dt}{2+t^2}.$$ Can you take it from here?
P.S. By letting $t=\tan(x/2)$, then $dx=2dt/(1+t^2)$, $\sin(x)=2t/(1+t^2)$ and $\tan(x)=2t/(1-t^2)$. Then we obtain the integral of a more complicated rational function.