Evaluate the following integral

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

This integral is deviously difficult. It may look like it has the solution I provided for this integral, but, as you will see, there is an additional wrinkle.

As in the linked solution, I will express the integral in a form in which I may attack via Cauchy’s theorem. I will then deduce the contour over which we will need to apply Cauchy’s theorem – this is the additional wrinkle.

So, to start, let’s rewrite the integral, which I will denote $K$:

$$K=\int_0^{\pi/2} dx \frac{x^2}{1+\cos^2{x}} = 2 \int_0^{\pi/2} dx \frac{x^2}{3+\cos{2 x}} = \frac18 \int_{-\pi}^{\pi} dy \frac{y^2}{3+\cos{y}}$$

Along these lines, define

$$J(a) = \int_{-\pi}^{\pi} dy \frac{e^{i a y}}{3+\cos{y}}$$

so that

$$K = -\frac18 J”(0)$$

This then allows us to define the following contour integral

$$I(a) = \oint_C dz \frac{z^a}{z^2+6 z+1}$$

where, as I will explain below, $C$ is the following contour

which is a modified keyhole contour about the negative real axis within the unit circle. The modification is a pair of semicircular bumps of radius $\epsilon$ about the point $z=-3+2 \sqrt{2}$. These bumps are necessary because the integrand has a pole within the unit circle on the chosen branch cut of the integrand (i.e., the negative real axis).

The strategy is to express $I(a)$ in terms of $J(a)$ and other terms, which will then yield an expression for $J(a)$ by Cauchy’s theorem. To do this, we write out $I(a)$ explicitly in terms of integrals along the eight pieces of the contour $C$. This is an exercise in parametrization which is better left to the reader. The result is

$$I(a) = \frac{i}{2} J(a) +e^{i \pi} \int_1^{3-2 \sqrt{2}+\epsilon} dx \frac{e^{i \pi a} x^a}{x^2-6 x+1} \\+ i \epsilon \int_{\pi}^0 d\phi \, e^{i \phi} \frac{ [e^{i \pi}(3-2 \sqrt{2})+\epsilon e^{i \phi}]^a}{(-3+2 \sqrt{2}+\epsilon e^{i \phi})^2+6 (-3+2 \sqrt{2}+\epsilon e^{i \phi})+1}\\ +e^{i \pi} \int_{3-2 \sqrt{2}-\epsilon}^{\epsilon} dx \frac{e^{i \pi a} x^a}{x^2-6 x+1} + i \epsilon \int_{\pi}^{-\pi} d\phi \, e^{i \phi} \frac{\epsilon^a e^{i a \phi}}{\epsilon^2 e^{i 2 \phi}+6 \epsilon e^{i \phi}+1}\\ +e^{-i \pi} \int_{\epsilon}^{3-2 \sqrt{2}-\epsilon} dx \frac{e^{-i \pi a} x^a}{x^2-6 x+1}\\ + i \epsilon \int_0^{-\pi} d\phi \, e^{i \phi} \frac{ [e^{-i \pi}(3-2 \sqrt{2})+\epsilon e^{i \phi}]^a}{(-3+2 \sqrt{2}+\epsilon e^{i \phi})^2+6 (-3+2 \sqrt{2}+\epsilon e^{i \phi})+1}\\+e^{-i \pi} \int_{3-2 \sqrt{2}+\epsilon}^1 dx \frac{e^{-i \pi a} x^a}{x^2-6 x+1} $$

Actually, one remark is worth making at this point. The parametrization of the semicircular bumps about the point $z=-3+2 \sqrt{2}$ requires us to invoke the correct representation of the minus sign. Thus, above the branch cut, $-3+2 \sqrt{2}=e^{i \pi} (3-2 \sqrt{2})$, while below the branch cut, $-3+2 \sqrt{2}=e^{-i \pi} (3-2 \sqrt{2})$. This is crucial to the analysis.

We consider the limit as $\epsilon \to 0$; in this limit, the above simplifies considerably:

$$I(a) = \frac{i}{2} J(a) + i 2 \sin{\pi a} \: PV \int_0^1 dx \frac{x^a}{x^2-6 x+1} – i \frac{\pi}{4 \sqrt{2}} 2 \cos{\pi a} \: (3-2 \sqrt{2})^a$$

where $PV$ denotes the Cauchy principal value. By Cauchy’s theorem, $I(a)=0$; this produces an expression for $J(a)$:

$$J(a) = \frac{\pi}{\sqrt{2}} \cos{\pi a} \: (3-2 \sqrt{2})^a – 4 \sin{\pi a}\: PV \int_0^1 dx \frac{x^a}{x^2-6 x+1}$$

All we need to do now is use the above expression for $K=-\frac18 J”(0)$; the result is

$$K = \pi \, PV \int_0^1 dx \frac{\log{x}}{x^2-6 x+1} + \frac{\pi^3}{8 \sqrt{2}} – \frac{\pi}{8 \sqrt{2}} \log^2{(3-2 \sqrt{2})}$$

To complete this analysis, we evaluate the above integral. Note that it is a principal value, as the integration interval includes a pole of the integrand. To this effect, we note that

$$\frac1{x^2-6 x+1} = \frac1{4 \sqrt{2}} \left (\frac1{x-(3+2 \sqrt{2})} – \frac1{x-(3-2 \sqrt{2})} \right )$$

We use the following formulae, when $b \gt 1$,:

$$\int_0^1 dx \frac{\log{x}}{x-b} = \text{Li}_2{\left ( \frac1{b}\right )}$$

and

$$PV\int_0^1 dx \frac{\log{x}}{x-1/b} =\frac{\pi^2}{3} – \frac12 \log^2{\left ( \frac1{b}\right )} – \text{Li}_2{\left ( \frac1{b}\right )}$$

Thus, using the value $b=3+2 \sqrt{2}$, we find that

$$PV \int_0^1 dx \frac{\log{x}}{x^2-6 x+1} = \frac1{4 \sqrt{2}} \left [2 \text{Li}_2{(3-2 \sqrt{2})} - \frac{\pi^2}{3} + \frac12 \log^2{(3-2 \sqrt{2})} \right ] $$

Putting this all together, we find that the $\log^2$ terms cancel and we have

$$K = \int_0^{\pi/2} dx \frac{x^2}{1+\cos^2{x}} = \frac{\pi}{2 \sqrt{2}} \text{Li}_2{(3-2 \sqrt{2})} + \frac{\pi^3}{24 \sqrt{2}}$$

To summarize, we replaced the $x^2$ in the original integral by a factor of $e^{i a y}$, which then became a factor of $z^a$ in a contour integral. The integrand of the contour integral not only has a branch point at $z=0$, but also a pole on the branch cut. The contour of the contour integral then needed to have a detour around this pole on the branch cut. Using Cauchy’s theorem, we got an expression for the integral over $e^{i a y}$, and differentiating twice, we got an expression for the original integral in terms of the principal value of another integral. The problem then reduced to evaluating the principal value of that integral.

Hey RG:

cool work, RG.

I had tackled this one a different way.

By using the sub x=arctan(t).

This led to the integral

(arctan(t))^2/(t^2+a^2), 0 to infinity.

where a = sqrt(2)

This is a fun one to do with contours as well. Even the general case.

Cody

Cody, that’s interesting. So you end up with a semicircular contour that avoids the branch point at $z=i$ by a detour along the positive imaginary axis. You then get that your integral minus another integral (which will look like log^2 something divided by y^2-a^2) is equal to the residue of the integrand at the point $z=i a$. You likely then have to attack that second integral via residues over a keyhole contour about the positive real axis with a bump at the pole $x=a$. Hmm…am I right? Maybe you can show your solution off.

I will send it to you.

Thanks Cody. Do you have a system for formatting the result?

[…] did the case $p=1$ here. The generalization to higher $p$ may involve higher-order derivatives as […]

Great teachers are discovered when their hobby and profession meet.

This seems to be your case. Your performance and experience is simply outstanding.

Sam

Samuel,

You are too kind, but your words are much appreciated.

Best wishes,

Ron