## Improper integrals and periodic functions

The idea for this post came from a question I saw in a math help forum about improper integrals. While this problem has a very simple solution using basic tools in integral calculus, I want to show a more geometric approach which can be generalized much further (and for the Hebrew speakers among you, I made a video explaining this as well here ).

Without the extra noise added by the original person who wrote this question, it eventually comes down to the following. One of the first improper integrals that we all learn about is

$\int_\pi^\infty \frac{1}{x} \mathrm{dx} = \infty.$

The proof is quite simple: we know that the integral of $\frac{1}{x}$ is $\ln(x)$ so that the integral above is $ln(\infty)-\ln(\pi) = \infty$. Geometrically, this means that the area below the graph of the function $\frac{1}{x}$ is infinite:

Things start to become more interesting when we multiply the integrand by $\sin(x)$ and $|\sin(x)|$. In these cases we get the areas of the following graphs:

Using our geometric intuition, in the first integral where we multiply by $\sin(x)$, we get positive and negative areas alternatively, so a lot of it cancels away, and we might hope that the total area converge to some finite number. On the other hand, when multiplying by $|\sin(x)|$, it seems that the new area is at least half of the original area, and since the original area is infinite, half of it would also infinite as well.

Both of these claims can be proven quite easily. For the first one, we use integration by parts (integrating $\sin(x)$ and taking the derivative of $x^{-1}$) to get that

$\int_\pi^\infty \frac{\sin(x)}{x} dx = \frac{-\cos(x)}{x} \mid _\pi^\infty - \int_\pi ^\infty \frac{-\cos(x)}{-x^2} dx$.

The first part is just $0+\frac{cos(\pi)}{\pi}=-\frac{1}{\pi}$. The second term is also finite since it is absolutely convergent:

$\int_\pi ^\infty |\frac{-\cos(x)}{-x^2}| dx \leq \int_\pi ^\infty \frac{1}{x^2} dx = -\frac{1}{x} \mid _\pi ^\infty =\frac{1}{\pi}$.

Since both terms are finite, then so is the integral.

For the second integral, we use some trigonometric identities and inequalities to get that

$|\sin(x)|\geq \sin^2(x) = 1 - \cos^2(x) = \frac{1-\cos(2x)}{2},$

So now we have that

$\int_\pi^\infty \frac{|\sin(x)|}{x} dx \geq \int_\pi^\infty \frac{1}{2x} dx - \int_\pi^\infty \frac{\cos(2x)}{2x} dx$.

The first term above is infinite (and to connect it to our intuition, it is “half” of the infinity of $\int_\pi^\infty \frac{1}{x} dx$), and the second part is finite (the proof uses the same argument that we had in the previous case). So all in all it is $\infty-\text{finite} =\infty$.

While these are two lines proofs that use very basic tools from integral calculus, it is very hard to see how the geometric intuition comes into play here. Where did we use the area canceling intuition in the first case, or that two copies of the area cover the original blue area in the second case?

More over, in the geometric intuition, it is very easy to see that it still works when we take other functions $h(x)$ “similar” to $\sin(x)$, where we don’t know their integral\derivative, and function $f(x)$ “similar” to $\frac{1}{x}$. For example:

Here $h(x)$ in the red is a periodic nonnegative function (like $|\sin(x)|$), $f(x)$ is the blue function, and the orange area is the product of $h(x)\cdot f(x)$. Looking at the image, it seems that the orange area is around $\frac{1}{3}$ of the original blue area. So if the blue area is infinite, then so is the orange area.

My goal in this post is to try and understand the geometric side of this problem and find simple conditions that make our intuition comes true. Here I will focus only on the second integral (with the absolute function), and will leave the first type as an exercise.

Before moving on, let me remark that multiplying by $\sin(x)$ and taking the integral is quite an important operation, which is closely related to the subject of Fourier transforms. However, this is a more advanced material which is usually not seen when we first learn about improper integrals. Second, a general setting of this problem when multiplying by $\sin(x)$ (without the absolute value) is many times solved using what is called Dirichlet’s test, and I will talk a little bit about it in the end of this post.

## The intuition

Let us first try to attach our intuition some general idea of a proof. Consider the following picture using the example from above:

We know that the original light blue area is infinity, and if we can show that the new orange area is at least $\frac{1}{3}$ of it, then it is infinite as well. For that, we look on the first “bump” of area in (full) orange of the new function, and the first “missing” area in (full) blue that is not covered with the new function. If we can trust our eyes, then it seems that two copies of the orange area will cover the blue area.

