# calculate $\int_0^{\pi}\frac {x}{1+\cos^2x}dx$

Same to the tag

calculate $\int_0^{\pi}\frac {x}{1+\cos^2x}dx$.

Have no ideas on that.

Any suggestion?

Many thanks

Using $\int_a^bf(x)\ dx=\int_a^bf(a+b-x)\ dx$

$$I=\int_0^\pi\dfrac x{1+\cos^2x}dx=\int_0^\pi\dfrac{\pi-x}{1+\cos^2(\pi-x)}dx$$

$$I+I=\pi\int_0^\pi\dfrac1{1+\cos^2x}dx$$

$$\int_0^\pi\dfrac1{1+\cos^2x}dx=\int_0^\pi\dfrac{\sec^2x}{2+\tan^2x}dx$$

Set $\tan x=u$

• Hi, thank you very much. I am wondering that how you come with the idea $\int_a^b f(x) dx = \int_a^bf(a+b-x) dx$ – Chenxiao XU Jan 21 '16 at 16:27
• @Lab How does that substitution work for pi/2? – imranfat Jan 21 '16 at 16:28
• @imranfat, Try and let me know:) – lab bhattacharjee Jan 21 '16 at 16:31
• @labbhattacharjee Of course, the given integral is integrable over 0 to pi, but not anymore with the u-sub. One should then split the integral at pi/2 so that you get an answer that involves arctan(inf) that ofcourse leads to an answer in terms of pi. I thought that would be useful info for the OP – imranfat Jan 21 '16 at 16:33

Or...along the same lines

\begin{align}\int_0^{\pi} \frac{x^2}{1+\cos^2{x}} &= \int_0^{\pi} \frac{(\pi-x)^2}{1+\cos^2{x}}\\ &= \pi^2 \int_0^{\pi} \frac{1}{1+\cos^2{x}} - 2 \pi \int_0^{\pi} \frac{x}{1+\cos^2{x}} + \int_0^{\pi} \frac{x^2}{1+\cos^2{x}} \end{align}

Thus,

$$\int_0^{\pi} \frac{x}{1+\cos^2{x}} = \frac{\pi}{2} \int_0^{\pi} dx \frac{1}{1+\cos^2{x}}$$

..and use the sub $x = \arctan{u}$, etc.

ALTERNATIVE COMPLEX SOLUTION

We can use an integration over the unit circle, in the spirit of a similar problem I have done before. To start, consider

\begin{align}\int_0^{2 \pi} dx \frac{x}{1+\cos^2{x}} &= \int_0^{\pi} dx \frac{x}{1+\cos^2{x}} + \int_{\pi}^{2 \pi} dx \frac{x}{1+\cos^2{x}}\\ &= 2 \int_0^{\pi} dx \frac{x}{1+\cos^2{x}} + \pi \int_0^{\pi} dx \frac{1}{1+\cos^2{x}} + \end{align}

