Laboratory 18
Improper Integrals
with Solutions

Introduction

    The purpose of this lab is to learn about and to study improper integrals. Improper integrals arise because the definition of the definite integral does not cover all of the cases which are of interest. Remember that the definite integral ∫_a^bf(x)  x is defined for continuous functions f(x) on finite, closed intervals [a, b] using a limit of Riemann sums. In practice however, there will be times when we want to evaluate an integral that does not satisfy these conditions; we use improper integrals as an extension of the definite integral to cover some of these cases.

Example 18.1, Integrals that are Improper at an Endpoint.

    The first class of improper integrals that we shall consider are those which are improper at one endpoint. Suppose that we have a function f(x) defined on an interval [a, b]. We know that the definite integral ∫_a^bf(x)  x is defined under the supposition that the function f(x) is continuous on the entire closed interval [a, b]. We would like to relax this restriction, so let us suppose instead that f(x) is only continuous on (a, b]. In this case, although the integral ∫_a^bf(x)  x  is not defined, we can define the integral ∫_c^bf(x)  x for a<c<b. Doing so, we can then ask what happens to the value of this integral as ca^+. If this limit exists, we shall say that the improper integral ∫_a^bf(x)  x exists, and that
            ∫_a^bf(x)  x =Underscript[lim, ca^+] ∫_c^bf(x)  x.
Note that this limit may, or may not, exist. If the limit exists, we say that the improper integral converges, while if the limit does not exist, we say that the improper integral diverges.
    Let us illustrate this idea with a pair of examples. We start with the function f(x) = x^(-1/2)

Clear[f] f[x_] := x^(-1/2)

which is defined and continuous on the interval (0, 1]; however it is not continuous from the right at 0 because it becomes infinite there. For verification, we can examine the graph

Plot[f[x], {x, 0, 1}, PlotStyle->RGBColor[1, 0, 0]] ;

[Graphics:HTMLFiles/index_22.gif]

and see that these properties hold.

    We now would like to integrate f(x) from 0 to 1. Since f(x) is not continuous on [0, 1] the usual integral is not defined, but the improper integral may be defined. Indeed, for 0<c<1 we can calculate the integral ∫_c^1f(x)  x as

Integrate[f[x], {x, c, 1}, Assumptionsc>0]

2 - 2 c^(1/2)

(We need to tell Mathematica that c>0, so we have used the Assumptions-> c > 0 command).

Clearly the limit of this expression as c0^+ is 2. We can verify this fact with the aid of Mathematica. First, give the expression a name, say Int.

Int[c_] := Integrate[f[x], {x, c, 1}]

We then use Mathematica's Limit command

Limit[Int[c], c->0, Direction-> -1]

2

We used the Direction->-1 option because we are taking the limit from the right side.

    As a consequence of these calculations, we conclude that the improper integral ∫_0^11/x^(1/2)  x converges, and  that ∫_0^11/x^(1/2)  x = 2.

    As another example, consider g(x) = 1/x^2 on the same interval (0, 1]. Like f(x), the function g(x) is continuous on (0, 1] but is not continuous on [0, 1], so if its integral from 0 to 1 exists, it must be defined as an improper integral. Here is the corresponding graph.

Clear[g] g[x_] := 1/x^2 Plot[g[x], {x, 0, 1}, PlotStyle-> RGBColor[1, 0, 0]] ;

[Graphics:HTMLFiles/index_44.gif]

Again, we calculate the value of ∫_c^1g(x)  x.

Clear[Int] ; Int[c_] := Integrate[g[x], {x, c, 1}, Assumptionsc>0] ; Print[Int[c]]

-1 + 1/c

As c0^+, we see immediately that this expression tends to ∞. We can verify this with the aid of Mathematica.

Limit[Int[c], c->0, Direction-> -1]

∞

As we can see, in this case the limit does not exist, so the improper integral diverges.

    We point out that although these examples had their discontinuities at the left endpoint, the same process is valid for functions that have their discontinuity at the right endpoint. Remember that if we want Mathematica to find a limit of the form xb^-, we must use the Direction->1 option in the limit command.

    It may seem odd that the integral ∫_0^11/x^(1/2)  x is convergent while the integral ∫_0^1 1/x^2 x is divergent; after all both functions have the same general behavior. However, if we plot the functions 1/x^(1/2) (in red) and 1/x^2 (in blue) on the same axes we can see a qualitative difference between them; the function 1/x^2appears to blow up faster than 1/x^(1/2) does.

Plot[{1/Sqrt[x], 1/x^2}, {x, 0, 1}, PlotStyle-> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}, PlotRange-> {0, 20}] ;

