# Is there any easy trick for solving this integral?

#### skatenerd

##### Active member
In the middle of an integral using Green's Theorem for an outward flux calculation, I came up to a really gross integral. The double integral started out as
$$\int_{-1}^{1}\int_{-\sqrt{1-y^2}}^{\sqrt{1-y^2}}\frac{2}{1+y^2}\,dx\,dy$$
and I got it down to
$$\int_{-1}^{1}\frac{4\sqrt{1-y^2}}{1+y^2}\,dy$$
I tried thinking of numerous substitutions and by parts strategies...nothing seemed to work. I consulted wolframalpha and it gave me a solution using I think something like 4 substitutions and partial fractions which I would really rather not go through.
Any other ideas? Or is this just a terrible integral one would prefer to avoid?

#### chisigma

##### Well-known member
In the middle of an integral using Green's Theorem for an outward flux calculation, I came up to a really gross integral. The double integral started out as
$$\int_{-1}^{1}\int_{-\sqrt{1-y^2}}^{\sqrt{1-y^2}}\frac{2}{1+y^2}\,dx\,dy$$
and I got it down to
$$\int_{-1}^{1}\frac{4\sqrt{1-y^2}}{1+y^2}\,dy$$
I tried thinking of numerous substitutions and by parts strategies...nothing seemed to work. I consulted wolframalpha and it gave me a solution using I think something like 4 substitutions and partial fractions which I would really rather not go through.
Any other ideas? Or is this just a terrible integral one would prefer to avoid?
With the substitution $y= \sin \frac{x}{2}$ the integral becomes...

$\displaystyle I= 2\ \int_{- \pi}^{\pi} \frac{\cos ^{2} \frac{x}{2}}{1 + \sin^{2} \frac{x}{2}}\ dx = 2\ \int_{- \pi}^{\pi} \frac{1+ \cos x}{3 - \cos x}\ dx$ (1)

... and (1) can be solved using complex analysis approach...

Kind regards

$\chi$ $\sigma$

#### Chris L T521

##### Well-known member
Staff member
In the middle of an integral using Green's Theorem for an outward flux calculation, I came up to a really gross integral. The double integral started out as
$$\int_{-1}^{1}\int_{-\sqrt{1-y^2}}^{\sqrt{1-y^2}}\frac{2}{1+y^2}\,dx\,dy$$
and I got it down to
$$\int_{-1}^{1}\frac{4\sqrt{1-y^2}}{1+y^2}\,dy$$
I tried thinking of numerous substitutions and by parts strategies...nothing seemed to work. I consulted wolframalpha and it gave me a solution using I think something like 4 substitutions and partial fractions which I would really rather not go through.
Any other ideas? Or is this just a terrible integral one would prefer to avoid?
I can't think of an easy way to do this one. I think converting to polar coordinates may ease the pain at the start, but from what you'll see below, it's still quite a messy process.

If you plot the region that's defined by the bounds of integration, it's a circle of radius 1 centered at the origin in the $xy$-plane.

If you do the conversion to polar coordinates, we see that

$\int_{-1}^1\int_{-\sqrt{1-y^2}}^{\sqrt{1-y^2}} \frac{2}{1+y^2}\,dx\,dy \xrightarrow{\text{polar coordinates}}{} \int_0^{2\pi} \int_0^1\frac{2r}{1+ r^2\sin^2\theta}\,dr\,d\theta$

The first intergral can be evaluated by making the substitution $u=r^2\sin^2\theta$; then $\,du=2r\sin^2\theta\,dr\implies \dfrac{\,du}{\sin^2\theta}=2r\,dr$. Thus,

$\int_0^{2\pi} \int_0^1\frac{2r}{1+r^2\sin^2\theta}\,dr\,d\theta \xrightarrow{u=r^2\sin^2\theta}{} \int_0^{2\pi}\int_0^{\sin^2\theta} \frac{1}{\sin^2\theta} \frac{\,du}{1+u}\,d\theta = \int_0^{2\pi} \frac{\ln(1+\sin^2\theta)}{\sin^2\theta} \,d\theta$

Now here's where all the fun begins.

We proceed to integrate by parts (w/o limits of integration for the time being). Take $u=\log(1+\sin^2\theta)$ and $\,dv=\dfrac{\,d\theta}{\sin^2\theta}=\csc^2\theta\,d\theta$. Then $\,du=\dfrac{2\sin\theta\cos\theta}{1+\sin^2\theta}\,d\theta$ and $v=-\cot\theta$. Therefore,

