Skip to the Main Content

Note:These pages make extensive use of the latest XHTML and CSS Standards. They ought to look great in any standards-compliant modern browser. Unfortunately, they will probably look horrible in older browsers, like Netscape 4.x and IE 4.x. Moreover, many posts use MathML, which is, currently only supported in Mozilla. My best suggestion (and you will thank me when surfing an ever-increasing number of sites on the web which have been crafted to use the new standards) is to upgrade to the latest version of your browser. If that's not possible, consider moving to the Standards-compliant and open-source Mozilla browser.

January 4, 2023

A Curious Integral

Posted by John Baez

On Mathstodon, Robin Houston pointed out a video where Oded Margalit claimed that it’s an open problem why this integral:

0 cos(2x) n=1 cos(xn)dx \displaystyle{ \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x }

is so absurdly close to π8\frac{\pi}{8}, but not quite equal.

They agree to 41 decimal places, but they’re not the same!

0 cos(2x) n=1 cos(xn)dx = 0.3926990816987241548078304229099378605246454... π8 = 0.3926990816987241548078304229099378605246461... \begin{array}{rcl} \displaystyle{ \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n}\right) d x } &=& 0.3926990816987241548078304229099378605246454... \\ \\ \displaystyle{\frac\pi8} &=& 0.3926990816987241548078304229099378605246461... \\ \end{array}

So, a bunch of us tried to figure out what was going on.

Jaded nonmathematicians told us it’s just a coincidence, so what is there to explain? But of course an agreement this close is unlikely to be “just a coincidence”. It might be, but you’ll never get anywhere in math with that attitude.

We were reminded of the famous cosine Borwein integral

0 2cos(x) n=0 Nsin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{N} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

which equals π2\frac{\pi}{2} for NN up to and including 55, but not for any larger NN:

0 2cos(x) n=0 56sin(x/(2n+1))x/(2n+1)dxπ22.332410 138 \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{56} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x \; \; \approx \;\; \frac{\pi}{2} - 2.3324 \cdot 10^{-138} }

But it was Sean O who really cracked the case, by showing that the integral we were struggling with could actually be reduced to an N=N = \infty version of the cosine Borwein integral, namely

0 2cos(x) n=0 sin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{\infty} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

The point is this. A little calculation using the Weierstrass factorizations

sinxx= n=1 (1x 2π 2n 2) \frac{\sin x}{x} = \prod_{n = 1}^\infty \left( 1 - \frac{x^2}{\pi^2 n^2} \right)

cosx= n=0 (14x 2π 2(2n+1) 2) \cos x = \prod_{n = 0}^\infty \left( 1 - \frac{4x^2}{\pi^2 (2n+1)^2} \right)

lets you show

n=1 cos(xn)= n=0 sin(2x/(2n+1))2x/(2n+1) \prod_{n = 1}^\infty \cos\left(\frac{x}{n}\right) = \prod_{n = 0}^\infty \frac{\sin (2x/(2n+1))}{2x/(2n+1)}

and thus

0 cos(2x) n=1 cos(xn)dx= 0 cos(2x) n=0 sin(2x/(2n+1))2x/(2n+1)dx \displaystyle{ \int_0^\infty \cos(2x) \prod_{n=1}^\infty \cos\left(\frac{x}{n} \right) \; d x } = \displaystyle{ \int_0^\infty\cos(2x) \prod_{n = 0}^\infty \frac{\sin (2x/(2n+1))}{2x/(2n+1)} d x }

Then, a change of variables on the right-hand side gives

0 cos(2x) n=1 cos(xn)dx=14 0 2cos(x) n=0 sin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty \cos(2x) \prod_{n=1}^\infty \cos\left(\frac{x}{n} \right) \; d x } = \frac{1}{4} \displaystyle{ \int_0^\infty 2\cos(x) \prod_{n = 0}^\infty \frac{\sin (x/(2n+1))}{x/(2n+1)} d x }

So, showing that

0 cos(2x) n=1 cos(xn)dx \displaystyle{ \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x }

is microscopically less than π8\frac{\pi}{8} is equivalent to showing that

0 2cos(x) n=0 sin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2\cos(x) \prod_{n = 0}^\infty \frac{\sin (x/(2n+1))}{x/(2n+1)} d x }

is microscopically less than π2\frac{\pi}{2}.

This sets up a clear strategy for solving the mystery! People understand why the cosine Borwein integral

0 2cos(x) n=0 Nsin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{N} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

