Evaluate $ \int \frac{a^2\cos^2x+b^2\sin^2x}{a^4\cos^2x+b^4\sin^2x}\,dx$ Evaluate $$ \int \frac{a^2\cos^2x+b^2\sin^2x}{a^4\cos^2x+b^4\sin^2x}\,dx$$
I have tried Weierstrass substitution and tried to split into two integrations, but it gets really messy.
Is there a better way to approach this problem? I feel that complex numbers are the best way out, but I couldn't get anything using that as well.

\begin{align}\int \frac{a^2\cos^2x+b^2\sin^2x}{a^4\cos^2x+b^4\sin^2x}\,dx
=& \int \frac{a^2\csc^2x+b^2\sec^2x}{a^4\csc^2x+b^4\sec^2x}\,dx\\
=& \int \frac{ d(b^2\tan x -a^2\cot x)}{(a^2+b^2)^2 +(b^2\tan x -a^2\cot x)^2} \\
=& \ \frac1{a^2+b^2}\tan^{-1}\frac{b^2\tan x -a^2\cot x}{a^2+b^2}+C
\end{align}
