## September 3, 2020

### Chasing the Tail of the Gaussian (Part 2)

#### Posted by John Baez

Last time we began working on a puzzle by Ramanujan. This time we’ll solve it — with some help from a paper Jacobi wrote in Latin, and also from my friend Leo Stein on Twitter!

In 1914 Ramanujan posed this problem to the readers of The Journal of the Indian Mathematical Society:

Prove that

$\left(\frac{1}{1} + \frac{1}{1 \cdot 3} + \frac{1}{1 \cdot 3 \cdot 5} + \cdots\right) \; + \; \frac{1}{1 + \frac{1}{1 + \frac{2}{1 + \frac{3}{1 + \frac{4}{1 + \frac{5}{1 + \ddots}}}}}} = \sqrt{\frac{\pi e}{2}}$

We can reduce this to two separate sub-puzzles. First, prove this:

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

Second, prove this:

$\frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \frac{5}{x + \ddots}}}}}} = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

You could say these concern the ‘body’ and the ‘tail’ of the Gaussian, respectively. Setting $x = 1$ and adding these two equations we get the answer to Ramanujan’s problem.

I did the first sub-puzzle last time. Now we’ll do the second one! But it’s good to compare them first.

If we were handed the two sub-puzzles separately, a quick way to do the first would be to notice that

$f(x) = e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

obeys this differential equation:

$f'(x) = x f(x) + 1$

We can solve this equation using power series and get

$f(x) = x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots$

I did this last time, except working in the other direction, starting from the power series.

To tackle the second sub-puzzle, we could note that

$g(x) = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

obeys a very similar differential equation:

$g'(x) = x g(x) - 1$

If we could solve this using continued fractions, maybe we’d be done.

Unfortunately I never learned how to solve differential equations using continued fractions! So I soon gave up and looked around.

Hardy got a version of the second sub-puzzle in his first letter from Ramanujan. He wasn’t too impressed by this one: he thought it seemed vaguely familiar, and he later wrote:

…. it is a formula of Laplace first proved properly by Jacobi.

David Roberts found the original references. It turns out Laplace solved this problem in Equation 8359 of Book 10 of his Traité de Mécanique Céleste. In fact he was in the midst of estimating the refraction caused by the Earth’s atmosphere. It’s nice to see this stuff showing up in a practical context! Unfortunately Laplace does the calculation instantaneously, with scarcely a word of explanation. So I turned to Jacobi:

Despite being in Latin and full of algebra mistakes, I thought this was one of the most exciting papers I’ve read in quite a while. For one things, it’s just 2 pages long.

I explained how this method works… but then Leo Stein figured out how to simplify it a lot. So let me give his simplified method.

We want to write

$g(x) = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

as a continued fraction. We differentiate $g$ and easily note that

$g'(x) = x g(x) - 1$

But next we do something sneaky: we keep on differentiating $g$, as if we were trying to work out its Taylor series. Let’s see what happens:

$\begin{array}{ccl} g''(x) &=& x g'(x) + g(x) \\ \\ g\!'''(x) &=& x g''(x) + 2 g'(x) \\ \\ g^{(4)}(x) &=& x g\!'''(x) + 3 g''(x) \end{array}$

We notice a recurrence relation, which is easy to prove inductively:

$g^{(n+2)} = x g^{(n+1)} + (n+1) g^{(n)} \qquad \text{for} \; n \ge 0$

Basically, the plan is now to write the original function $g$ in terms of $g'$ and $g''$, and then use this equation to rewrite those in terms of $g''$ and $g'''$, and so on ad infinitum, getting a continued fraction for $g$.

It’s like solution by indefinite postponement!

But to get a continued fraction, let’s take our recurrence relation and divide it by $g^{(n+1)}$ we get

$\frac{g^{(n+2)}}{g^{(n+1)}} = x + (n+1) \frac{g^{(n)}}{g^{(n+1)}} \qquad \text{for} \; n \ge 0$

This looks simpler in terms of the ratios

$r_n = \frac{g^{(n+1)}}{g^{(n)}}$

Indeed, it becomes this:

$r_{n+1} = x + \frac{(n+1)}{r_n}$

or solving for $r_n$, this:

$r_n = \frac{n+1}{-x + r_{n+1}} \qquad \text{for} \; n \ge 0 \qquad \qquad \spadesuit$

In this notation, our original equation $g' = x g - 1$ gets a similar look:

$g = \frac{1}{x - r_0}$

Starting from here, and repeatedly using $\spadesuit$, we get

$\begin{array}{ccl} g &=& \frac{1}{x - r_0} \\ \\ &=& \frac{1}{x - \frac{1}{-x + r_1}} \\ \\ &=& \frac{1}{x - \frac{1}{-x + \frac{2}{-x + r_2}}} \\ \\ &=& \frac{1}{x - \frac{1}{-x + \frac{2}{-x + \frac{3}{-x + r_3}}}} \end{array}$

and so on. If we’re allowed to go on forever, we get

$g = \frac{1}{x - \frac{1}{-x + \frac{2}{-x + \frac{3}{-x + \frac{4}{-x + \ddots}}}}}$

A bit of algebra gives

$g = \frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \ddots}}}}}$

or in other words:

$e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t = \frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \ddots}}}}}$

And so we’re done!

There seems to be something ‘coalgebraic’ or ‘coinductive’ going on here: underneath all the trickery, we are solving for the function at left by writing it in terms of its derivative, and writing that in terms of its derivative, and going on forever… until we get the answer! There’s a deep connection between continued fractions and coalgebra, so this would be nice to explore further.

Of course we need to check that the limiting procedure is valid. But since we obtained the infinite continued fraction from a sequence of fractions that are all equal, that shouldn’t be too hard.

I’m left with a sense of fascination and a deep unease. I need to learn more about solving differential equations using continued fractions, to feel I better understand these tricks. This book seems really good to start with: down-to-earth, with a sense of humor too:

• Lisa Lorentzen and Haakon Waadeland, Continued Fractions with Applications, North Holland, 1992.

By the way, I seem to have found some errors in Jacobi’s paper De fractione continua, in quam integrale $\int_x^\infty e^{-x x} d x$ evolvere licet. It’s a bit late to point them out, but here they are:

1) In Equation (7), $y_n = y_{n+1} + (n+1)y_{n+2}$ should be $y_n = y_{n+1} + q(n+1)y_{n+2}$.

2) Also in Equation (7), $1 = y_1 + q y^2$ should be $1 = y_1 + q y_2$. In fact he never uses a superscript 2 to mean squaring — you can see this from his title.

3) At the top of the second page, right after Equation (7)

$\frac{1}{y_1} = q + \frac{y_2}{y_1}$

should be

$\frac{1}{y_1} = 1 + \frac{q y_2}{y_1}$

This mistake continues in all the equations on that line.

4) As a result of the previous mistake, his Equation (8):

$\frac{1}{y_1} = q + \frac{1}{1 + \frac{2q}{1 + \frac{3q}{\ddots}}}$

should be

$\frac{1}{y_1} = 1 + \frac{1}{1 + \frac{q}{1 + \frac{2q}{1 + \frac{3q}{\ddots}}}}$

which is more beautiful as well as being correct. But when he gets to the final result, which he states at the start of the paper, this mistake mysteriously evaporates!

Posted at September 3, 2020 6:57 PM UTC

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

### Re: Chasing the Tail of the Gaussian (Part 2)

his $y_{n+1}$ is my $y_n$

Ah. That’s why there’s an “Extra” $x$. Or a missing $\frac{-1}{n+1}$. You’re indexing by derivatives of $g$, while Jacobi is indexing by powers of $x$.

Not that thus effervesces the mystery, for it doesn’t…

Let me channel my inner Pooh. The primary reason for being multiplied by $\frac{a^n}{n!}$ that I know of is for Summing a Taylor Series.

$\sum t^n y_n = x \sum \frac{(-t x)^n}{n!} g^{(n)}(x) = x g((1-t)x)$

And I don’t know that that helps you much either, but it’s the naturalest thing I could think of.

Posted by: Jesse McKeown on September 3, 2020 11:06 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

The Taylor series idea is very plausible, and there must be something to it. But note that Jacobi is not dealing with

$\frac{t^n}{n!} g^{(n)}(x)$

as would be reasonable for computing