We should note two points that make this covering argument work, even without knowing too much information about the function $h(x)$. First, the blue missing area cannot be too wide, because $h(x)$ is periodic, so that the width of this blue area is bounded. Second, the blue area cannot be too high compared to the orange, because our blue function is monotonically decreasing.

We can repeat this argument for each of the bumps of area, to get that 3 copies of the orange area cover almost all of the original area, except a finite area in the beginning. This will ensure that the new area is infinite as well.

The problem now is that in the end we actually need to formalize this notion, and we cannot rely on only eyesight. In order to do that, let’s try to simplify our red function $h(x)$.

Remark: If you really want to prove the original problem with $|\sin(x)|$ using this intuition, then note that (1) $\frac{|\cos(x)|}{x}$ is in a sense a shift right of $\frac{|\sin(x)|}{x}$, and (2) we have that $|\sin(x)|+|\cos(x)|\geq \sin^2(x)+\cos^2(x) = 1$, so in a sense, each of these cover half of the area. What we want to do is generalize this notion without using trigonometric identities (because in general our functions will not be trigonometric functions!).

## The simplification step

For that, suppose that we can find a new function $g(x)$ such that $h(x)\geq g(x)\geq 0$ so that

$\int_\pi^\infty f(x)h(x)dx\geq \int_\pi^\infty f(x)g(x)dx$.

It will then be enough to show that the second integral is infinite, and if we choose $g(x)$ to be simple enough, we might even be able to do this. The best that we can hope is for $g(x)$ to be constant, but the only nonnegative constant function smaller than $h(x)$ is the zero function, which doesn’t help us. However, we can find such a $g(x)$ which is piece wise constant:

Note that our intuition from before, namely that finitely many copies of the orange area “bumps” cover the original blue function still holds for the new function $g(x)$.

Before we continue, let us ask what conditions do we need for a general $h(x)$ so that we can find such a function $0\leq g(x)\leq h(x)$ which is nonzero, piece wise constant and of course periodic.

Since $h(x)$ in itself is periodic for some period $T$, then we only need to define $g(x)$ on the first period of $h(x)$ (namely in $[0,T]$) and then extend it periodically (so that $g(x+T)=g(x)$). Next, since $h(x)$ in itself is nonzero, then we can find some $t\in (0,T)$ where $h(t)> 0$, and for simplicity of notation assume that $h(t)=1$. Finally, if we assume that $h(x)$ is also continuous, then there is some $\delta>0$ small enough so that $h(x)>0.5$ if $|x-t|<\delta$. We can now define $g(x)$ to be

$g(x) = \begin{cases}0.5 & \left|x-t\right|<\delta\\0 & else\end{cases} \leq h(x)$.

To conclude, if $h(x)$ is periodic, nonnegative and strictly positive in some points, and finally continuous at these points, then there is such a function $h(x)\geq g(x)\geq 0$ which is periodic, nonzero and piece wise constant.

Now we need to prove our claim that the orange area is infinite, but for the much simpler function $g(x)$ which only has two values, and in our case these values are $0$ and $\frac{1}{2}$. Just to make the computations even more simple, let’s define $\chi(x)=2g(x)$, so that $\chi(x)$ only has two values 0 and 1, and we are left to show that the integral

$2\int_\pi^\infty f(x)g(x)dx =\int_\pi^\infty f(x)\chi(x)dx \overset{?}{=}\infty$.

A function which only has the two values 0 and 1 is called a characteristic function – namely the function characterizes the set on which it is 1.

## Proving for characteristic functions

Now that we reduced our problem to a characteristic function, we have the following image of the area:

Since the function $\chi(x)$ is a very simple function, it is really easy to see that our intuition from before works. Namely, two more copies of the orange area will cover almost all of the light blue area, and we are left with a finite area in the beginning:

It follows that the blue area is smaller that the yellow (finite) area + $3 \times$ the orange area, or alternatively the orange area is at least $\frac{1}{3}$ of the blue area minus the yellow area, so that it is at least $\frac{1}{3}(\infty-\text{finite})=\infty$, which completes our proof.

## Formalization

Now that we have seen the idea of this geometric proof, we want to write it down formally. We begin by giving the conditions for the (blue) function $f(x)$ and the (red) function $h(x)$ which we used during the proof so far.