So we can get the integral we want in terms of an integral over a unit circle. (Yes, and also in terms of the integral above...but at this point we're just having fun and exploring, not being efficient.)

Now, consider

$$J(a) = \int_0^{2 \pi} dx \frac{e^{i a x}}{1+\cos^2{x}}$$

Then

$$\int_0^{2 \pi} dx \frac{x}{1+\cos^2{x}} = -i J'(0)$$

Now, let's consider

$$-i \oint_C \frac{dz}{z} \frac{z^a}{1+\frac14 (z+z^{-1})^2} = -i 4 \oint_C dz \frac{z^{a+1}}{z^4+6 z^2+1}$$

where $C$ is a keyhole contour about $(0,1]$ and around the unit circle. The only poles inside the unit circle are at $z_{\pm} = \pm i (\sqrt{2}-1)$. Thus, by the residue theorem, we may write the contour integral as

$$J(a) - i 4 (1- e^{i 2 \pi a}) \int_0^1 dx \frac{x^{a+1}}{x^4+6 x^2+1} = i 2 \pi (-i 4) \frac{(\sqrt{2}-1)^{a+1} \left (e^{i \pi/2 (a+1)} - e^{i 3 \pi/2 (a+1)} \right )}{4 i (\sqrt{2}-1)[-(\sqrt{2}-1)^2+3] }$$

Note that the arguments of the poles are $\pi/2$ and $3 \pi/2$ in keeping with the definition of the contour $C$. Thus,

$$J(a) = i 4 (1- e^{i 2 \pi a}) \int_0^1 dx \frac{x^{a+1}}{x^4+6 x^2+1} - i \pi \frac{(\sqrt{2}-1)^{a} \left (e^{i \pi/2 (a+1)} - e^{i 3 \pi/2 (a+1)} \right )}{ \sqrt{2} }$$

Then

$$-i J'(0) = -i 8 \pi \int_0^1 dx \frac{x}{x^4+6 x^2+1} + \sqrt{2} \pi^2 - i \frac{2 \pi \log{(\sqrt{2}-1)}}{\sqrt{2}}$$

Now,

\begin{align}\int_0^1 dx \frac{x}{x^4+6 x^2+1} &= \frac12 \int_0^1 \frac{dx}{x^2+6 x+1}\\ &= \frac12 \frac1{x_+-x_-} \int_0^1 dx \, \left (\frac1{x-x_+}-\frac1{x-x_-} \right )\\ &= \frac12 \frac1{x_+-x_-} \left [\log{\left (\frac{x_-}{x_+}\frac{1-x_+}{1-x_-} \right )} \right ] \end{align}

where $x_{\pm}=-3 \pm 2 \sqrt{2}$ so that $x_+-x_- = 4 \sqrt{2}$. The argument of the log turns out to be $3 + 2 \sqrt{2} = (\sqrt{2}+1)^2$. Thus,

$$-i J'(0) = -i \sqrt{2} \pi \log{(\sqrt{2}+1)} + \sqrt{2} \pi^2 - i \sqrt{2} \pi \log{(\sqrt{2}-1)} = \sqrt{2} \pi^2$$

Thus,

$$\int_0^{2 \pi} dx \frac{x}{1+\cos^2{x}} = \sqrt{2} \pi^2$$

Now, we also need to evaluate

$$\int_0^{\pi} \frac{dx}{1+\cos^2{x}} = -i 2 \oint_{|z|=1} dz \frac{z}{z^4+6 z^2+1} = 4 \pi \cdot 2 \frac1{4 \cdot 2 \sqrt{2}} = \frac{\pi}{\sqrt{2}}$$

Thus, from the original relation derived above:

$$\int_0^{\pi} dx \frac{x}{1+\cos^2{x}} = \frac12 \left (\int_0^{2 \pi} dx \frac{x}{1+\cos^2{x}} - \pi \int_0^{\pi} dx \frac{1}{1+\cos^2{x}} \right ) = \frac{\pi^2}{2 \sqrt{2}}$$

which, of course, we could have obtained with one step if we just stuck with the symmetry argument. But hey, some of us love to see this done using the residue theorem over weird contours.

• Concise and most effective! +1 - Mark – Mark Viola Jan 21 '16 at 16:34
• it is interesting how hard this integral gets if one not uses symmetry – tired Jan 21 '16 at 16:55
• @tired: actually, I think this one isn't so bad in the complex plane. Need to mull it over a bit. – Ron Gordon Jan 21 '16 at 16:56
• @RonGordon Complex analysis works, but it seems to be quiet laborious – tired Jan 21 '16 at 16:58
• @RonGordon i wrote up something which is more or less elegant, i would really appreciate your comments – tired Jan 21 '16 at 17:59

Ok i think i found a way which is quiet different from the approaches above. It is based on the residue theorem using an rectangle with vertices $(0,0),(\pi,0),(\pi,\pi+ i R),(0, i R)$

Defining

$$f(z)=\frac{z}{1+\cos^2(z)}$$

We obtain

$$\oint dz f(z)=\underbrace{\int_0^{\pi}f(x)dx}_{I}+i\pi\underbrace{\int_0^{R}\frac{1}{1+\cosh^2(y)}dy}_{K}+\underbrace{i\int_0^{R}f(iy)dy+i\int_R^{0}f(iy)dy}_{=0}+\underbrace{\int_0^{\pi}f(iR+x)dx}_{J} =2\pi i\sum_j\text{Res}(f(z),z=z_j)$$

It is now easy to show that $J$ vanishs in the limit $R \rightarrow\infty$ and that $z_0=\arccos(-i)=\frac{\pi}{2}+i\log(1+\sqrt{2})$ is the only zero of the denominator of $f(z)$ inside the contour of integration. We are therefore down to

$$I=2\pi i \text{Res}(f(z),z=z_0)-i\pi K$$

the last integral can be computed by standard methods (Weierstrass subsitution)and yields $K=\frac{\text{arctanh}(\sqrt{2})}{\sqrt{2}}$. One may also show that $\text{Res}(f(z),z=z_0)=\frac{\log(1+\sqrt{2})}{2\sqrt{2}}-i \pi\frac{1}{4\sqrt{2}}$. Playling a little bit with the logarithmic representation of arctanh we find that the imaginary parts cancel (as they should) and we end up with

$$I=\frac{\pi^2}{2\sqrt{2}}$$

This numerically agrees with WA!

• tired: Actually, this is quite good. The complication lies with manipulating the logs and whatnot, but the analysis is solid. Good job! BTW I am putting together an alternative complex solution, I'll let you know when it is ready. – Ron Gordon Jan 22 '16 at 5:02
• tired: the solution is ready. Enjoy. – Ron Gordon Jan 22 '16 at 7:05