$g(x+t) = \sum_{n = 0}^\infty \frac{t^n}{n!} g^{(n)}(x)$

He’s dealing with something more like

$\frac{x^n}{n!} g^{(n)}(x)$

This would show up if you were computing

$g(2x) = \sum_{n = 0}^\infty \frac{x^n}{n!} g^{(n)}(x)$

In fact to be honest he’s actually dealing with something more like

$\frac{(-x)^n}{n!} g^{(n)}(x)$

This would show up if you were computing

$g(0) = \sum_{n = 0}^\infty \frac{(-x)^n}{n!} g^{(n)}(x)$

In fact to be really honest he’s dealing with

$(-1)^n 2 x^{n+1} g^{(n)}(x)$

The extra power of $x$ is what really bugs me. This would show up if you were computing

$-2x g(0) = \sum_{n = 0}^\infty \frac{(-1)^n 2 x^{n+1}}{n!} g^{(n)}(x)$

Posted by: John Baez on September 3, 2020 11:58 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

“Let me channel my inner Pooh.”

Referencing perhaps Benjamin Hoff’s The Tao of Pooh. (He wrote a sequel, The Te of Piglet, which for deep and deeply personal reasons is a more attractive premise for me, but which is perhaps not as fine a book as its predecessor.)

On a slightly different line, it won’t have escaped John’s notice that $e^{x^2/2}$ is the exponential generating function for the sequence $a_n$ where $a_n$ counts the number of ways of partitioning a set of $n$ elements into $n/2$ 2-element sets, or the number of fixed-point free involutions on an $n$-element set, or the number of different simultaneous handshake configurations at a party of $n$ people. I say this particularly in view of the Baez-Dolan paper From Finite Sets to Finite Diagrams. I don’t know the quantum physics where I can fake being fluent, but [mutter mutter] something about free non-interacting particles.

Posted by: Todd Trimble on September 4, 2020 1:23 AM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

All the stuff about species and Feynman diagrams in quantum field theory is deeply connected to integrals of polynomials multiplied by a Gaussian, so I was delighted when proving

$\left(\frac{1}{1} + \frac{1}{1 \cdot 3} + \frac{1}{1 \cdot 3 \cdot 5} + \cdots\right) \; + \; \frac{1}{1 + \frac{1}{1 + \frac{2}{1 + \frac{3}{1 + \frac{4}{1 + \frac{5}{1 + \ddots}}}}}} = \sqrt{\frac{\pi e}{2}}$

turned out to be all about doing integrals of characteristic functions multiplied by a Gaussian!

The infinite sum really should have a species interpretation, since it comes from this formula:

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

The continued fraction is not something I associate with quantum field theory or species, but there are systematic ways to turn power series into continued fractions and vice versa, so there could be something interesting to discover here.

Posted by: John Baez on September 4, 2020 6:56 AM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

John, you say

$\frac{1}{y_1} = 1 + \frac{1}{1 + \frac{q}{1 + \frac{2q}{1 + \frac{3q}{\ddots}}}}.$

Given David’s record of connecting bits of things that have appeared at the Café, I’m a little surprised that he hasn’t already pointed out that a similar looking continued fraction was in a post of mine from three years ago: Lattice Paths and Continued Fractions II.

I derived a continued fraction expansion of the generating function of the odd double factorials, where the $m$th double factorial $m!!$ is $m (m-2) (m-4) \dots$.

$\sum_{n=0}^\infty (2n -1)!!\, t^{2n} = \frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\dots }}}}$

I said that I thought this was originally due to Gauss.

Posted by: Simon Willerton on September 4, 2020 1:49 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

In contrast to your

$\left(\frac{1}{1} + \frac{1}{1 \cdot 3} + \frac{1}{1 \cdot 3 \cdot 5} + \cdots\right) \; + \; \frac{1}{1 + \frac{1}{1 + \frac{2}{1 + \frac{3}{1 + \frac{4}{1 + \frac{5}{1 + \ddots}}}}}} = \sqrt{\frac{\pi e}{2}}$

in this case, taking liberties, by taking $t=1$, we get

