Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
84 views
sage.plot.graphics.Graphics.SHOW_OPTIONS['figsize']=4

#Improper Integrals

A definite integral is considered "improper" if the interval of integration is unbounded, the function being integrated is unbounded on the interval of integration, or both. In such cases, the usual definition of the definite integral does not apply.

###Example 1

Consider the function f(x)=1x2\displaystyle f(x)=\frac{1}{x^2}. Suppose we wanted the area under this curve for x1x\ge1; in other words, we want 1f(x)dx\displaystyle \int_1^{\infty} f(x)\,dx. This is an infinite region, so you might assume that it has infinite area. However, in this case the area is actually finite.

To see this, consider the integral 1t1x2dx\displaystyle\int_1^t \frac{1}{x^2}\,dx for any t>1t>1. This is a normal definite integral, and the answer is 11t\displaystyle 1-\frac{1}{t}.

What happens as tt\to\infty? We have 11t1\displaystyle 1-\frac{1}{t}\to 1.

So it make sense to say 1f(x)dx=1\displaystyle\int_1^{\infty}f(x)\,dx=1.

plot(1/x^2,xmin=0,xmax=10,ymax=2)+plot(1/x^2,xmin=1,xmax=10,fill='axis')

###Infinite Intervals

The previous example falls under the first type of improper integral, when one or both of the limits of integration is ±\pm\infty. In this case, the region under the curve is infinite in the horizontal direction.

Here is the definition:

If atf(x)dx\displaystyle\int_a^tf(x)\,dx exists for every tat\ge a, then we define af(x)dx=limtatf(x)dx\displaystyle\int_a^{\infty}f(x)\,dx=\lim_{t\to \infty}\int_a^tf(x)\,dx, provided this limit exists.

If the limit exists, we say the improper integral converges (or is convergent). Otherwise, we say it diverges (or is divergent).

Similarly, if tbf(x)dx\displaystyle\int_t^bf(x)\,dx exists for every tbt\le b, then we define bf(x)dx=limttbf(x)dx\displaystyle\int_{-\infty}^bf(x)\,dx=\lim_{t\to -\infty}\int_t^bf(x)\,dx, provided this limit exists.

Also, if there is a number aa such that af(x)dx\displaystyle\int_{-\infty}^af(x)\,dx and af(x)dx\displaystyle\int_a^{\infty}f(x)\,dx both converge, then we define f(x)dx=af(x)dx+af(x)dx\displaystyle\int_{-\infty}^{\infty}f(x)\,dx=\int_{-\infty}^af(x)\,dx+\int_a^{\infty}f(x)\,dx.

Note: If these integrals converge for one value of aa, then they converge for any value of aa. The answer does not depend on the choice of aa.

It is interesting that limtttf(x)dx\displaystyle\lim_{t\to\infty}\int_{-t}^tf(x)\,dx may not equal f(x)dx\displaystyle\int_{-\infty}^{\infty}f(x)\,dx.

###Example 2

Let's explore integrals of the form 11xpdx\displaystyle\int_1^{\infty}\frac{1}{x^p}\,dx.

We already saw what happens when p=2p=2 above, so let's try p=1, 3, 12, 32,p=1,\ 3,\ \frac{1}{2},\ \frac{3}{2}, etc.

@interact def _(p=2): t=var('t') assume(t>1) print 'Take the limit as t goes to infinity of' show(integral(1/x^p,x,1,t,algorithm="sympy")) forget() try: S=integral(1/x^p,x,1,+Infinity,algorithm="sympy") print 'The integral is', S except ValueError: print 'The integral diverges.'
Interact: please open in CoCalc

###Unbounded Integrands

The second type of improper integral is when the integrand (the function being integrated) is unbounded on the interval of integration. In this case, the region under the curve is infinite in the vertical direction.

###Example 3

Consider 01ln(x)dx\displaystyle\int_0^1 \ln(x)\, dx.

We have finite limits of integration, but notice that ln(x)\ln(x) is not bounded on the interval [0,1][0,1], since limx0+ln(x)=\displaystyle\lim_{x\to 0^+}\ln(x)=-\infty.

plot(log(x),xmin=0,xmax=2,ymin=-4)+plot(log(x),xmin=0,xmax=1,fill='axis')

Notice that for 0<t<10 < t < 1 we have t1ln(x)dx=ttln(t)1\displaystyle\int_t^1\ln(x)\,dx=t-t\ln(t)-1.

If we try to compute this integral in Sage, it will ask us for more information.

t=var('t') integral(log(x),x,t,1)
Error in lines 2-2 Traceback (most recent call last): File "/projects/e80918f8-2f9e-47af-94bd-83ddd64ff966/.sagemathcloud/sage_server.py", line 873, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/misc/functional.py", line 802, in integral return x.integral(*args, **kwds) File "sage/symbolic/expression.pyx", line 10229, in sage.symbolic.expression.Expression.integral (build/cythonized/sage/symbolic/expression.cpp:50961) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 712, in integrate return definite_integral(expression, v, a, b, hold=hold) File "sage/symbolic/function.pyx", line 914, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:9269) File "sage/symbolic/function.pyx", line 504, in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:5911) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 175, in _eval_ return integrator(*args) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py", line 21, in maxima_integrator result = maxima.sr_integral(expression, v, a, b) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 785, in sr_integral self._missing_assumption(s) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 994, in _missing_assumption raise ValueError(outstr) ValueError: Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(t-1>0)', see `assume?` for more details) Is t-1 positive, negative or zero?

