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.
Solution 1:
See question Evaluating $\int P(\sin x, \cos x) \text{d}x$.
The universal standard substitution to evaluate an integral of a rational fraction in $\sin \theta,\cos \theta$, i.e. a rational fraction of the form
$$R(\sin \theta,\cos \theta)=\frac{P(\sin \theta,\cos \theta)}{Q(\sin \theta,\cos \theta)},$$
where $P,Q$ are polynomials in $\sin \theta,\cos \theta$ is a trigonometric substitution known as the Weierstrass substitution
$$ \begin{equation*} \tan \frac{\theta }{2}=t,\qquad\theta =2\arctan t,\qquad d\theta =\frac{2}{1+t^{2}}dt \end{equation*}, $$
which converts the integrand into a rational function in $t$. We know from trigonometry (see this answer) that
$$\cos \theta =\frac{1-\tan ^{2}\frac{\theta }{2}}{1+\tan ^{2}\frac{ \theta}{2}}=\frac{1-t^2}{1+t^2},\qquad \sin \theta =\frac{2\tan \frac{\theta }{2}}{1+\tan ^{2} \frac{\theta }{2}}=\frac{2t}{1+t^2}.$$
Applying this substitution to e.g. the first integral, we get $$ \begin{eqnarray*} I &=&\int \left( \frac{\cos \theta }{1+\sin ^{2}\theta }\right) ^{2}d\theta =\int \left( \frac{\cos \theta }{2-\cos ^{2}\theta }\right) ^{2}d\theta \\ &=&\int \frac{2\left( 1+t^{2}\right) \left( t^{2}-1\right) ^{2}}{\left( 1+6t^{2}+t^{4}\right) ^{2}}dt. \end{eqnarray*} $$
[Edited and added.] The integrand can be expanded as $$ \begin{eqnarray*} \frac{2\left( 1+t^{2}\right) \left( t^{2}-1\right) ^{2}}{\left( 1+6t^{2}+t^{4}\right) ^{2}} &=&\frac{16+80t^{2}}{\left( 1+6t^{2}+t^{4}\right) ^{2}}+\frac{2t^{2}-14}{1+6t^{2}+t^{4}} \\ &=&\frac{1}{4}\frac{4-3\sqrt{2}}{t^{2}+3-2\sqrt{2}}+\frac{5\sqrt{2}-7}{ \left( t^{2}+3-2\sqrt{2}\right) ^{2}}\\&+&\frac{1}{4}\frac{4+3\sqrt{2}}{t^{2}+3+2 \sqrt{2}}-\frac{7+5\sqrt{2}}{\left( t^{2}+3+2\sqrt{2}\right) ^{2}}. \end{eqnarray*} $$
With the help of SWP I evaluated $$ \begin{eqnarray*} \int \frac{1}{4}\frac{4\mp 3\sqrt{2}}{t^{2}+3-2\sqrt{2}}dt &=&\frac{1}{4} \frac{4\pm 3\sqrt{2}}{\sqrt{2}-1}\arctan \frac{t}{\sqrt{2}-1}, \\ \int \frac{-7+5\sqrt{2}}{\left( t^{2}+3-2\sqrt{2}\right) ^{2}}dt &=&\frac{ (7-5\sqrt{2})t}{2\left( -3+2\sqrt{2}\right) \left( t^{2}+3-2\sqrt{2}\right) }\\ &+&\frac{7-5\sqrt{2}}{2\left( -3+2\sqrt{2}\right) \left( \sqrt{2}-1\right) } \arctan \frac{t}{\sqrt{2}-1}, \\ -\int \frac{7+5\sqrt{2}}{\left( t^{2}+3+2\sqrt{2}\right) ^{2}}dt &=&-\frac{ (7+5\sqrt{2})t}{2\left( 3+2\sqrt{2}\right) \left( t^{2}+3+2\sqrt{2}\right) }\\&-& \frac{7+5\sqrt{2}}{2\left( 3+2\sqrt{2}\right) \left( \sqrt{2}+1\right) } \arctan \frac{t}{\sqrt{2}+1}. \end{eqnarray*} $$
As a consequence the integral $I$ can be written as $$ \begin{eqnarray*} I &=&\frac{1}{4}\frac{-10+7\sqrt{2}}{-5\sqrt{2}+7}\arctan \frac{t}{\sqrt{2}-1}+\frac{1}{4}\frac{10+7\sqrt{2}}{7+5\sqrt{2}}\arctan \frac{t}{\sqrt{2}+1}\\&-&\frac{t^{3}-t}{t^{4}+6t^{2}+1}+C, \\ &=&\frac{1}{4}\frac{-10+7\sqrt{2}}{-5\sqrt{2}+7}\arctan \frac{\tan \frac{ \theta }{2}}{\sqrt{2}-1}+\frac{1}{4}\frac{10+7\sqrt{2}}{7+5\sqrt{2}}\arctan \frac{\tan \frac{\theta }{2}}{\sqrt{2}+1}\\&-&\frac{ \tan ^{3}\frac{\theta }{2} -\tan \frac{\theta }{2}}{ \tan^{4} \frac{\theta }{2} +6 \tan ^{2}\frac{\theta }{2} +1}+C. \end{eqnarray*} $$
Solution 2:
The latter integral may be done by substituting $\tan{\phi} = \sin{\theta}$; the result is the integral
$$\int d\theta \left ( \frac{\cos{\theta}}{1+\sin^2{\theta}}\right)^3 = \int d\phi\, (\cos^4{\phi}-\cos^2{\phi} \sin^2{\phi})$$
which I trust is an improvement.
Solution 3:
$$ \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*}$$
Solution 4:
I will be solving the first integral. If I can figure out the second integral I'll post my solution as another answer. $$I=\int\bigg(\frac{\cos x}{1+\sin^2x}\bigg)^2\mathrm{d}x$$ $$I=\int\frac{\cos^2x}{(1+\sin^2x)^2}\mathrm{d}x$$ $$I=\int\frac{\sec^2 x\ \mathrm{d}x}{(2\tan^2x+1)^2}$$ $t=\tan x\Rightarrow \mathrm{d}t=\sec^2x\ \mathrm{d}x$: $$I=\int\frac{\mathrm{d}t}{(2t^2+1)^2}$$ Apply the reduction formula $$\int\frac{\mathrm{d}x}{(ax^2+b)^n}=\frac{x}{2b(n-1)(ax^2+b)^2}+\frac{2n-3}{2b(n-1)}\int\frac{\mathrm{d}x}{(ax^2+b)^{n-1}}$$ With $a=2,\ b=1,\ n=2$: $$I=\frac{t}{2(2t^2+1)}+\frac12\int\frac{\mathrm{d}t}{2t^2+1}$$ Preform $u=\sqrt{2}\ t$: $$I=\frac{t}{2(2t^2+1)}+\frac1{2\sqrt{2}}\int\frac{\mathrm{d}u}{u^2+1}$$ $$I=\frac{t}{2(2t^2+1)}+\frac1{2\sqrt{2}}\arctan u$$ $$I=\frac{t}{2(2t^2+1)}+\frac1{2\sqrt{2}}\arctan t\sqrt{2}$$ $$I=\frac{\tan x}{2(2\tan^2x+1)}+\frac1{2\sqrt{2}}\arctan(\sqrt{2}\tan x)\quad +C$$