Note that usually at this point, the conditions are more guesses than actually the “right” conditions. Usually these conditions are changed during the formalization process if we see that maybe they are not enough, or alternatively if we can ask for less and still get the result we wants.

For $f(x)$ it seems that we needed:

1. $f(x)>0$,
2. $f(x)\searrow 0$ (monotonic decreasing to zero), and
3. $\int_\pi^\infty f(x)dx =\infty$.

For the red function $h(x)$ we needed that

1. $h(x)$ is periodic (and we denote the period by $T$),
2. $h(x)\geq 0$, and
3. there is some point $t\in(0,T)$ where $M=h(t)>0$ and $h$ is continuous at that point.

In general, we need to require both functions to be integrable, since otherwise we have nothing to talk about, but if you are not comfortable with this condition, you may assume that both are piecewise continuous. We want to show that given these conditions, we have that

$\int_0^\infty f(x)h(x) dx = \infty$.

### Normalizing $h(x)$

In our proof sketch above, our first step was to simplify $h(x)$ and build $g(x)$. Instead of using the exact way we showed above, I want to first try to simplify our notations and get rid of the constants $T,t$ and $M$. You can prove this without this step, but this step is usually very helpful both when proving some result, and when reading someone’s else proof, because we don’t need to carry around these constants everywhere.

First, to get rid of $t$, note that the integral on the segment $[0,t]$ is always finite, and doesn’t affect our result (It was the yellow area above). Since

$\int_0^\infty = \overbrace{\int_0^t}^{\text{finite}} +\int_t^\infty$ ,

we may restrict our attention to the part $[t,\infty]$. Finally, setting $\tilde{f}(x)=f(x+t)$ and $\tilde{h}(x)=h(x+t)$ we have that

$\int_t^\infty f(x)h(x) dx=\int_0^\infty \tilde{f}(x)\tilde{h}(x)dx$.

The new functions $\tilde{f},\tilde{h}$ satisfy the conditions that we wanted from $f,h$ and further more we now have that $\tilde{h}(0)>0$ and it is continuous there. Thus, in our proof we may assume that $t=0$.

Next, to get rid of $M$ and $T$ we define the new functions $\tilde{\tilde{h}}(x) = \frac{1}{M}\tilde{h}(Tx)$ and $\tilde{\tilde{f}}(x)=\tilde{f}(Tx)$. The multiplication by $\frac{1}{M}$ just stretches the graph of $h(x)$ by a factor of $\frac{1}{M}$ in the $y$ direction. In particular we get that $\tilde{\tilde{h}}(0)=1$. Next, the multiplication by $T$ stretch similarly in the $x$ direction so we get that

$\tilde{\tilde{h}}(x+1) = \frac{1}{M}\tilde{h}(Tx+T) = \frac{1}{M}\tilde{h}(Tx) =\tilde{\tilde{h}}(x)$,

or in other words $\tilde{\tilde{h}}(x)$ is 1-periodic. Finally, our integral is

$\int_0^\infty \tilde{\tilde{f}}(x) \cdot \tilde{\tilde{h}}(x) dx = \frac{1}{MT} \int_0^\infty \tilde{f}(Tx) \cdot \tilde{h}(Tx) Tdx =\frac{1}{MT} \int_0^\infty \tilde{f}(x) \cdot \tilde{h}(x) dx$,

so our new integral is infinity if and only if the previous integral is infinity.

To summarize, using these reduction steps, we may assume that we have $f,h$ as above, and in addition $t=0, M=1$ and $T=1$.

### Construction $g(x)$ and $\chi(x)$

Let $N>1$ be a large enough integer so that $0\leq x< \frac{1}{N}$ implies that $h(x)>\frac{1}{2}$ (and we can find such $N$ since $h$ is continuous and $h(0)=1$). We define $g(x)$ in $[0,1]$ to be

$g(x) = \begin{cases}\frac{1}{2} & 0\leq x<\frac{1}{N}\\0 & else\end{cases}$,

and extend this definition to all of the real line by making $g$ 1-periodic, namely $g(x+1)=g(x)$. Finally, define $\chi(x)=2\cdot g(x)$.

We can also write a more direct definition. Given a number $x\in \mathbb{R}$, we write $\{x\} = x-\left\lfloor x\right\rfloor$ to be its fractional part (so for example $\{2.156\}=0.156$). With this notation we get that

$\chi(x) = \begin{cases}1 & 0\leq \{x\}<\frac{1}{N}\\0 & else\end{cases}$.

By construction, we have that $g(x)\leq h(x)$, so that