$\left({1} + {1 \cdot 3} + {1 \cdot 3 \cdot 5} + \cdots\right) \; - \; \frac{1}{1 - \frac{1}{1 - \frac{2}{1 - \frac{3}{1 - \frac{4}{1 - \frac{5}{1 - \ddots}}}}}} = -1,$

where the right hand side comes from the $n=0$ term in the sum, with $(-1)!! = 1$.

Posted by: Simon Willerton on September 4, 2020 3:11 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

Must have missed that one. Bad timing, a late September posting, with the academic year beginning.

Seeing you write about Motzkhin paths there, reminds of a much earlier conversations about species, alluded to here. Now, this feels like a very long time ago.

Posted by: David Corfield on September 4, 2020 3:25 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

Hi, Simon!

Given David’s record of connecting bits of things that have appeared at the Café, I’m a little surprised that he hasn’t already pointed out that a similar looking continued fraction was in a post of mine from three years ago.

So you’re surprised that someone else didn’t point out a three-year-old post of yours before you did? I think you’re getting spoiled!

It would be interesting if Gauss knew

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = \frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\ddots }}}}$

It’s really easy to show

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

but I’m pretty sure the same style of argument that Jacobi used to show

$\frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \frac{5}{x + \ddots}}}}}} = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

can used to give a continued fraction expansion of

$e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

because they obey almost the same differential equation (as noted in my post here), and the differential equation is what leads to the continued fraction expansion. So I bet the argument in my post can be adapted to show

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = \frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\ddots }}}}$

Conversely, Gauss should have easily been able to show

$\frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \frac{5}{x + \ddots}}}}}} = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

before Jacobi did it in 1834. Maybe he just didn’t get around to it, or didn’t bother publishing it. Gauss’ main work on continued fractions seems to date to 1813.

I will have to reread your post about the connection to lattice paths! I was probably distracted by ‘applied category theory’ when it come out. My interest is heightened now that I’m trying to understand continued fractions a bit better.

I’d love to find a general theory relating continued fractions to combinatorics, the way species relate power series to combinatorics. It looks like your post on Flajolet’s Fundamental Lemma points the way! But at the very least I’d like to overcome my massive ignorance of them.

The first step was to learn the \ddots command in LaTeX. It makes the difference between this:

$\frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\cdots }}}}$

and something much cooler:

$\frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\ddots }}}}$

Posted by: John Baez on September 4, 2020 7:06 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

Did you really mean to write

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = \frac{1} {1- \frac{ t^2} {1- \frac{2 t^2} {1- \frac{3 t^2} {1-\ddots }}}} \,?$

The left hand side should be

$1+ (1)t^2 + (1\cdot 3) t^4 + (1\cdot 3\cdot 5) t^5+\dots$

unless I’m missing something (which is quite possible). So it ought to be even powers of $t$ rather than odd powers of $x$, with the double factorials in the numerator, not the denominator.

Posted by: Simon Willerton on September 4, 2020 9:16 PM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

Oh, I probably screwed it up. I just meant that you can probably use Jacobi’s trickery to get a continued fraction expansion for

$x + \frac{x^3}{1 \cdot 3} + \frac{x^5}{1 \cdot 3 \cdot 5} + \cdots = e^{x^2/2} \int_0^x e^{-t^2/2} \, d t$

just as easily as Jacobi got one for

$e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t = \frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \frac{5}{x + \ddots}}}}}}$

I should not have tried to cut-and-paste a guess of the continued fraction expansion you actually get!

Posted by: John Baez on September 5, 2020 2:28 AM | Permalink | Reply to this

### Re: Chasing the Tail of the Gaussian (Part 2)

Over on Twitter Leo Stein found a vastly simplified way to show

$\frac{1}{x + \frac{1}{x + \frac{2}{x + \frac{3}{x + \frac{4}{x + \frac{5}{x + \ddots}}}}}} = e^{x^2/2} \int_x^\infty e^{-t^2/2} \, d t$

so I’ve rewritten the whole blog article to replace Jacobi’s more clunky calculation with this one.

This answers my questions about why Jacobi did exactly what he did. The answer seems to be: because he didn’t find the really nice argument.

Posted by: John Baez on September 5, 2020 2:31 AM | Permalink | Reply to this

Post a New Comment