# What purely real analytic techniques are there to evaluate $\int_{-\pi/2}^{\pi/2}\frac{1}{1+\sin^4(x)}\,\mathrm{d}x$?

$$\newcommand{\d}{\,\mathrm{d}}$$Last night, I evaluated the following integral: \begin{align}I:&=\int_{-\pi/2}^{\pi/2}\frac{1}{1+\sin^4(x)}\d x\\&=\int_{-1}^1\frac{1}{(1+x^4)\sqrt{1-x^2}}\d x\\&=\frac{\pi}{2^{3/4}} (\sin(\pi/8)+\cos(\pi/8))\\&=\frac{\pi}{2}\sqrt{1+\sqrt{2}}\end{align}

Using a "double keyhole" (as I phrase it) contour method involving a management of branch cuts and residues at infinity, here. Although I was happy to have succeeded in this, I wondered afterwards if I would have had any hope of evaluating $$I$$ with real analytic technique only.

The challenge:

Evaluate $$I$$ without use of complex analysis or even of complex arithmetic (e.g. for partial fraction decompositions involving $$i$$)

I posed this to some friends and they came up with the following method which I wanted to share with MSE:

\begin{align}I&\overset{x\mapsto\tan x}{=}\int_{-\infty}^\infty\frac{1+x^2}{(1+x^2)^2+x^4}\d x\\&\overset{x\mapsto1/x}{=}2\int_0^\infty\frac{1+x^2}{(1+x^2)^2+1}\d x\\&=2\int_0^\infty\int_0^\infty e^{-t(1+x^2)}\cos(t)\d t\d x\quad\text{Repr. with IBP}\\&=\sqrt{\pi}\int_0^\infty\frac{e^{-t}\cos(t)}{\sqrt{t}}\d t\end{align}

\begin{align}J:&=\int_0^\infty\frac{e^{-t}\cos(t)}{\sqrt{t}}\d t\\J^2&=\int_0^\infty\int_0^\infty\frac{e^{-(t+x)}\cos(t)\cos(x)}{\sqrt{tx}}\d t\d x\\&\overset{x\mapsto tx}{=}\int_0^\infty\int_0^\infty\frac{e^{-t(1+x)}\cos(t)\cos(tx)}{\sqrt{x}}\d x\d t\\&=\frac{1}{2}\int_0^\infty\frac{1}{\sqrt{x}}\cdot\frac{1+x+x^2}{(1+x)(1+x^2)}\d x\\&\overset{x\mapsto x^2}{=}\frac{1}{2}\int_0^\infty\left(\frac{1+x^2}{1+x^4}+\frac{1}{1+x^2}\right)\d x\\&=\frac{1}{2}\left[\frac{\pi}{4}\csc\left(\frac{\pi}{4}\right)+\frac{\pi}{4}\csc\left(\frac{3\pi}{4}\right)+\frac{\pi}{2}\right]\\&=\frac{\pi}{4}(1+\sqrt{2})\end{align}

We conclude:

\begin{align}I&=\sqrt{\pi}\cdot\sqrt{J^2}\\&=\sqrt{\pi}\cdot\sqrt{\frac{\pi}{4}(1+\sqrt{2})}\\&=\frac{\pi}{2}\sqrt{1+\sqrt{2}}\end{align}

Among those who helped me, who use MSE, I credit @TheSimpliFire and @KStarGamer who are much better at real integration than I am!

My question is less of a question and more of a request for a list - a list of other, purely real, methods to attack this integral. I hope the outcome of this will be an interesting selection of advanced integration techniques that I and others can learn from.

Note 1: I am aware of this posting by Quanto but it uses complex numbers.

Note 2: You must expand the cosine product as a sum of cosines and use the same integral representation (which is classically gotten from complex arithmetic but can be done with integration by parts): $$\int_0^\infty e^{-tx}\cos(t)\d t=\frac{x}{x^2+1},\,x\gt0$$

• How about using the double-angle formula to reduce it to $$\int_{-\pi}^{\pi}\frac{2}{\cos^2\theta -2\cos\theta+5}\,\mathrm{d}\theta\quad?$$ Commented Jun 16, 2022 at 17:12
• @SangchulLee Thanks for the response, but I don't immediately see what you used. Did you use $\sin^4(x)=(1-\cos^2(x))^2=1+\cos^4(x)-2\cos(x)=?$ Commented Jun 16, 2022 at 17:14
• I first utilized the double-angle formula $\sin^2\theta=\frac{1}{2}(1-\cos2\theta)$ and then substituted $2\theta\mapsto\theta$. Commented Jun 16, 2022 at 17:20
• I still welcome other answers, despite the acceptance of Quanto’s for its remarkable brevity Commented Jun 17, 2022 at 5:59