equals π2\frac{\pi}{2} for NN up to 5555, and then drops ever so slightly below π2\frac{\pi}{2}. The mechanism is clear once you watch the right sort of movie. It’s very visual. Greg Egan explains it here with an animation, based on ideas by Hanspeter Schmid:

Or you can watch this video, which covers a simpler but related example:

So, we just need to show that as N+N \to +\infty, the value of the cosine Borwein integral doesn’t drop much more! It drops by just a tiny amount: about 7×10 437 \times 10^{-43}.

Alas, this doesn’t seem easy to show. At least I don’t know how to do it yet. But what had seemed an utter mystery has now become a chore in analysis: estimating how much

0 2cos(x) n=0 Nsin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{N} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

drops each time you increase NN a bit.

At this point if you’re sufficiently erudite you are probably screaming: “BUT THIS IS ALL WELL-KNOWN!”

And you’re right! We had a lot of fun discovering this stuff, but it was not new. When I was posting about it on MathOverflow, I ran into an article that mentions a discussion of this stuff:

and it turns out Borwein and his friends had already studied it. There’s a little bit here:

and a lot more in this book:

  • J. M. Borwein, D. H. Bailey and R. Girgensohn, Experimentation in Mathematics: Computational Paths to Discovery, Wellesley, Massachusetts, A K Peters, 2004.

In fact the integral

0 2cos(x) n=0 sin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos(x) \prod_{n = 0}^{\infty} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

was discovered by Bernard Mares at the age of 17. Apparently he posed the challenge of proving that it was less than π4\frac{\pi}{4}. Borwein and others dived into this and figured out how.

But there is still work left to do!

As far as I can tell, the known proofs that

π8 0 cos(2x) n=1 cos(xn)dx7.407310 43 \displaystyle{ \frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x } \; \approx \; 7.4073 \cdot 10^{-43}

all involve a lot of brute-force calculation. Is there a more conceptual way to understand this difference, at least approximately? There is a clear conceptual proof that

π8 0 cos(2x) n=1 cos(xn)dx>0 \displaystyle{ \frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x } \;\; > \;\; 0

That’s what Greg Egan explained in my blog article. But can we get a clear proof that

π8 0 cos(2x) n=1 cos(xn)dx<C \displaystyle{ \frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x } \; \; &lt; \; \; C

for some small constant CC, say 10 4010^{-40} or so?

One can argue that until we do, Oded Margalit is right: there’s an open problem here. Not a problem in proving that something is true. A problem in understanding why it is true.

Posted at January 4, 2023 4:26 PM UTC

TrackBack URL for this Entry:   https://golem.ph.utexas.edu/cgi-bin/MT-3.0/dxy-tb.fcgi/3437

14 Comments & 0 Trackbacks

Re: A Curious Integral

This is really interesting result! There’s a recent video (2 months ago) from 3Blue1Brown that talks about the Borwein Integrals, and a friend had this problem in a class too.