\begin{aligned}\int \frac{\ln(1+\sin^2\theta)}{\sin^2\theta}\,d\theta &= -\cot\theta\ln(1+\sin^2\theta) + \int \frac{2\cot\theta\sin\theta\cos\theta}{ 1+\sin^2\theta}\,d\theta\\ &= -\cot\theta\ln(1+\sin^2\theta) +\int\frac{2\cos^2\theta}{1+\sin^2\theta}\,d\theta\end{aligned}

Now, to integrate $\displaystyle\int\frac{2\cos^2\theta}{ 1+\sin^2\theta}\,d\theta$, multiply top and bottom by $\sec^4\theta$ to get

$\int\frac{2\sec^2\theta}{\sec^4\theta + \sec^2\theta\tan^2\theta}\,d\theta = \int\frac{2\sec^2\theta}{(\tan^2\theta+1)^2 + (\tan^2+ 1)\tan^2\theta}\,d\theta = \int\frac{2\sec^2\theta}{2\tan^4\theta +3\tan^2\theta + 1}\,d\theta$

Now let $t=\tan\theta\implies \,dt=\sec^2\theta\,d\theta$. Therefore,

$\int\frac{2\sec^2\theta}{2\tan^4\theta +3\tan^2\theta + 1}\,d\theta \xrightarrow{t=\tan\theta}{} \int\frac{2\,dt}{2t^4+3t^2+1} = \int\frac{2\,dt}{(2t^2+1)(t^2+1)}$

If things aren't bad enough at this point, things just got worse; it's time to use partial fractions! XD

We first note that

\begin{align*}\frac{1}{(2t^2+1)(t^2+1)}=\dfrac{At+B}{2t^2+1} +\dfrac{Ct+D}{t^2+1} \implies 1 &= (At+B)(t^2+1) + (Ct+D)(2t^2+1) \\ \implies 1 &= At^3+Bt^2+At+B + 2Ct^3+2Dt^2+Ct+D\\ \implies 1 & = (A+2C)t^3+(B+2D)t^2 + (A+C)t + (B+D)\end{align*}

Thus, we solve the system of equations

