Integrating $\int \left( \frac{\cos\theta}{1+\sin^2\theta} \right)^n \, d\theta$, for $n=2$ and $n=3$ How do you integrate the following functions:
$$\int \left( \frac{\cos\theta}{1+\sin^2\theta} \right)^2 \, d\theta$$ and $$\int \left( \frac{\cos\theta}{1+\sin^2\theta} \right)^3 \, d\theta 
$$
respectively?
Note: Initially, I tried integrating the function without the power and obtained the result below. 
$$
\int \frac{\cos\theta}{1+\sin^2\theta} \, d\theta = \arctan(\sin\theta)+ C
$$
However, from here it is difficult to proceed. Integration by substitution doesn't seem to work.
How should I go on from here? Any pointers would be greatly appreciated. 

$$ \begin{align*} \int \frac{\cos^2 x}{\left(1 + \sin^2 x\right)^2} \ dx &= \int \frac{\sec^2 x}{\left(\sec^2 x + \tan^2 x\right)^2} \ dx \\ &= \int \frac{1}{\left(2\tan^2x + 1\right)^2}\ d(\tan x) \\ \left(\tan x \mapsto \frac{\tan u}{\sqrt2} \right) &= \frac{1}{\sqrt{2}}\int \frac{\sec^2 u}{\sec^4 u} \ du \\&= \frac{1}{2\sqrt2}\int\cos(2u) + 1 \ du \\ &= \frac{1}{2\sqrt2}\left(\frac{\sin(2u)}{2} + u \right) + C \\ &=\frac{1}{2\sqrt2}\left(\frac{\sin(2\arctan(\sqrt2\tan x))}{2} + \arctan\left(\sqrt{2}\tan x\right)\right)+C\\&= \frac{\tan x}{2\left(2\tan^2x + 1\right)} + \frac{\arctan(\sqrt2 \tan x)}{2\sqrt{2}} + C\end{align*}$$ 