[Graphics:HTMLFiles/index_59.gif]

This difference is reflected in the fact that the integral of 1/x^(1/2) is convergent, while the integral of 1/x^2 is divergent. A word of caution- you can not determine whether or not a given improper integral converges merely by looking at the graph; you must always analyze the integral in the same fahsion as we have demonstrated above.

    There is one Mathematica issue which needs to be mentioned. When Mathematica is asked to evaluate an integral, it will try to check to see if the integral is improper, and whether or not it converges. If it can not decide if an integral is convergent, Mathematica will generate a warning. Because we are checking for the convergence of our integrals directly, we do not need Mathematica to do it for us; we certainly don't want it interjecting warnings. To turn these warnings off, we execute the command

Off[Integrate :: gener]

Experiment 18.1a

    Determine which of these improper integrals converge. If the integral converges, find its value.

    1. ∫_1^51/(x - 1)^(1/2)  x.
    
    2. ∫_3^4 1/(4 - x)^(3/2)  x.
    
    3. ∫_0^(π/2)tan(x) dx.

Experiment 18.1b

    Consider the improper integral ∫_0^1 (1/x)^p x for different values of p. Determine for which values of p the improper integral is convergent, and for which values of p the improper integral is divergent. Explain your reasoning.

Example 18.2, Integrals that are Improper Within the Interval.

    We can also consider functions that have discontinuities within the interval of integration. For instance, suppose we wanted to calculate ∫_ (-1)^1 -ln (x^2 - x + 1/4)  x. If we graph this function, we see that it is not continuous on the entire interval [-1, 1] because of its asymptote at x = 1/2.

Clear[f] ; f[x_] := -Log[x^2 - x + 1/4] ; Plot[f[x], {x, -1, 1}, PlotStyle->RGBColor[1, 0, 0]] ;

[Graphics:HTMLFiles/index_76.gif]

Limit[f[x], x->0.5]

∞

Although this loss of continuity prevents us from considering∫_ (-1)^1 -ln (x^2 - x + 1/4) x as a conventional integral, we can consider it as an improper integral. In particular, we define
            ∫_ (-1)^1 -ln (x^2 - x + 1/4) x =∫_ (-1)^(1/2) -ln (x^2 - x + 1/4)  x +∫_ (1/2)^1 -ln (x^2 - x + 1/4) x
where the two integrals on the right are improper integrals of the type that we have already discussed. To evaluate ∫_ (-1)^1 -ln (x^2 - x + 1/4)  x, we evaluate each of the improper integrals A = ∫_ (1/2)^1 -ln (x^2 - x + 1/4) x and B = ∫_ (-1)^(1/2) -ln (x^2 - x + 1/4)  x, then add the results.

    Indeed, here we evaluate A

Clear[Int1, Int2] Int1[c_] := Integrate[f[x], {x, c, 1}]  A = Limit[Int1[c], c->1/2, Direction-> -1]

1 + Log[2]

and here we evaluate B.

Int2[b_] := Integrate[f[x], {x, -1, b}, Assumptionsb<.5] B = Limit[Int2[b], b->1/2, Direction->1]

3 - Log[27/8]

Result = A + B

4 + Log[2] - Log[27/8]

Simplify[%]

4 - Log[27/16]

Thus we can conclude that ∫_ (-1)^1 -ln (x^2 - x + 1/4)  x = 4 - ln (27/16).

    This process is valid in general. In particular, suppose we have a function f(x) dicsontinuous at a point c that is continuous on each of the intervals [a, c) and (c, b]. Then, although the discontinuity prevents us from considering ∫_a^bf(x)  x as a conventional definite integral, we can consider it an improper integral of the form ∫_a^bf(x)  x = ∫_a^cf(x)  x + ∫_c^bf(x)  x where each of the two integrals on the right are improper integrals of the form discussed in Example 18.1.

Experiment 18.2

    Determine which of these integrals are improper by plotting the integrand. For those that are, decide if they are convergent, and if convergent, find their value.
    
    1.  ∫_0^5tan(x)  x.
    
    2. ∫_ (-2)^2ln (x^2) x
    
    3. ∫_0^21/(x - 1)^2x

Example 18.3, Improper Integrals with Infinite Limits of Integration.

    There is another way an integral can be improper. Instead of the usual case where the integral is taken over a bounded interval, the integral could be taken over an infinite interval. In particular, we might want to evaluate an integral of the form ∫_a^∞f(x)  x. Because the upper limit of integration is ∞, integrals such as this have not yet been defined; our Riemann sum definition of the integral required a continuous function on a closed interval [a, b]. However, we can define this as an improper integral; in particular we define
            ∫_a^∞f(x)  x = lim_ (b∞) ∫_a^bf(x)  x.

    As an example, consider the function f(x) = 1/(x^2 + x + 1). We can evaluate ∫_0^∞ 1/(x^2 + x + 1)  x as follows.

