# 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.

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*}$$

• Thanks, this is very helpful. However, at the final part, how do you expand the partial fractions?
– Jenq
May 15, 2013 at 5:40
• @quest326 I made the substitution $X=t^2$ to reduce the degree of the numerator and denominator. I got $$\frac{2\left( 1+X\right) \left( X-1\right) ^{2}}{\left( 1+6X+X^{2}\right) ^{2}}=\frac{16+80X}{\left( 1+6X+X^{2}\right) ^{2}}+\frac{2X-14}{1+6X+X^{2}}.$$ I didn't proceed but we may factor the denominators $$1+6t^2+t^4=(t^2+3-2\sqrt{2})(t^2+3+2\sqrt{2}).$$ Anyhow the fractions are not easily integrable. May 15, 2013 at 10:55

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.

\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*}

• +1, very nice. Minor typo: the exponent $2$ is missing in the denominator of the 2nd. integral. May 15, 2013 at 11:14
• Edited, thanks. May 15, 2013 at 16:09

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$$

Multiplying both numerator and denominator by $$\sec^2 \theta$$ yields \begin{aligned} I_2=&\int\left(\frac{\cos \theta}{1+\sin ^{2} \theta}\right)^{2} d \theta\\=& \int \frac{\sec ^{2} \theta}{\left(\sec ^{2} \theta+\tan ^{2} \theta\right)^{2}} d \theta \\ =& \int \frac{d t}{\left(1+2 t^{2}\right)^{2}}, \text { where } t=\tan \theta \end{aligned}

\begin{aligned} I_{2} & =\int \frac{d t}{\left(1+2 t^{2}\right)^{2}}\\&=-\frac{1}{4}\int\frac{1}{t} d\left(\frac{1}{1+2 t^{2}}\right)\\ &=-\frac{1}{4 t\left(1+2 t^{2}\right)}-\frac{1}{4}\left(\frac{1}{t^{2}\left(1+2 t^{2}\right)} d t\right.\\ &=-\frac{1}{4 t\left(1+2 t^{2}\right)}-\frac{1}{4} \int\left(\frac{1}{t^{2}}-\frac{2}{1+2 t^{2}}\right) d t \\ &=-\frac{1}{4 t\left(1+2 t^{2}\right)}+\frac{1}{4 t}+\frac{1}{2 \sqrt{2}} \tan ^{-1}(\sqrt{2} t)+C \\ &=\frac{t}{2\left(2 t^{2}+1\right)}+\frac{1}{2 \sqrt{2}} \tan ^{-1}(\sqrt{2} t)+C \\ &=\frac{\tan \theta}{2\left(2 \tan ^{2} \theta+1\right)}+\frac{1}{2 \sqrt{2}} \tan ^{-1}(\sqrt{2} \tan \theta)+C \end{aligned}

Now let’s go further to $$I_3$$ by the substitution $$\tan u=\sin \theta$$. \begin{aligned} \int \frac{\cos ^{3} \theta}{\left(1+\sin ^{2} \theta\right)^{3}} d \theta &=\int \frac{1-\tan ^{2} u}{\left(1+\tan ^{2} \theta\right)^{3}} \cdot \sec ^{2} u d u \\ &=\int \frac{1-\tan ^{2} u}{\sec ^{4} u} d u \\ &=\int\left(\cos ^{4} u-\sin ^{2} u \cos ^{2} u\right) d u \\ &=\int \cos ^{2} u\left(\cos ^{2} u-\sin ^{2} u\right) d u \\ &=\int \frac{1+\cos 2 u}{2} \cos 2 u d u \\ &=\frac{\sin 2 u}{4}+\frac{1}{2} \int \frac{1+\cos 4 u}{2} d u \\ &=\frac{\sin u \cos u}{2}+\frac{1}{4} u+\frac{1}{16} \sin 4 u+C \\ &=\frac{\sin u \cos u}{2}+\frac{u}{4}+\frac{\sin u \cos u \cos 2 u}{4}+C \\ &=\frac{u}{4}+\frac{\sin u \cos u}{4}(2+\cos 2 u)+C \\ & =\frac{1}{4} \tan ^{-1}(\sin \theta)+\frac{\sin \theta}{4\left(1+\sin ^{2} \theta\right)}\left(2+\frac{1-\sin ^{2} \theta}{1+\sin ^{2} \theta}\right)+C\\& =\frac{1}{4} \tan ^{-1}(\sin \theta)+\frac{\sin \theta\left(\sin ^{2} \theta+3\right)}{(\cos 2 \theta-3)^{2}}+C\end{aligned}

:|D Wish you enjoy my solution!