$\int_0^\infty f(x)h(x) dx \geq \int_0^\infty f(x)g(x) dx = \frac{1}{2}\int_0^\infty f(x)\chi(x) dx$,

and we are left to show that the last integral is infinite.

### The covering argument

Up until now we only used the conditions on $h(x)$, and now we will use the conditions on $f(x)$. Using the fact that $f(x)$ is monotonic decreasing, we get that for any $\delta>0, x\in \mathbb{R}$ we have that $f(x)\geq f(x+\delta)$. Because $\chi(x)$ is nonnegative we conclude that

$\int_0^\infty f(x)\chi(x) dx \geq \int_0^\infty f(x+\delta)\chi(x) dx = \int_\delta^\infty f(x)\chi(x-\delta) dx$.

These integrals are going to be the red copies that we added in the proof idea above.

You should now check that $\chi(x-\delta)$ just moves the graph of $\chi(x)$ to the right at distance $\delta$, and if $\delta\leq \frac{N-1}{N}$, then we can formally write it as

$\chi(x-\delta) = \begin{cases}1 & \delta\leq \{x\}<\delta+\frac{1}{N}\\0 & else\end{cases}$.

(EX: What happens when $\delta > \frac{N-1}{N}$?)

In particular, we have that $\sum_{k=0}^{N-1} \chi(x-\frac{k}{N}) \equiv 1$ is the constant function 1. We now have that

$N\cdot \int_0^\infty f(x)\chi(x) dx \geq \sum_{k=0}^{N-1} \int_{\frac{k}{N}}^\infty f(x)\chi(x-\frac{k}{N}) dx = \int_0^\infty f(x) dx = \infty$.

But $N$ is of course some (finite) integer, so we get that

$\int_0^\infty f(x)\chi(x) dx = \infty$,

which is exactly what we want to show, thus completing the proof.

## Final thoughts and remarks

At this point, after you read and understood both of the sketch of the proof and the proof itself, you should make sure that you know which part of the formalization correspond to which part of the sketch. Moreover, you should try to think how the step in the sketch led eventually to the formal step, because in the end this is what you want to be able to do by yourself.

Now that we have the formal proof, we can ask what else can we do with our new geometric approach. For example, can we weaken the conditions needed for $h(x)$ and $f(x)$? As an exercise, you should show that $h(x)$ doesn’t have to be periodic. Indeed, the only place that we really needed it is in the covering argument, where we wanted to show that the orange “bump” can cover the blue “missing area”, and the periodicity meant that the the blue area is not too wide. So if we can say that the “bumps” cannot be too far away from each other, then the proof should still work. Of course, now the question is how to formalize it.

Secondly, here we used the approach where we simplify $h(x)$, but we can also do it with $f(x)$. Can you find a way to construct new function $0\leq w(x)\leq f(x)$ which is piecewise constant and $\int_0^\infty w(x)dx =\infty$? If you can do it, then using the inequality $\int_0^\infty f(x)h(x)dx \geq \int_0^\infty w(x)h(x)$, it is enough to prove that the second integral is infinite. If you can also make sure that $w(x)$ is constant on the periods of $h(x)$, namely constant in each $[kT,(k+1)T]$, then you will again get a very simple expression.

Finally, here we tried to generalize the result saying that $\int_\pi^\infty \frac{|\sin(x)|}{x} dx = \infty$. Try to do a similar generalization for the fact that $\int_\pi^\infty \frac{\sin(x)}{x} dx$ converge.

This last exercise where we remove the absolute value is a very specific case of Dirichlet’s test. While in the proof here we only used the periodicity of $h(x)$, in this case our intuition was that we have both positive and negative areas which have cancellations, so we need a little extra. When the periodic function is $\sin(x)$, then we get this for free because for every positive wave (namely $[2\pi k,2\pi k+\pi]$) we have a negative wave (namely $[2\pi k+\pi,2\pi k+2\cdot\pi]$) which have the exact same area. In particular, the integral $\int_{2\pi k}^{2\pi(k+1)} \sin(x)dx =0$, so that $\int_{0}^{2\pi\cdot k} \sin(x)dx =0$ for all $k$. This is a good condition to start with. However, if we change a “little bit” our periodic function, we might still hope this result to hold, and indeed, in Dirichlet’s test this condition changes to $M\mapsto |\int_0^M h(x)dx|$ is uniformly bounded, instead of being the zero function.

This entry was posted in Uncategorized. Bookmark the permalink.