Improper Integrals

A function $f(x)$ is Riemann integrable over an interval $[a,b]$ if some limit involving Riemann sums exists. This limit will fail to exist if $f(x) = \infty$ in $[a,b]$. As well, the Riemann sum idea is undefined if either $a$ or $b$ (or both) are infinite, so the limit won't exist in this case.

To define integrals with either functions having singularities or infinite domains, the idea of an improper integral is introduced with definitions to handle the two cases above.

Area under $1/\sqrt{x}$ over $[a,b]$ increases as $a$ gets closer to $0$. Will it grow unbounded or have a limit?

Infinite domains

Let $f(x)$ be a reasonable function, so reasonable that for any $a < b$ the function is Riemann integrable, meaning $\int_a^b f(x)dx$ exists.

What needs to be the case so that we can discuss the limit over the entire real number line?

Clearly something. The function $f(x) = 1$ is reasonable by the idea above. Clearly the integral over and $[a,b]$ is just $b-a$, but the limit over an unbounded domain would be $\infty$. Even though limits of infinity can be of interest in some cases, not so here. What will ensure that the area is finite over an infinite region?

Or is that even the right question. Now consider $f(x) = \sin(\pi x)$. Over every interval of the type $[-2n, 2n]$ the area is $0$, and over any interval, $[a,b]$ the area never gets bigger than $2$. But still this function does not have a well defined area on an infinite domain.

The right question involves a limit. Fix a finite $a$. We define the definite integral over $[a,\infty)$ to be

\[ ~ \int_a^\infty f(x) dx = \lim_{M \rightarrow \infty} \int_a^M f(x) dx, ~ \]

when the limit exists. Similarly, we define the definite integral over $(-\infty, a]$ through

\[ ~ \int_{-\infty}^a f(x) dx = \lim_{M \rightarrow -\infty} \int_M^a f(x) dx. ~ \]

For the interval $(-\infty, \infty)$ we have need both these limits to exist, and then:

\[ ~ \int_{-\infty}^\infty f(x) dx = \lim_{M \rightarrow -\infty} \int_M^a f(x) dx + \lim_{M \rightarrow \infty} \int_a^M f(x) dx. ~ \]

Examples

\[ ~ \lim_{M \rightarrow \infty} \int_1^M \frac{1}{x^2}dx = \lim_{M \rightarrow \infty} -\frac{1}{x}\big|_1^M = \lim_{M \rightarrow \infty} 1 - \frac{1}{M} = 1. ~ \]

\[ ~ \lim_{M \rightarrow \infty} \int_1^M \frac{1}{x^{1/2}}dx = \lim_{M \rightarrow \infty} \frac{x^{1/2}}{1/2}\big|_1^M = \lim_{M \rightarrow \infty} 2\sqrt{M} - 2 = \infty. ~ \]

The limit is infinite, so does not exist except in an extended sense.

Before showing this, we recall the fundamental theorem of calculus. The limit existing is the same as saying the limit of $F(M) - F(a)$ exists for an antiderivative of $f(x)$.

For this particular problem, it can be shown by integration by parts that for positive, integer values of $n$ that an antiderivative exists of the form $F(x) = p(x)e^{-x}$, where $p(x)$ is a polynomial of degree $n$. But we've seen that for any $n>0$, $\lim_{x \rightarrow \infty} x^n e^{-x} = 0$, so the same is true for any polynomial. So, $\lim_{M \rightarrow \infty} F(M) - F(1) = -F(1)$.

\[ [a, \infty) \]

for any finite $a$. This is because, $F(M) = e^x$ and this has a limit as $x$ goes to $-\infty$, but not $\infty$.

We first find an antiderivative using the $u$-substitution $u(x) = \log(x)$:

\[ ~ \int_e^M \frac{e}{x \log(x)^{2}} dx = \int_{\log(e)}^{\log(M)} \frac{1}{u^{2}} du = \frac{-1}{u} \big|_{1}^{\log(M)} = \frac{-1}{\log(M)} - \frac{-1}{1} = 1 - \frac{1}{M}. ~ \]

As $M$ goes to $\infty$, this will converge to $1$.

using CalculusWithJulia    # loads `SymPy`, `QuadGK`
using Plots
@vars M
limit(sympy.Si(M), M => oo)
\begin{equation*}\frac{\pi}{2}\end{equation*}

Numeric integrals