Sage needs some information about t. We can give it this information using the assume command.

t=var('t') assume(t>0) assume(t<1) integral(log(x),x,t,1) forget() #this forgets the assumptions
-t*log(t) + t - 1

What happens as t0t\to0?

limit(t-t*log(t)-1,t=0,dir='+') #use L'Hospital's Rule for t*ln(t)
-1

So it makes sense to define 01ln(x)dx=1\displaystyle\int_0^1\ln(x)\,dx=-1.

Here's the definition in general:

If f(x)f(x) is continuous on the interval (a,b](a,b] and is unbounded near aa, then we define abf(x)dx=limta+tbf(x)dx\displaystyle\int_a^bf(x)\,dx=\lim_{t\to a^+}\int_t^bf(x)\,dx, provided this limit exists.

Similarly, if f(x)f(x) is continuous on the interval [a,b)[a,b) and is unbounded near bb, then we define abf(x)dx=limtbatf(x)dx\displaystyle\int_a^bf(x)\,dx=\lim_{t\to b^-}\int_a^tf(x)\,dx, provided this limit exists.

Also, if f(x)f(x) is continuous on the intervals [a,c)[a,c) and (c,b](c,b] and unbounded near cc, then we define abf(x)dx=acf(x)dx+cbf(x)dx\displaystyle\int_a^bf(x)\,dx=\int_a^cf(x)\,dx+\int_c^bf(x)\,dx, provide both of these converge.

###Example 4

031xxdx\int_0^3\frac{1}{x\sqrt{x}}\,dx

Let's look at a graph of the integrand. Notice that it is unbounded near 0.

plot(1/(x*sqrt(x)),xmin=0,xmax=3,ymax=10)

Thus, this is an improper integral, so 031xxdx=limt0+t31xxdx=limt0+233+2t=\int_0^3\frac{1}{x\sqrt{x}}\,dx=\lim_{t\to 0^+}\int_t^3\frac{1}{x\sqrt{x}}\,dx=\lim_{t\to 0^+}-\frac{2\sqrt{3}}{3}+\frac{2}{\sqrt{t}}=\infty

Therefore, this integral diverges.

t=var('t') assume(t>0) #don't forget these assumptions assume(t<3) show(integral(1/(x*sqrt(x)),x,t,3)) forget()
233+2t\displaystyle -\frac{2}{3} \, \sqrt{3} + \frac{2}{\sqrt{t}}
limit(-2/3*sqrt(3)+2/sqrt(t),t=0,dir='+')
+Infinity

Note that Sage can handle improper integrals. It informs us that this integral is divergent (see the last line of the error output).

integral(1/(x*sqrt(x)),x,0,3)
Error in lines 1-1 Traceback (most recent call last): File "/projects/e80918f8-2f9e-47af-94bd-83ddd64ff966/.sagemathcloud/sage_server.py", line 873, in execute exec compile(block+'\n', '', 'single') in namespace, locals File "", line 1, in <module> File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/misc/functional.py", line 802, in integral return x.integral(*args, **kwds) File "sage/symbolic/expression.pyx", line 10229, in sage.symbolic.expression.Expression.integral (build/cythonized/sage/symbolic/expression.cpp:50961) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 712, in integrate return definite_integral(expression, v, a, b, hold=hold) File "sage/symbolic/function.pyx", line 914, in sage.symbolic.function.BuiltinFunction.__call__ (build/cythonized/sage/symbolic/function.cpp:9269) File "sage/symbolic/function.pyx", line 504, in sage.symbolic.function.Function.__call__ (build/cythonized/sage/symbolic/function.cpp:5911) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/integral.py", line 175, in _eval_ return integrator(*args) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/symbolic/integration/external.py", line 21, in maxima_integrator result = maxima.sr_integral(expression, v, a, b) File "/usr/local/sage/sage-6.4/local/lib/python2.7/site-packages/sage/interfaces/maxima_lib.py", line 783, in sr_integral raise ValueError("Integral is divergent.") ValueError: Integral is divergent.

Example 5

What if our improper integral has its unbounded value in the interior of the integration interval? We split into two differnt integrals! Consider the integral,

031x1\int_{0}^{3}\frac{1}{x-1}

For this integral, there is a vertical asymptote at x=1x=1

plot(1/(x-1),x,0,3,fill='axis',ymin=-10,ymax=10)

To evaluate this improper integral, we split up our integral into a left and right portion,

031x1dx=01dxx1+13dxx1\int_{0}^{3}\frac{1}{x-1}dx=\int_{0}^{1}\frac{dx}{x-1}+\int_{1}^{3}\frac{dx}{x-1}

