# Comparison Test for Improper Integrals

Sometimes it is impossible to find the exact value of an improper integral and yet it is important to know whether it is convergent or divergent. In such cases the following test is useful. Although we state it for Type 1 integrals, a similar theorem is true for Type 2 integrals.

**Comparison Test.** Suppose that f and g are continuous functions with `f(x)>=g(x)>=0` for `x>=a`.

- If `int_a^(oo)f(x)dx` is convergent, then `int_a^(oo)g(x)dx` is also convergent.
- If `int_a^(oo)g(x)dx` is divergent, then `int_a^(oo)f(x)dx` is also divergent.

In terms of area the Comparison Test makes a lot of sense. If f(x) is larger than g(x) then the area under f(x) must also be larger than the area under g(x).

So, if the area under the larger function is finite (`int_a^(oo)f(x)dx` converges) then the area under the smaller function must also be finite (`int_a^(oo)g(x)dx` converges). Similarly, if the area under the smaller function is infinite (`int_a^(oo)g(x)dx` diverges) then the area under the larger function must also be infinite (`int_a^(oo)f(x)dx` diverges).

You should correctly understand this test. Divergence of `int_a^(oo)f(x)dx` doesn't imply divergence of `int_a^(oo) g(x)dx` (it may or may not diverge). Convergence of `int_a^(oo)g(x)dx` doesn't imply convergence of `int_a^(oo) f(x)dx` (it may or may not converge).

**Example 1.** Determine whether `int_0^(oo)e^(-x^2)dx` is convergent.

We can't evaluate the integral directly because the antiderivative of `e^(-x^2)` is not an elementary function. However, note that `x^2>=x` for `x>=1`. This means that `-x^2<=-x` and `e^(-x^2)<=e^(-x)` for `x>=1`.

However, we have integral from 0 to `oo` instead of 1 to `oo`.

So, we split integral as follows: `int_0^(oo)e^(-x^2)dx=int_0^1e^(-x^2)dx+int_1^(oo)e^(-x^2)dx`.

First integral on the right-hand side is just an ordinary definite integral and, thus, has finite value.

For the second integral with use comparison test (`e^(-x^2)<=e^(-x)` for `x>=1` ).

`int_1^(oo)e^(-x)dx=lim_(t->oo)int_1^t e^(-x)dx=lim_(t->oo)(-e^(-x)|_1^t)=lim_(t->oo)(-e^(-t)+e^(-1))=1/e`.

Thus, taking `f(x)=e^(-x)` and `g(x)=e^(-x^2)` in the Comparison Test, we see that `int_1^(oo)e^(-x^2)dx` is convergent. It follows that is `int_0^(oo)e^(-x^2)dx` is convergent.

**Example 2.** Determine if the integral `int_1^oo 1/(x+e^x)dx` is convergent or divergent.

We can write that `1/(x+e^x)<1/x` but we can't say nothing about integral because `int_1^(oo)1/xdx` is divergent (see Type 1 Integrals note, Example 1).

So, let's try to drop out x: `1/(x+e^x)<1/e^x=e^(-x)` for `x>=1`.

`int_1^(oo)e^(-x)dx` is convergent (see Example 1), so `int_1^(oo)1/(x+e^x)dx` is also convergent by Comparison Test.

**Example 3.** Determine if the integral `int_1^(oo)(1+e^x)/xdx` convergent or divergent.

Integral is divergent by Comparison Test because `(1+e^x)/x>1/x` and `int_1^(oo)1/x dx` is divergent.

**Example 4.** Determine if the integral `int_1^(oo)(cos(sqrt(x)))/x^2dx` convergent or divergent.

Since `cos(sqrt(x))<=1` then integral is convergent by Comparison Test because `(cos(sqrt(x)))/x^2<1/x^2` and `int_1^(oo)1/x^2 dx` is convergent.