The quadgk function (available through QuadGK which is loaded with CalculusWithJulia) is able to accept Inf and -Inf as endpoints of the interval. For example, this will integrate $e^{-x^2/2}$ over the real line:

f(x) = exp(-x^2/2)
quadgk(f, -Inf, Inf)
(2.506628274639168, 3.6084380708526996e-8)

(If may not be obvious, but this is $\sqrt{2\pi}$.)

Singularities

Suppose $\lim_{x \rightarrow c}f(x) = \infty$ or $-\infty$. Then a Riemann sum that contains an interval including $c$ will not be finite if the point chosen in the interval is $c$. Though we could choose another point, this is not enough as the definition must hold for any choice of the $c_i$.

However, if $c$ is isolated, we can get close to $c$ and see how the area changes.

Suppose $a < c$, we define $\int_a^c f(x) dx = \lim_{M \rightarrow c-} \int_a^c f(x) dx$. If this limit exists, the definite integral with $c$ is well defined. Similarly, the integral from $c$ to $b$, where $b > c$, can be defined by a right limit going to $c$. The integral from $a$ to $b$ will exist if both the limits are finite.

Examples

\[ ~ \lim_{M \rightarrow 0+} \int_M^1 \frac{1}{\sqrt{x}} dx = \lim_{M \rightarrow 0+} \frac{\sqrt{x}}{1/2} \big|_M^1 = \lim_{M \rightarrow 0+} 2(1) - 2\sqrt{M} = 2. ~ \]

\[ ~ \lim_{M \rightarrow 0+} \int_M^1 \frac{1}{x} dx = \lim_{M \rightarrow 0+} \log(x) \big|_M^1 = \lim_{M \rightarrow 0+} \log(1) - \log(M) = \infty. ~ \]

As the limit does not exist, the function is not integrable around $0$.

@vars x
integrate(1/x, (x, -1, 1))
\begin{equation*}\text{NaN}\end{equation*}

We need to consider the limit of $\int_M^1 f(1/x) dx$. We try the $u$-substitution $u(x) = 1/x$. This gives $du = -(1/x^2)dx = -u^2 dx$. So, the substitution becomes:

\[ ~ \int_M^1 f(1/x) dx = \int_{1/M}^{1/1} f(u) (-u^2) du = \int_1^{1/M} u^2 f(u) du. ~ \]

But the limit as $M \rightarrow 0$ of $1/M$ is the same going to $\infty$, so the right side will converge by the assumption. Thus we get $f(1/x)$ is integrable over $(0,1]$.

Numeric integration

So far our use of the quadgk function specified the region to integrate via a, b, as in quadgk(f, a, b). In fact, it can specify values in between for which the function should not be sampled. For example, were we to integrate $1/\sqrt{\lvert x\rvert}$ over $[-1,1]$, we would want to avoid $0$ as a point to sample. Here is how:

f(x) = 1 / sqrt(abs(x))
quadgk(f, -1, 0, 1)
(3.999999962817228, 5.736423067171012e-8)

Just trying quadgk(f, -1, 1) leads to a DomainError, as 0 will be one of the points sampled. The general call is like quadgk(f, a, b, c, d,...) which integrates over $(a,b)$ and $(b,c)$ and $(c,d)$, $\dots$. The algorithm is not supposed to evaluate the function at the endpoints of the intervals.

Probability applications

A probability density is a function $f(x) \geq 0$ which is integrable on $(-\infty, \infty)$ and for which $\int_{-\infty}^\infty f(x) dx =1$. The cumulative distribution function is defined by $F(x)=\int_{-\infty}^x f(u) du$.

Probability densities are good example of using improper integrals.

We need to show that the integral exists and is $1$. For this, we use the fact that $(1/\pi) \cdot \tan^{-1}(x)$ is an antiderivative. Then we have:

\[ \lim_{M \rightarrow \infty} F(M) = (1/\pi) \cdot \pi/2 \]

and as $\tan^{-1}(x)$ is odd, we must have $F(-\infty) = \lim_{M \rightarrow -\infty} f(M) = -(1/\pi) \cdot \pi/2$. All told, $F(\infty) - F(-\infty) = 1/2 - (-1/2) = 1$.

The integral for $-\infty$ to $a$ of $f(x)$ is just an integral of the constant $0$, so will be $0$. (This is the only constant with finite area over an infinite domain.) Similarly, the integral from $b$ to $\infty$ will be $0$. This means:

\[ ~ \int_{-\infty}^\infty f(x) dx = \int_a^b \frac{1}{b-a} dx = 1. ~ \]

We have by the $u$-substitution

\[ ~ \int_{-\infty}^\infty f(x-c)dx = \int_{u(-\infty)}^{u(\infty)} f(u) du = \int_{-\infty}^\infty f(u) du = 1. ~ \]

The key is that we can use the regular $u$-substitution formula provided $\lim_{M \rightarrow \infty} u(M) = u(\infty)$ is defined. (The informal notation $u(\infty)$ is defined by that limit.)

Again, by a $u$ substitution with, now, $u(x) = (x-c)/h$, we have $du = (1/h) \cdot dx$ and the result follows just as before:

\[ ~ \int_{-\infty}^\infty \frac{1}{h}f(\frac{x-c}{h})dx = \int_{u(-\infty)}^{u(\infty)} f(u) du = \int_{-\infty}^\infty f(u) du = 1. ~ \]

We want to just say $F'(x)= e^{-x}$ so $f(x) = e^{-x}$. But some care is needed. First, that isn't right. The derivative for $x<0$ of $F(x)$ is $0$, so $f(x) = 0$ if $x < 0$. What about for $x>0$? The derivative is $e^{-x}$, but is that the right answer? $F(x) = \int_{-\infty}^x f(u) du$, so we have to at least discuss if the $-\infty$ affects things. In this case, and in general the answer is no. For any $x$ we can find $M < x$ so that we have $F(x) = \int_{-\infty}^M f(u) du + \int_M^x f(u) du$. The first part is a constant, so will have derivative $0$, the second will have derivative $f(x)$, if the derivative exists (and it will exist at $x$ if the derivative is continuous in a neighborhood of $x$).

Finally, at $x=0$ we have an issue, as $F'(0)$ does not exist. The left limit of the secant line approximation is $0$, the right limit of the secant line approximation is $1$. So, we can take $f(x) = e^{-x}$ for $x > 0$ and $0$ otherwise, noting that redefining $f(x)$ at a point will not effect the integral as long as the point is finite.

Questions

Question

Is $f(x) = 1/x^{100}$ integrable around $0$?

Question

Is $f(x) = 1/x^{1/3}$ integrable around $0$?

Question

Is $f(x) = x\cdot\log(x)$ integrable on $[1,\infty)$?

Question

Is $f(x) = \log(x)/ x$ integrable on $[1,\infty)$?

Question

Is $f(x) = \log(x)$ integrable on $[1,\infty)$?

Question

Compute the integral $\int_0^\infty 1/(1+x^2) dx$.

Question

Compute the the integral $\int_1^\infty \log(x)/x^2 dx$.

Question

Compute the integral $\int_0^2 (x-1)^{2/3} dx$.

Question

From the relationship that if $0 \leq f(x) \leq g(x)$ then $\int_a^b f(x) dx \leq \int_a^b g(x) dx$ it can be deduced that

Let $f(x) = \lvert \sin(x)/x^2 \rvert$.

What can you say about $\int_1^\infty f(x) dx$, as $f(x) \leq 1/x^2$ on $[1, \infty)$?


Let $f(x) = \lvert \sin(x) \rvert / x$.

What can you say about $\int_1^\infty f(x) dx$, as $f(x) \leq 1/x$ on $[1, \infty)$?


Let $f(x) = 1/\sqrt{x^2 - 1}$. What can you say about $\int_1^\infty f(x) dx$, as $f(x) \geq 1/x$ on $[1, \infty)$?


Let $f(x) = 1 + 4x^2$. What can you say about $\int_1^\infty f(x) dx$, as $f(x) \leq 1/x^2$ on $[1, \infty)$?


Let $f(x) = \lvert \sin(x)^{10}\rvert/e^x$. What can you say about $\int_1^\infty f(x) dx$, as $f(x) \leq e^{-x}$ on $[1, \infty)$?

Question

The difference between "blowing up" at $0$ versus being integrable at $\infty$ can be seen to be related through the $u$-substitution $u=1/x$. With this $u$-substitution, what becomes of $\int_0^1 x^{-2/3} dx$?

Question

The antiderivative of $f(x) = 1/\pi \cdot 1/\sqrt{x(1-x)}$ is $F(x)=(2/\pi)\cdot \sin^{-1}(\sqrt{x})$.

Find $\int_0^1 f(x) dx$.