Both of these integrals are improper so we replace the offending limit of integration with a limit:

031x1dx=lima10adxx1+limb1+b3dxx1\int_{0}^{3}\frac{1}{x-1}dx=\lim_{a\rightarrow 1^{-}}\int_{0}^{a}\frac{dx}{x-1}+\lim_{b\rightarrow 1^{+}}\int_{b}^{3}\frac{dx}{x-1}

Evaluating, we find,

lima10adxx1=lima1lnx11a=lima1lna1=\lim_{a\rightarrow 1^{-}}\int_{0}^{a}\frac{dx}{x-1}=\lim_{a\rightarrow 1^{-}}\ln|x-1||^{a}_{1}=\lim_{a\rightarrow 1^{-}}\ln|a-1|=-\inftylimb1+b3dxx1=limb1+ln(x1)3b=limb1+ln(2)ln(b1)=\lim_{b\rightarrow 1^{+}}\int_{b}^{3}\frac{dx}{x-1}=\lim_{b\rightarrow 1^{+}}\ln(x-1)|^{b}_{3}=\lim_{b\rightarrow 1^{+}}\ln(2)-\ln(b-1)=\infty

As one (actually both) of these integrals diverge, the origional integral does not converge. It is wrong to say that the integral is +()=0\infty+(-\infty)=0.

###Example 6

1919xdx\int_1^9\frac{1}{\sqrt{9-x}}\,dx

When we look at the graph, we see that the integrand is unbounded near 9.

plot(1/sqrt(9-x),xmin=1,xmax=9,ymax=10)

So we have 1919xdx=limt91t19xdx=limt9(4229t)=42=25/2\int_1^9\frac{1}{\sqrt{9-x}}\,dx=\lim_{t\to 9^-}\int_1^t\frac{1}{\sqrt{9-x}}\,dx=\lim_{t\to 9^-}(4\sqrt{2}-2\sqrt{9-t})=4\sqrt{2}=2^{5/2}

t=var('t') assume(t<9) assume(t>1) integral(1/sqrt(9-x),x,1,t) forget()
(4*sqrt(2)) - 2*sqrt(-t + 9)
limit(4*sqrt(2) - 2*sqrt(-t + 9),t=9,dir='-')
2^(5/2)

Here is the direct computation:

integral(1/sqrt(9-x),x,1,9)
2^(5/2)

###Example 7

01x(1+x)dx\int_0^{\infty}\frac{1}{\sqrt{x}(1+x)}\,dx

Notice that the interval of integration is unbounded, and the integrand is unbounded near 0. So we need to split this up into two integrals.

plot(1/(sqrt(x)*(1+x)),xmin=0,xmax=10,ymax=5)

So we have

01x(1+x)dx=limt0+t11x(1+x)dx+limt1t1x(1+x)dx\int_0^{\infty}\frac{1}{\sqrt{x}(1+x)}\,dx=\lim_{t\to 0^+}\int_t^1\frac{1}{\sqrt{x}(1+x)}\,dx+\lim_{t\to \infty}\int_1^t\frac{1}{\sqrt{x}(1+x)}\,dx=limt0+(π22arctan(t))+limt(π2+2arctan(t))=π2+π2=π=\lim_{t\to 0^+}\left(\frac{\pi}{2}-2\arctan(\sqrt{t})\right)+\lim_{t\to\infty}\left(-\frac{\pi}{2}+2\arctan(\sqrt{t})\right)=\frac{\pi}{2}+\frac{\pi}{2}=\pi

Note: The choice of 1 as the other limit of integration was arbitrary.

t=var('t') assume(t>0) assume(t<1) integral(1/(sqrt(x)*(1+x)),x,t,1) forget()
1/2*pi - 2*arctan(sqrt(t))
t=var('t') assume(t>1) integral(1/(sqrt(x)*(1+x)),x,1,t) forget()
-1/2*pi + 2*arctan(sqrt(t))
limit(1/2*pi - 2*arctan(sqrt(t)),t=0,dir='+')
1/2*pi
limit(-1/2*pi + 2*arctan(sqrt(t)),t=+Infinity)
1/2*pi

Here's the direct calculation:

integral(1/(sqrt(x)*(1+x)),x,0,+Infinity)
pi

Note: If you get an error that says "Assumption is redundant" or "Assumption is inconsistent," then find a blank line, type forget(), and hit run.

#Improper Integrals Assignment

For each integral below:

  • Graph the integrand (the function inside the integral).

  • State why the integral is improper (there may be more than one reason).

  • Set up an appropriate limit to compute the value of the integral and calculate the limit.

  • Evaluate the integral, and compare the answer with the limit above.

###Question 1

01x2+2x+4dx\displaystyle\int_0^{\infty} \frac{1}{x^2+2x+4}\,dx

###Question 2

011xdx\displaystyle\int_0^1\frac{1}{\sqrt{x}}\,dx

###Question 3

0101(x5)2dx\displaystyle\int_0^{10}\frac{1}{ (x-5)^{2}}\,dx