\left\{\begin{aligned}A+2C &= 0\\ B+2D &= 0\\ A+C &= 0\\ B+D &= 1 \end{aligned}\right.

It's easy to show that $A=C=0$, $D=-1$ and $B=2$.

Therefore, \begin{aligned} \int\frac{2}{(2t^2+1)(t^2+1)}\,dt &= 2\left[\int\frac{2}{2t^2+1}\,dt - \int\frac{1}{t^2+1}\,dt\right]\\ &= 2\left[\sqrt{2}\int\frac{\sqrt{2}}{(\sqrt{2}t)^2+1}\,dt - \int\frac{1}{t^2+1}\,dt\right]\\ &= 2\left[\sqrt{2}\arctan(\sqrt{2}t) - \arctan(t)\right]+C\end{aligned}

Since $t=\tan\theta$, we have that

$2\left[\sqrt{2}\arctan(\sqrt{2}\tan\theta) - \arctan(\tan\theta)\right]+C = 2\sqrt{2}\arctan(\sqrt{2}\sin\theta) -2\theta+C$

and thus

$\int\frac{2\cos^2\theta}{1+\sin^2\theta}\,d\theta = 2\sqrt{2}\arctan(\sqrt{2}\tan\theta) - 2\theta + C$

and furthermore we now have that

$\int \frac{\ln(1+\sin^2\theta)}{\sin^2\theta}\,d\theta = -\cot\theta\ln(1+\sin^2\theta) + 2\sqrt{2}\arctan(\sqrt{2}\tan\theta) -2\theta+C$

We must take note of something due to the oscillatory nature of $\dfrac{\ln(1+\sin^2\theta)}{\sin^2\theta}$ seen below over the interval $[0,2\pi]$: If we were to evaluate the integral over $[0,2\pi]$, lots of things would be ignored and we end up with an answer of $-4\pi$ (which makes no sense). From the graph, it makes sense to evaluate the integral from $[0,\pi/2]$ and then multiply that result by 4 to get the entire area. With that said, it follows now that

\begin{aligned} \int_0^{2\pi} \frac{\ln(1+\sin^2\theta)}{\sin^2\theta}\,d\theta &= 4\int_0^{\frac{\pi}{2}} \frac{\ln(1+\sin^2\theta)}{\sin^2\theta}\,d\theta \\ &= 4\left[-\cot\theta\ln(1+\sin^2\theta) + 2\sqrt{2}\arctan(\sqrt{2}\tan\theta) -2\theta\right]_0^{\frac{\pi}{2}} \\ &= 4\left[ \left( -\cot\frac{\pi}{2} \ln\left(1+\sin^2\frac{\pi}{2}\right) + \lim_{b\to\frac{\pi}{2}^-} 2\sqrt{2} \arctan\left(\sqrt{2}\tan b\right) -\pi\right)\right.\\ & \phantom{=.4.} \left.-\left( \lim_{a\to 0^+} -\cot a\ln(1+\sin^2 a) +2\sqrt{2} \arctan(\sqrt{2} \tan 0) \right)\right] \\ &= 4\left[(\sqrt{2}\pi -\pi) - \underbrace{\lim_{a\to 0^+} -\cot a\ln(1+\sin^2 a)}_{=0\text{ by L'Hôpital's rule}}\right]\\ &= 4\pi(\sqrt{2}-1)\approx 5.20516\end{aligned}

Which luckily matches up with the numerical value provided by WolframAlpha (!!!!!) It's a lot to read through, but I hope this makes sense! XD

EDIT: Ninja'd by chisigma by about an hour or so.... >_>

Last edited:

#### Bacterius

##### Well-known member
MHB Math Helper
I can't think of an easy way to do this one. I think converting to polar coordinates may ease the pain at the start, but from what you'll see below, it's still quite a messy process.

[...] #### Chris L T521

##### Well-known member
Staff member ...and that's how I felt once I actually finished computing this integral.

(I pretty much laughed out loud when I saw that picture...at 02:15 when everyone around my place is practically sleeping...thanks for that. )

#### Ackbach

##### Indicium Physicus
Staff member
Another method: switch the order of integration. You get
$$\int_{-1}^{1} \int_{- \sqrt{1-y^{2}}}^{ \sqrt{1-y^{2}}} \frac{2}{1+y^{2}} \, dx \, dy=2 \int_{-1}^{1} \int_{- \sqrt{1-x^{2}}}^{ \sqrt{1-x^{2}}} \frac{1}{1+y^{2}} \, dy \, dx=4 \int_{-1}^{1} \int_{0}^{ \sqrt{1-x^{2}}} \frac{1}{1+y^{2}} \, dy \, dx=$$
$$=4\int_{-1}^{1} \tan^{-1} \left( \sqrt{1-x^{2}}\right) dx= 8\int_{0}^{1} \tan^{-1} \left( \sqrt{1-x^{2}}\right) dx.$$
This last integral would succumb, I think, to by-parts (might need to do that twice). You can see that I've used symmetry twice.

[EDIT]: A single by-parts is useful, but the remainder of the steps are a bewildering array of substitutions. This will eventually get you to the same sorts of integrals Chris L T521 did.

Last edited:

#### topsquark

##### Well-known member
MHB Math Helper
Speaking as a Physicist integrals like this are the reason that Mathematicians are included in research groups. -Dan

#### skatenerd

##### Active member
Wow. Chris L that was an impressively thorough solution. Kudos to you sir. I'd have to say Ackback wins the price for simplicity however. I'll try to solve it his way when I finish all this physics homework...

#### Ackbach

##### Indicium Physicus
Staff member
Wow. Chris L that was an impressively thorough solution. Kudos to you sir. I'd have to say Ackback wins the price for simplicity however. I'll try to solve it his way when I finish all this physics homework...
Maybe you didn't see my edit. My way leads to thickets of equations every bit as dense as Chris's, I'm afraid. I might possibly reach the thickets a tad quicker, but they're still there.

#### Klaas van Aarsen

##### MHB Seeker
Staff member
I kind of like Wolfram's solution.
It's 5.20516.

Unless you want a beautiful mathematical solution. #### skatenerd

##### Active member
Ah Ackbach yeah I just saw your edit now. I have a feeling my professor didn't go through this homework himself...that integral is too mean and cruel

#### Ackbach

##### Indicium Physicus
Staff member
Ah Ackbach yeah I just saw your edit now. I have a feeling my professor didn't go through this homework himself...that integral is too mean and cruel
Ah, yes: the (in)famous "exercise for the reader".

#### Klaas van Aarsen

##### MHB Seeker
Staff member
Ah, yes: the (in)famous "exercise for the reader".
Or the one that is slightly "too large to fit into the margin". 