Alternatively \begin{align} I=& \int_{0}^{\pi/2}\frac{1}{1+\sin^4x} \overset{t=\sqrt[4]2\tan x} {dx} + \int_{0}^{\pi/2}\frac{1}{1+\cos ^4x} \overset{\sqrt[4]2 t=\tan x} {dx }\\ = &\ \frac{{1+\sqrt2}}{2^{3/4}}\int_0^\infty\frac{1+t^2}{t^4+\sqrt2t^2+1}dt = \frac{{1+\sqrt2}}{2^{3/4}}\int_0^\infty\frac{d(t-\frac1t)}{(t-\frac1t)^2+(2+\sqrt2)}\\ =& \ \frac\pi2 \sqrt{1+\sqrt2}\\ \end{align}

• That is incredible Commented Jun 17, 2022 at 5:58

$$\begin{split} I &= \int_{-\frac \pi 2}^{\frac \pi 2}\sum_{n\geq 0}(-1)^n \sin^{4n}x \,\,dx\\ &= 2\sum_{n\geq 0}(-1)^n \int_{0}^{\frac \pi 2}\sin^{4n}x \,\,dx\\ &= 2\sum_{n\geq 0}(-1)^n \cdot\frac \pi 2 \frac{(4n)!}{2^{4n}((2n)!)^2}\\ &= \pi f\left(-\frac 1 {16}\right)\\ &=\frac \pi 2 \left ( \frac 1 {\sqrt{1-i}} +\frac 1 {\sqrt{1+i}} \right)\\ &= \frac {\pi\sqrt{1+\sqrt 2}}{2} \end{split}$$ where we have used, in order: $$\begin{array}{ll} \text{(1) Used the geometric series expansion of } \frac 1 {1+\sin^4 x}.\\ \text{(2) Interchanged the integral and sum}.\\ \text{(3) Used the known formula for the Wallis integral}.\\ \text{(4) Set }f(z)=\sum_{n\geq 0}\binom{4n}{2n}z^n=\frac 1 2 \left( \frac 1 {\sqrt{1-4\sqrt z}}+ \frac 1 {\sqrt{1+4\sqrt z}} \right )\\ \end{array}$$ To compute $$(4)$$, we used the known formula for the binomial series to obtain: $$g(z) = \sum_{n\geq 0}\binom{2n}{n}z^n=\frac 1 {\sqrt {1-4z}}$$ and then note that $$f(z) = \frac 1 2 \left(g(\sqrt z)+g(-\sqrt z)\right)$$.

• Nice! I tried and failed to find a suitable square root function from a series I obtained when tackling this Commented Jun 17, 2022 at 15:14
• Yeah, I too tend to forget the binomial series. Commented Jun 17, 2022 at 15:15