I also want to comment that these is a typo in the equality (it misses a 2 in the denominator), it should be like this: n=1 cos(xn)= n=1 sin(2x/(2n+1)2x/(2n+1)\prod_{n=1}^\infty \cos \left( \frac{x}{n} \right) = \prod_{n=1}^\infty\frac{ \sin(2x/(2n+1)}{2x/(2n+1)}

Posted by: Luis Palacios on January 7, 2023 5:46 AM | Permalink | Reply to this

Re: A Curious Integral

Thanks for catching that typo, which also affected the next line! I think I’ve fixed everything now.

My blog article mentioned the video you’re talking about. It’s a great way to start understanding these Borwein integrals, though it focuses on this simpler one:

0 n=0 Nsin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty \prod_{n = 0}^{N} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

which equals π2\frac{\pi}{2} until N=6N = 6, rather than the ‘cosine’ Borwein integral

0 2cosx n=0 Nsin(x/(2n+1))x/(2n+1)dx \displaystyle{ \int_0^\infty 2 \cos x \prod_{n = 0}^{N} \frac{\sin (x/(2n+1))}{x/(2n+1)} \, d x}

which equals π2\frac{\pi}{2} until N=55N = 55. Greg Egan’s explanation on my blog article covers both:

Posted by: John Baez on January 7, 2023 10:19 PM | Permalink | Reply to this

Re: A Curious Integral

I don’t think your blog article mentioned the 3Blue1Brown video, but I mentioned it in a comment below your blog article.

Posted by: Todd Trimble on January 16, 2023 11:22 PM | Permalink | Reply to this

Re: A Curious Integral

I see the confusion now. There are two blog articles in play here: the current one, and the one you linked to which is also called “my blog article”.

Posted by: Todd Trimble on January 17, 2023 1:51 AM | Permalink | Reply to this

Re: A Curious Integral

I too got a little carried away by this integral and just wanted to share this slightly more ‘intuitive’ perspective:

By thinking about the integral in the Fourier domain it can quite elegantly be related to the “harmonic random walk” or “random harmonic series”, i.e. a harmonic series with random signs. Such a series converges almost surely. The integral discussed here is equal to the probability density that the random harmonic series sums to 2, up to a factor pi due to Fourier.

The simpler integral without the cos(2x) is almost pi/4, which can be related to the probability (density) that a harmonic random walk returns to the origin.

See https://thatsmaths.com/2016/07/28/random-harmonic-series/ or Schmuland, Byron, 2003: Random Harmonic Series, Amer. Math. Monthly, 110, 407–416 for a (visual) explanation. It’s very reminiscent of the Borwein integrals, boiling down to a repeated convolution of ‘moving averages’ with harmonically shrinking (odd) width. The paper discusses a successive approximation in which the value doesn’t drop below 1/8 until the 56th step, just like the approach via Borwein.

The paper also argues that the tail of the convolutions is approximately normal using the central limit theorem. This can be used to approximate the deviation from 1/8, though I don’t think it can be used as a rigorous upper bound. With the first order approximation I got a deviation of 1e-14 (pi) below 1/8 (pi).

The deviation from 1/8 is related to the probability mass in the tails of the first-order residual pdf (which is approximately normal), so if anyone can figure out a way to quantify how much of the probability mass is moved past a certain value by the repeated moving average process, that should give you a bound on the deviation.

Posted by: T on January 7, 2023 7:48 PM | Permalink | Reply to this

Re: A Curious Integral

I don’t have the stomach to work out proper normalizations in Fourier transforms, but here’s a sketch of a possible related perspective.

Writing sinc(x)=sinxxsinc (x) = \frac{sin x}{x}, 0 2cos(x) n=0 sinc(x/(2n+1))dx= cos(x) n=0 sinc(x/(2n+1))dx \int_0^\infty 2 cos(x) \prod_{n=0}^\infty sinc(x/(2n+1)) d x = \int_{-\infty}^\infty cos(x) \prod_{n=0}^\infty sinc(x/(2n+1)) d x is the inverse Fourier transform (for some convention on the constants), evaluated at 11, of n=0 sinc(x/(2n+1))\prod_{n=0}^\infty sinc(x/(2n+1)). Hence, up to some constants somewhere, it’s the infinite convolution χ 1*χ 1/3*χ 1/5* \chi_1 \ast \chi_{1/3} \ast \chi_{1/5} \ast \cdots evaluated at 1, where χ a\chi_a is the normalized indicator function of [a,a][-a,a], i.e., the density of a uniform random variable U aU_a in [a,a][-a,a]. Breaking off that first factor in the convolution, this is equal to the probability that U 1/3+U 1/5+ U_{1/3} + U_{1/5} + \cdots lies in [0,2][0,2] (i.e., within distance 1 of 1), for independent uniform random variables U 1/3U_{1/3} etc. By symmetry this is in turn half the probability that the same sum lies in [2,2][-2,2].

The tail probabilities for U 1/3+U 1/5+U_{1/3} + U_{1/5} + \cdots can be bounded, for example, using Hoeffding’s inequality.

Now maybe if you carefully include the right constants in the right places, the correct version of what I just wrote would actually end up saying that π2 0 2cos(x) n=0 sinc(x/(2n+1))dx \frac{\pi}{2} - \int_0^\infty 2 cos(x) \prod_{n=0}^\infty sinc(x/(2n+1)) d x is some constant multiple of the probability that |U 1/3+U 1/5+|C| U_{1/3} + U_{1/5} + \cdots | \ge C for some explicit constant CC, and that this probability is very small thanks to Hoeffding or related tail bounds.

But as I said, I don’t have the stomach, or the time right now, to get all those constants correct and check if this actually works.

Posted by: Mark Meckes on January 10, 2023 3:43 AM | Permalink | Reply to this

Re: A Curious Integral

Your convolution approach is the usual approach for thinking about Borwein integrals. So if I had a good way to bound the tails I could probably fight my way through the normalizations, especially with the help of some friends. I’ll check out Hoeffding’s inequality.

The paper by Schmuland mentioned above has a nice application of this idea.

Add up the series

± 1 ± ½ ± ⅓ ± ¼ ± ⅕ ± ⅙ ± …

where you flip independent fair coins to choose each sign. The sum converges almost surely. Graph the probability density of the results. You can get a nice-looking function. The value of this function at 2 is close to 1/8. Unfortunately, it’s closer to

0.124999999999999999999999999999999999999999764... 0.124999999999999999999999999999999999999999764...

Posted by: John Baez on January 12, 2023 7:01 PM | Permalink | Reply to this

Re: A Curious Integral

Yes, I recall that convolution approach from your earlier post. The aspect that is maybe new in my suggestion is the bit about splitting off one of the convolution factors in order to turn the integral into a probability (of an event) as opposed to a probability density. At least with the toolbox that I’m used to working with, estimates for probabilities are less delicate to deal with than densities.

Posted by: Mark Meckes on January 13, 2023 1:47 AM | Permalink | Reply to this

Re: A Curious Integral

Actually my “maybe new” idea appears in section 6 of Schmuland’s paper, attributed to unpublished work of Kent Morrison. Morrison used that idea to give a proof that the value of that density at 2 is strictly less than 1/8. Still, maybe my suggestion of using something like Hoeffding’s inequality can be used to bound the difference.

In fact Hoeffding’s inequality appears implicitly in Schmuland’s paper, though applied to the coin flips rather than the uniform random variables. It’s the tail inequality on the second page, deduced by combining Markov’s inequality with an estimate on the exponential moments.

Another nice bit in that paper is the probabilistic argument to get from coin flips to uniform random variables, which to my taste does a much better job of explaining what’s “really going on” than using Weierstrass factorizations to get from the product of cosines to the product of sincs.

Posted by: Mark Meckes on January 13, 2023 4:52 PM | Permalink | Reply to this

Re: A Curious Integral

Okay, here we go. Just taking things from the Schmuland paper I can avoid thinking about normalizations in Fourier transforms. Morrison’s argument which I more or less rediscovered shows that the constant which turns out to be close to 1/81/8 is actually equal to α=Prob[|R|<4]/8, \alpha = Prob[ |R| \lt 4 ] / 8, where R=U 1+U 2+, R = U_1 + U_2 + \cdots, with U jU_j independent uniform random variables in [2/(2j+1),2/(2j+1)][-2/(2j+1), 2/(2j+1)]. (Here I’m switching from my notation above to Schmuland’s.)

The fact that α<1/8\alpha \lt 1/8 follows from the fact that the probability is <1\lt 1. Hoeffding’s inequality does indeed show that the probability is very close to 11, and so α\alpha is very close to 1/81/8, although it doesn’t capture just how close it is. This isn’t surprising, though, since Hoeffding’s inequality is usually not sharp in terms of precise constants. We could probably do better with, say, Bennet’s inequality.

But in any case, I personally feel like this solves Oded Margalit’s problem: the original integral is close to π/8\pi/8 because this random variable RR is extremely likely to be in the interval [4,4][-4,4].

Here’s the Hoeffding argument: Hoeffding’s inequality implies that Prob[|R|4]2exp[32 j=1 (42j+1) 2]. Prob[|R| \ge 4] \le 2 exp \left[- \frac{32}{\sum_{j=1}^\infty \left(\frac{4}{2j+1}\right)^2}\right].

If I did the algebra right to reduce it to knowing the value of k=1 1k 2=π6\sum_{k=1}^\infty \frac{1}{k^2} = \frac{\pi}{6}, then j=1 1(2j+1) 2=π 281\sum_{j=1}^\infty \frac{1}{(2j+1)^2} = \frac{\pi^2}{8} - 1, and we end up with Prob[|R|4]0.0004, Prob [ |R| \ge 4 ] \le 0.0004, so Prob[|R|<4]0.9996. Prob[|R| \lt 4] \ge 0.9996.

Posted by: Mark Meckes on January 13, 2023 5:33 PM | Permalink | Reply to this

Re: A Curious Integral

This is great! I didn’t really follow your argument at all, at first, but now that I read about Hoeffding’s inequality it’s slowly starting to make sense.

But anyway, you seem to have cracked the puzzle! If I understand correctly, by showing

Prob[|R|4]0.0004 Prob[|R|\ge 4] \; \le \; 0.0004

you have shown that

π8 0 cos(2x) n=1 cos(xn)dx<0.0004π8 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 0.0004 \cdot \frac{\pi}{8} }

or

π8 0 cos(2x) n=1 cos(xn)dx<0.00016 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 0.00016 }