Clear[f, Int] ; f[x_] := 1/(x^2 + x + 1) ; Int[b_] := Integrate[f[x], {x, 0, b}, Assumptionsb>0] ; Print[Int[b]]

(2 (π - 3 ArcCot[(1 + 2 b)/3^(1/2)]))/(3 3^(1/2))

Limit[Int[b], b->∞]

(2 π)/(3 3^(1/2))

The symbol ∞ which appears in the Limit command can be obtained by hitting the escape key, typing "inf", and hitting the escape key once more. Alternatively, one can enter the symbol directly from the Basic Typesetting Palette.

    It may seem a bit unusual for an integral with an infinite limit of integration to have a finite value; after all the region of integration is infinite. To see that this is plausible, let us examine a graph of our function.

Plot[1/(x^2 + x + 1), {x, 0, 10}, PlotStyle->RGBColor[1, 0, 0]] ;

[Graphics:HTMLFiles/index_118.gif]

We can then see that the height of the graph of f(x) is nearly zero for all large values of x; this explains how we can have a finite area beneath an infinitely long curve.
    Let us point out, however, that simply because the curve tends to zero as x tends to infinity, we can not necessarily conclude that the improper integral is convergent. For example, consider ∫_0^∞ 1/(x + 1)^(1/2)  x . If we plot the integrand, we see that it also tends to zero as x tends to infinity.

Plot[1/(Sqrt[x + 1]), {x, 0, 100}, PlotStyle->RGBColor[1, 0, 0], PlotRange-> {0, 1}] ;

[Graphics:HTMLFiles/index_125.gif]

On the other hand, to evaluate the improper integral, we first evaluate ∫_0^c 1/(x + 1)^(1/2)  x, and then pass to the limit as c∞.

Int[c_] := Integrate[1/(Sqrt[x + 1]), {x, 0, c}] ; Limit[Int[c], c->∞]

∞

Thus our calculation shows us that this improper integral is divergent.

    To get a feel why the previous two integrals are different, we can plot the functions f(x) = 1/(x^2 + x + 1) (in red) and g(x) = 1/(x + 1)^(1/2) (in blue) on the same axes; doing so we obtain the following.

Plot[{1/(x^2 + x + 1), 1/Sqrt[x + 1]}, {x, 0, 100}, PlotStyle-> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}] ;

[Graphics:HTMLFiles/index_133.gif]

Looking at the graphs, we can see why it is reasonable that the integral of f(x) is finite while the integral of g(x) is infinite. Keep in mind though, that in general you can not tell whether an improper integral is convergent or divergent by looking at the graph of the integrand.

    Finally, we point out that analogous results hold for integrals when the lower limit of integration is -∞.

Experiment 18.3a

    Determine which of these improper integrals converge. If the integral is convergent, find its value.

    1. ∫_4^∞1/(x - 1)^(1/3)  x.
    
    2. ∫_ (-∞)^0 1/(4 - x)^(3/2)  x.
    
    3. ∫_0^∞x e^(-2x)dx

Experiment 18.3b

    Consider the improper integral ∫_1^∞ (1/x)^p x for different values of p. Determine for which values of p the improper integral is convergent, and for which values of p the improper integral is divergent. Explain your reasoning.

Solution

Clear[Int, c] Int[c_] := Integrate[1/x^p, {x, 1, c}] Int[c]

-1/(1 - p) + c^(1 - p)/(1 - p)

We see that if p>1 then the limit as c∞ is finite, while if p<1, the limit is infinite. The given result is not valid when p = 1, so we handle that separately.

Clear[Int, c] Int[c_] := Integrate[1/x, {x, 1, c}] Limit[Int[c], c->∞]

∞

We conclude that the integral is convergent if p>1 and divergent otherwise.

Example 18.4, Integrals that are Improper for More than One Reason.

    We can also evaluate integrals where both limits of integration are infinite. For instance, consider ∫_ (-∞)^∞1/(x^2 + 1)  x. This is improper because it has two infinite limits of integration. To evaluate it, we rewrite it as

    ∫_ (-∞)^∞1/(x^2 + 1) x = ∫_ (-∞)^361/(x^2 + 1) x + ∫_36^∞1/(x^2 + 1) x
    
You may wonder why we broke the interval at x = 36 instead of at some other point. The answer is that the method used to break up the region of integration plays no role in the final answer. We could just as easily have used x = 0 or x = -237. The key thing to note here is that each of the two integrals that remain are improper of the form discussed in Example 18.3. To continue, we can proceed as follows.