Using symmetry of sine and letting $$t=\tan x$$ yields $$\begin{array}{l} \displaystyle I=:\int_{-\frac{\pi}{2}}^{\frac{\pi}{2}} \frac{1}{1+\sin ^{4} x} d x=2 \int_{0}^{\frac{\pi}{2}} \frac{\sec ^{4} x}{\sec ^{4} x+\tan ^{4} x} d x =2 \int_{0}^{\infty} \frac{1+t^{2}}{\left(1+t^{2}\right)^{2}+t^{4}} d t \end{array}$$ Dividing both numerator and denominator by $$t^2$$ yields \begin{aligned}I&=\int_{0}^{\infty } \frac{\frac{1+\sqrt{2}}{\sqrt{2}}\left(\sqrt{2}+\frac{1}{t^{2}}\right)+\frac{1-\sqrt{2}}{\sqrt{2}}\left(\sqrt{2}-\frac{1}{t^{2}}\right)}{2 t^{2}+2+\frac{1}{t^{2}}} d t\\& =\frac{1+ \sqrt{2}}{\sqrt{2}} \int_{0}^{\infty} \frac{d\left(\sqrt{2} t-\frac{1}{t}\right)}{\left(\sqrt{2} t-\frac{1}{t}\right)^{2}+2(\sqrt{2}+1)}+\frac{1-\sqrt{2}}{\sqrt{2}} \int_{0}^{\infty} \frac{d\left(\sqrt{2} t+\frac{1}{t}\right)}{\left(\sqrt{2} t+\frac{1}{t}\right)^{2}-2(\sqrt{2}-1)}\\& =\frac{1+\sqrt{2}}{2 \sqrt{\sqrt{2}+1}}\left[\tan ^{-1} \frac{\left(\sqrt{2} t-\frac{1}{t}\right)}{\sqrt{2(\sqrt{2}+1)}}\right]_{0}^{\infty}+\frac{1-\sqrt{2}}{4 \sqrt{\sqrt{2}-1}} \ln \left|\frac{\left.\sqrt{2} t+\frac{1}{t}-\sqrt{2(\sqrt{2}-1}\right) }{\sqrt{2} t+\frac{1}{t}+\sqrt{2}(\sqrt{2}-1}\right|_0^{\infty}\\&= \frac{\pi}{2} \sqrt{1+\sqrt{2}}\end{aligned}

• Very nicely done Commented Jun 19, 2022 at 15:31

Working the antiderivative

Using your first step $$\int \frac{u^2+1}{\left(u^2+1\right)^2+u^4} \,du$$

$$\left(u^2+1\right)^2+u^4=2 \left(u^2-u\sqrt{\sqrt{2}-1} +\frac{1}{\sqrt{2}}\right) \left(u^2+u\sqrt{\sqrt{2}-1} +\frac{1}{\sqrt{2}}\right)$$ Partial fraction decomposition

$$\frac{u^2+1}{\left(u^2+1\right)^2+u^4}=$$ $$\frac 1 {2 \sqrt{2 \left(\sqrt{2}-1\right)} }\Bigg[\frac {\left(\sqrt{2}-2\right) u+2 \sqrt{\sqrt{2}-1} } {2 u^2-2 \sqrt{\sqrt{2}-1} u+\sqrt{2} }+\frac {\left(2-\sqrt{2}\right) u+2 \sqrt{\sqrt{2}-1}} {2 u^2+2 \sqrt{\sqrt{2}-1} u+\sqrt{2} }\Bigg]$$ $$4\int \frac {\left(\sqrt{2}-2\right) u+2 \sqrt{\sqrt{2}-1} } {2 u^2-2 \sqrt{\sqrt{2}-1} u+\sqrt{2} }\,du=$$ $$\left(\sqrt{2}-2\right) \log \left(2 u^2-2 \sqrt{\sqrt{2}-1} u+\sqrt{2}\right)+2 \sqrt{3-2 \sqrt{2}} \left(2+\sqrt{2}\right) \tan ^{-1}\left(\frac{2 u-\sqrt{\sqrt{2}-1}}{\sqrt{1+\sqrt{2}}}\right)$$ $$4\int\frac {\left(2-\sqrt{2}\right) u+2 \sqrt{\sqrt{2}-1}} {2 u^2+2 \sqrt{\sqrt{2}-1} u+\sqrt{2} }\,du$$ $$2 \sqrt{3-2 \sqrt{2}} \left(2+\sqrt{2}\right) \tan ^{-1}\left(\frac{2 u+\sqrt{\sqrt{2}-1}}{\sqrt{1+\sqrt{2}}}\right)-\left(\sqrt{2}-2\right) \log \left(2 u^2+2 \sqrt{\sqrt{2}-1} u+\sqrt{2}\right)$$

$$\color{red}{8 \sqrt{2 \left(\sqrt{2}-1\right)} \int \frac{u^2+1}{\left(u^2+1\right)^2+u^4} \,du=}$$ $$\color{red}{-2 \sqrt{2} \tan ^{-1}\left(\frac{2 \sqrt{\sqrt{2}-1} u}{2 \left(\sqrt{2}-1\right) u^2+\sqrt{2}-2}\right)-\left(2-\sqrt{2}\right) \log \left(\frac{2 u \left(u-\sqrt{\sqrt{2}-1}\right)+\sqrt{2}}{2 u \left(u+\sqrt{\sqrt{2}-1}\right)+\sqrt{2}}\right)}$$ gives the desired result.

• Incredible to arrive at an antiderivative without too much trouble, I will study this closely Commented Jun 17, 2022 at 12:00
• May I ask what is the general technique of finding that quartic factorisation? Commented Jun 17, 2022 at 12:02
• You could find the factorization by factoring the quadratic in $u^2$, factor those into linear complex forms, then combine the conjugates. Um. :/ Commented Jun 17, 2022 at 12:06
• @FShrike. Without too much trouble, not sure but a lot of patience, for sure. In fact, the problem is very simple if you accept complex numbers since the antiderivative is "just" $$\frac{\tan ^{-1}\left(\sqrt{1-i} \tan (x)\right)}{2 \sqrt{1-i}}+\frac{\tan ^{-1}\left(\sqrt{1+i} \tan (x)\right)}{2 \sqrt{1+i}}$$ Commented Jun 17, 2022 at 12:13
• Ah yes, I don’t claim it was easy (I would never thought of it) but I was expecting the antiderivative to be a bit more monstrous! And I do accept complex numbers really, I love complex analysis, I just think I need to improve on my ability to integrate so I occasionally ask for these alternatives-questions Commented Jun 17, 2022 at 15:13