I may try to sort out the details (for my own education) and mention your discovery on Wikipedia, where I’ve already spent a bit of time adding a new section to their article on Borwein integrals.

There are still challenges remaining for anyone who loves analysis! First, come up with a human-understandable argument that

π8 0 cos(2x) n=1 cos(xn)dx<10 10 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 10^{-10}}

Then come up with one that shows

π8 0 cos(2x) n=1 cos(xn)dx<10 20 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 10^{-20}}

Then come up with one that shows

π8 0 cos(2x) n=1 cos(xn)dx<10 30 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 10^{-30}}

And then come up with one that shows

π8 0 cos(2x) n=1 cos(xn)dx<10 40 \displaystyle{\frac{\pi}{8} - \int_0^\infty\cos(2x)\prod_{n=1}^\infty\cos\left(\frac{x}{n} \right) d x \; \lt \; 10^{-40}}

Posted by: John Baez on January 17, 2023 5:20 PM | Permalink | Reply to this

Re: A Curious Integral

Hi John, Mark,

First of all, Mark, excellent work with Hoeffding’s, that’s indeed an elegant and easy bound on the deviation.

I don’t know if you’re still interested, but I think I may have found a way to beat your original challenge of finding an absolutely tiny bound!

We can do much better than Hoeffdings on the tail distribution of R, by using the Chernoff bound. Here it is:

log(δ/2)inf t>0[at+ n{3,5,7,...}log(sinh(t/n)t/n)] \displaystyle{\log(\delta/2) \le \inf_{t \gt 0} \left[-a t + \sum_{n \in \{3, 5, 7, ...\} } \log \left(\frac{\sinh(t / n)}{t / n}\right)\right]}

(I’ve used the half-wide uniform variables, i.e (1/n,1/n)(-1/n, 1/n), which would be R/2 in Schmuland)

The π/8\pi/8 deviation can be found with a=2a = 2, and the π/4\pi/4 at a=1a = 1.

Although not quite as clean as the Hoeffding bound I would argue it is still way simpler than numerical integration or convolution, requiring only numerical minimization of a very smooth function; the summation converges quite well because log(sinh(x)/x)\log(\sinh(x)/x) is O(x 2)O(x^2).

The value we get (if I haven’t made any errors, please check for yourself) is about 4.7e-41 (!!) (for n up to 10,000,000 - an increase of less than 0.01e-41 from 1,000,000 - t is about 197.7; the bound is monotonic in n), very close to listed value of 1.882e-42 I see on Wikipedia.

(For the π/4\pi/4 I have 0.0001981 vs 0.00002241 at t~25 - so both about a factor 10 slack.)

We may do even better: according to the following paper, we get an extra halving on the bound just because RR is decreasing - see the final lemma in Halving the bounds for the Markov, Chebyshev, and Chernoff Inequalities using smoothing by Mark Huber. That would bring it down to ~2.4e-41.

I’m curious to know what you think,

Regards,

Posted by: T on January 17, 2023 7:36 PM | Permalink | Reply to this

Re: A Curious Integral

Just to be clear, the values I mentioned would still need to be multiplied by π/8\pi/8 (or π/4\pi/4 resp.) so the current bound for the π/8\pi/8 integral would be C ~ 9.4e-42

(cf. 7.4e-43 at http://oeis.org/A091494).

Posted by: T on January 17, 2023 7:58 PM | Permalink | Reply to this

Re: A Curious Integral

I’m not going to take the time to check the arithmetic, but yes, this is exactly the right way to do better.

Hoeffding’s inequality itself is actually proved using a Chernoff bound. The proof of Hoeffding basic makes a particular choice to tt in the bound as you wrote it. That choice, and hence Hoeffding’s inequality, yields good results when the random summands are of comparable size to each other.

In this setting, where the bounds on the sizes shrink to 00, it’s usually better to use Bernstein’s inequality, Bennett’s inequality (both of which are also proved by the Chernoff method, with different choices of tt), or work directly with the Chernoff bound as you do.

I just used the Hoeffding bound because it’s the simplest one to apply and gave a good enough answer to be a proof of concept.

Posted by: Mark Meckes on January 17, 2023 10:31 PM | Permalink | Reply to this

Post a New Comment