Clear[f, Int1, Int2] ; f[x_] := 1/(x^2 + 1) ; Int1[c_] := Integrate[f[x], {x, c, 36}, Assumptionsc<36] ; Print[Int1[c]]

If[c>0, -ArcTan[1/36] + ArcTan[1/c], Integrate[1/(1 + x^2), {x, c, 36}, Assumptionsc≤0]]

A = Limit[Int1[c], c-> -∞]

π/2 + ArcTan[36]

Int2[b_] := Integrate[f[x], {x, 36, b}, Assumptionsb>36] ; Print[Int2[b]]

ArcTan[1/36] - ArcTan[1/b]

B = Limit[Int2[b], b->∞]

ArcTan[1/36]

Result = A + B

π

    We conclude that ∫_ (-∞)^∞1/(x^2 + 1)  x = π.
    Finally, we point out that it is possible for integrals to be improper both because they have an unbounded domain of integration as well as because of a discontinuity. The previous principle still applies though. Break the integral up into pieces, each of which is improper for exactly one reason, and then add the results. Here is an example of that process. Suppose we want to find ∫_0^∞e^(-x^(1/2))/x^(1/2)  x.

Clear[f, Int1, Int2] f[x_] := (E^-Sqrt[x])/Sqrt[x] ; Plot[f[x], {x, 0, 10}, PlotStyle->RGBColor[1, 0, 0]] ;

[Graphics:HTMLFiles/index_175.gif]

We see that the integral is improper both because of an infinite domain of integration as well as the singularity at the origin. Thus we split the integral into two parts
        
        ∫_0^∞e^(-x^(1/2))/x^(1/2) x = ∫_0^1e^(-x^(1/2))/x^(1/2) x + ∫_1^∞e^(-x^(1/2))/x^(1/2) x
        
and evaluate each individually. Note again that we split the integral at x = 1 for convenience; we could just as easily have split it at x = 22, 937 had we wanted to do so.

Int1[c_] := Integrate[f[x], {x, c, 1}, Assumptionsc>0] ; Print[Int1[c]]

-2/ + 2 ^(-c^(1/2))

A = Limit[Int1[c], c->0]

2 - 2/

Int2[c_] := Integrate[f[x], {x, 1, c}, Assumptionsc>1] Print[Int2[c]]

2/ - 2 ^(-c^(1/2))

B = Limit[Int2[c], c->∞]

2/

A + B

2

We conclude that  ∫_0^∞e^(-x^(1/2))/x^(1/2)  x = 2.
    As a final example, let us consider ∫_0^∞1/x^(1/2) x. We see that this integral is improper both at the origin, because the function is not continuous there, as well as because the region of integration is infinite. We can then split the region of integration into two parts as follows ∫_0^∞1/x^(1/2) x = ∫_0^11/x^(1/2) x + ∫_1^∞1/x^(1/2) x. Each of these integrals can now be evaluated.

Clear[f, c, Int1, Int2] f[x_] := 1/Sqrt[x] ; Int1[c_] := Integrate[f[x], {x, c, 1}] ; Limit[Int1[c], c->0, Direction-> -1]

2

Thus we see that ∫_0^11/x^(1/2) x is convergent, and ∫_0^11/x^(1/2) x = 2. Now we look at the second integral.

Clear[f, c, Int1, Int2] f[x_] := 1/Sqrt[x] ; Int1[c_] := Integrate[f[x], {x, 1, c}] ; Limit[Int1[c], c->∞]

∞

This tells us that the second integral ∫_1^∞1/x^(1/2) x is divergent. As a consequence, we conclude that the original integral ∫_0^∞1/x^(1/2) x is divergent. This is the case, even though one of its components is convergent. An integral that is improper for more than one reason is convergent only if each of its components is convergent; if one fails to be convergent then the entire integral is divergent.

Experiment 18.4

    Determine which of these improper integrals converge. For those that are convergent, find their value. You may need to plot graphs of the integrands to determine the points at which the integrals become improper.

    1. ∫_ (-∞)^∞e^(-x)  x
    
    2. ∫_ (-∞)^∞1/(e^x + e^(-x)) x
    
    3. ∫_1^∞1/(x^2 (x - 1)^(1/2)) x
    
    4. ∫_0^∞sin(x)/xx

Credits

These laboratories were created by Raouf Boules, Geoff Goodson, Ohoe Kim and Mike O'Leary for use in the Calculus courses of Towson University. Commercial use is prohibited without permission of the authors. Non-commercial use is permitted, provided this credit section is retained.


Created by Mathematica  (August 20, 2004)