Continued integrals

Many of the most awesome formulas you meet when getting into mathematics are continued fractions like

\Phi = 1+\frac{1}{1+\frac{1}{1+\frac{1}{\ldots}}}

and nested radicals like

2 = \sqrt{2 + \sqrt{2 + \sqrt{2 + \ldots}}}.

What about nested/continued integrals? Here is a simple one:

e^x=1+x+\int x+\left(\int x+\left(\int x+\left(\ldots\right)dx\right)dx\right)dx.

The way to see this is to recognize that the x in the first integral is going to integrate to x^2/2, the x in the second will be integrated twice \int x^2/2 dx = x^3/3!, and so on.

In general additive integrals of this kind turn into sums (assuming convergence, handwave, handwave…):

I(x)=\int f(x)+\left(\int f(x)+\left(\int f(x)+\left(\ldots\right)dx\right)dx\right)dx = \sum_{n=1}^\infty \int^n f(x) dx.

On the other hand, I'(x)=f(x)+I(x).

So if we insert f_k(x)=\sin(kx) we get the sum I_k(x)=-\cos(kx)/k-\sin(kx)/k^2+\cos(kx)/k^3+\sin(x)/k^4-\cos(kx)/k^5-\ldots. For x=0 we end up with I_k(0)=\sum_{n=0}^\infty 1/k^{4n+2} - \sum_{n=0}^\infty 2/k^{4n+1}. The differential equation has solution I_k(x)=ce^x-\sin(kx)/(k^2+1) - k\cos(kx)/(k^2+1). Setting k=0 the integral is clearly zero, so c=0. Tying it together we get:

\sum_{n=0}^\infty 1/k^{4n+2}-\sum_{n=0}^\infty 1/k^{4n+1}=-k/(k^2+1).

Things are trickier when the integrals are multiplicative, like I(x)=\int x \int x \int x \ldots dx dx dx. However, we can turn it into a differential equation: I'(x)=x I(x) which has the well known solution I(x)=ce^{x^2/2}. Same thing for f_k(x)=\sin(kx), giving us I_k(x)=ce^{-\cos(kx)/k}. Since we are running indefinite integrals we get those pesky constants.

Plugging in f(x)=1/x gives I(x)=cx. If we set c=1 we get the mildly amusing and in retrospect obvious formula

x=\int \frac{\int \frac{\int \frac{\ldots}{x} dx}{x} dx}{x} dx.

We can of course mess things up further, like I(x)=\int\sqrt{\int\sqrt{\int\sqrt{\ldots} dx} dx} dx, where the differential equation becomes I'^2=I with the solution I(x)=(1/4)(c^2 + 2cx + x^2). A surprisingly simple solution to a weird-looking integral. In a similar vein:

2\cot^{-1}(e^{c-x})=\int\sin\left(\int\sin\left(\int\sin\left(\ldots\right)dx\right) dx\right) dx

-\log(c-x)=\int \exp\left(\int \exp\left(\int \exp\left(\ldots \right) dx \right) dx \right) dx

1/(c-x)=\int \left(\int \left(\int \left(\ldots \right)^2 dx \right)^2 dx \right)^2 dx

And if you want a real mind-bender, use the Lambert W function:

I(x)=\int W\left(\int W\left(\int W\left(\ldots \right) dx \right) dx \right) dx, then x=\int_1^{I(x)}1/W(t) dt + c.

(that is, you get an implicit but well defined expression for the (x,I(x)) values. With Lambert, the x and y axes always tend to switch place).

[And yes, convergence is handwavy in this essay. I think the best way of approaching it is to view the values of these integrals as the functions invariant under the functional consisting of the integral and its repeated function: whether nearby functions are attracted to it (or not) under repeated application of the functional depends on the case. ]