# Integral $\int \frac {dx}{\sin^2 x + \tan^2x}$

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.

• Thanks a lot . I have a very generic question. Will the substitution t=tanx work whenever we have sin x and cos x in the integrand? – rikodou sennin Apr 20 '18 at 6:00
• For a trigonometric rational function a general substitution is $t=\tan x$ (so your approach is right). In this case, with the squares, in order to have a polynomial of lower degree at the denominator it's better to use $t=\tan x$. – Robert Z Apr 20 '18 at 6:05
• @rikodusennin We can write $\sin x,\,\cos x$ as functions of $\tan x/2$ as all three have the same period, $2\pi$. When each sine and cosine is raised to an even power, their period halves and we can use $\tan x$. – J.G. Apr 20 '18 at 6:23

$$\dfrac1{\sin^2x+\tan^2x}=\dfrac{\cos^2x}{\sin^2x(1+\cos^2x)}$$

Method$\#1:$ $$=\dfrac{\cos^2x+1-1}{\sin^2x(1+\cos^2x)}=\csc^2x-\dfrac1{(1-\cos^2x)(1+\cos^2x)}$$

Now $$\dfrac2{(1-\cos^2x)(1+\cos^2x)}=\dfrac1{1-\cos^2x}+\dfrac1{1+\cos^2x}$$

Finally $$\dfrac1{1+\cos^2x}=\dfrac{\sec^2x}{2+\tan^2x}$$

Method$\#2:$

$$\dfrac{\cos^2x}{\sin^2x(1+\cos^2x)}=\dfrac c{(1-c)(1+c)}=\dfrac A{1-c}+\dfrac B{1+c}$$ using Partial Fraction Decomposition where $c=\cos^2x$

\begin{align}\int\dfrac{dx}{\sin^2{(x)}+\tan^2{(x)}}\cdot\dfrac{\sec^2{x}}{\sec^2{x}}&=\int\dfrac{\sec^2{x}\ dx}{\tan^2{x}+\sec^2{x}\tan^2{x}}\\ &=\int\dfrac{\sec^2{x}\ dx}{\tan^2{x}+(\tan^2{x}+1)\tan^2{x}}\\ &=\int\dfrac{\sec^2{x}\ dx}{2\tan^2{x}+\tan^4{x}}\end{align}

Let $u=\tan{x}$ and $du=\sec^2{x}\ dx$

\begin{align} &=\int\dfrac{du}{u^4+2u^2}\\ &=\int\left(\dfrac{1}{2u^2}-\dfrac{1}{2(u^2+2)}\right)du\\ &=-\dfrac{1}{2}\int\dfrac{du}{u^2+2}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\ &=-\dfrac{1}{2}\int\dfrac{du}{2(\frac{u^2}{2}+1)}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\ &=-\dfrac{1}{4}\int\dfrac{du}{\frac{u^2}{2}+1}+\dfrac{1}{2}\int\dfrac{du}{u^2}\end{align}

Let $s=\frac{u}{\sqrt{2}}$ and $ds=\frac{du}{\sqrt{2}}$.

\begin{align} &=-\dfrac{1}{2\sqrt{2}}\int\dfrac{ds}{s^2+1}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\ &=-\frac{\arctan{s}}{2\sqrt{2}}+\dfrac{1}{2}\int\dfrac{du}{u^2}\\ &=-\frac{\arctan{s}}{2\sqrt{2}}-\frac{1}{2u}+C\\ &=-\frac{\sqrt{2}u\arctan{\frac{u}{\sqrt{2}}+2}}{4u}+C\\ &=-\frac{1}{4}\left(\sqrt{2}\arctan{\frac{\tan{x}}{\sqrt{2}}\tan{x}+2} \right)\cot{x}+C \end{align}

Which is equal to $$-\frac{1}{4}\left(\sqrt{2}\arctan{\frac{\tan{x}}{\sqrt{2}}+2\cot{x}}\right)+C.$$

• OP's integral is not $\int\sin^2{(x)}\tan^2{(x)}\ dx$... – Robert Z Apr 20 '18 at 5:56
• As @RobertZ, has pointed out , the question is not regarding $∫\sin^2(x)\tan^2(x) dx$ . If there are any intermediate steps that you have used to arrive to that step, please point it out. – rikodou sennin Apr 20 '18 at 6:02