Exploring the e-d definition of limit with Mathematica

by Shari Prevost

Mathematica in Education
Vol. 3 No.4
Copyright 1994
TELOS/Springer-Verlag

Introduction

While most students feel comfortable with intuitive versions of the definition of limit, they usually  are unable to digest its rigorous cousin:  the formal e-d definition of limit.  Typically we present this precise notion of limit and then show how to use the definition to verify limits of (mostly) linear functions.  Our students are then asked to do a few e-d limit proofs for linear functions.  Most accomplish this task by recognizing that in all of our ``linear examples'' d is always given by e/|m|, where f(x) = máx + b.  The majority of them fail to understand the special relationship between the function's behavior near a point, the choice of e and a corresponding ``good'' d.

Many might argue that the e-d definition of limit need not be dicussed in a first semester of calculus.  Although the inuitive approach is certainly sufficient in the less rigorous calculus sequences, I feel we should expose our students to both the intuitive ideas of limit and the precise language of the e-d definition in any first semester calculus course which is part of the mathematics major.  It is important in these early stages to stress that mathematics provides language which quantifies all of the terms and concepts introduced and used.  This early exposure to the concreteness of mathematics helps strip away the ``trick up your sleeve'' mentality many students associate to mathematics and also lessens the impact of the brick wall of rigour students seem to hit in their upper level courses.

However the presentation of the e-d definition in a first semester calculus course does not need to be entirely rigorous.  Instead of requiring students to find a precise algebraic relationship between a function near a particular point, an arbitrary e and the ``best choice'' for d (except, perhaps, in the case of a linear function), it is enough for the students to grasp the idea that when a limit exists at a point, then for any positive value of e we can always find a value for d which satisfies the definition.  There is plenty of time in later courses to determine an exact relationship between e and d.  In first semester calculus we need only plant the seed for the precise e-d arguments.

A computer algebra system, such as Mathematica, can provide graphics and quick computations which allow students to discover that there is a relationship between an e and a suitable d in the definition of the limit.  This note describes two Mathematica packages, LimitPlot and LimitPlotDelta, which can be used to supply graphical evidence that suitable d's can be found for any choice of a positive e whenever a function has a limit at a particular point.

Graphical approach to the e-d definition

To ease the student into an e-d proof of the limit it is helpful to first let him/her explore the graphical relationship between different values for e and corresponding working values for d.   For example, suppose we propose to find the limit of the function f(x) = x2 + 1 at x = 2.  We could write out a rigorous proof that for any choice of e, d = min{1,e/5} shows that  
limx®2 x2 + 1 = 5.  Most students will be asleep by the time we finish.  Instead we could begin by asking the student to discover whether or not certain given values for d are suitable for a prescribed e.  To help the student accomplish this task, one could begin by asking the student to answer the following set of questions.

Consider the function f(x) = x^2 + 1.

(a)  What is the limit of f as x approaches 2?

(b)  Let e=1.  Does the choice of d=1 satisfy the definition of limit for f(x) = x^2 + 1, x->2?  (I.e., is it true that for any x-value with the property |x-2|<1, then |f(x)-5|<1?)  Explain.

(c)  Again let e=1.  Does the choice of d=1/10 satisfy the definition of limit for f(x) = x^2 + 1, x->2?  (I.e., is it true that for any x-value with the property |x-2|<1/10, then |f(x)-5|<1?)  Explain.

(d)  Can you find (other) values for d when e=1 which satisfy the definition of limit for 
f(x) = x^2 + 1, x->2?

(e)  Would the value d=min{1,1/5} for e=1 be suitable in the definition of limit for f(x) = x^2 + 1 as x->2?

The student could then gather more evidence by running through the same set of questions a second time with a different value for e and appropriately changed choices for d.

Without some kind of visual or graphical help, most students would find it very difficult to answer the above set of questions.  This hardship can be alleviated with the appropriate graphical tools.  As part of our growing Mathematica-based computer laboratory for calculus at Dickinson College, I have developed two such tools:  the Mathematica commands LimitPlot and LimitPlotDelta.

LimitPlotDelta

Let's return to our example:  limx®2 x2 + 1 = 5.  Suppose the task is to determine whether or not d=1 satisfies the definition of limit for the choice of e = 1.  The LimitPlotDelta command can get the ball rolling.  LimitPlotDelta will graph the function in the specified d-region in red, while the function outside of the region is drawn in black.  The user can easily decide if the function's values in the region (2-d,2+d) fall in the light blue horizontal band of width 2e centered at the proposed limit.  If the red portion of the graph falls outside the horizontal blue band, then the function has values farther away than e=1 from the proposed limit somewhere in the d-region around x=2; otherwise if the red portion of the graph of f is entirely enclosed in the blue horizontal band, then the function's values in the d-band about x=2 are guaranteed to be less than e=1 away from the proposed limit of 5, and hence we have found a suitable d for e=1. The usage statement for LimitPlotDelta is given below.

?LimitPlotDelta

Returning to our example with f(x) = x2 + 1, x->2, e=1 and d=1, LimitPlotDelta yields the following sketch.

LimitPlotDelta[x^2 + 1, x->2, 5, 1, 1]

As we can see, the function's graph leaves the light blue horizontal region. (Recall that the light blue horizontal strip denotes the region (5-e, 5+e).)  This indicates that we can find at least one x-value in the interval (2-d,2+d) which yields an f(x) value which is farther than 1 from 5.  The number x=1.3 is such a value.  Hence we may conclude that d=1 does not satisfy the definition of limit for f(x) = x2 + 1 as x->2 for e=1.

Next we check whether or not the second choice for d, d=1/10, is suitable when e=1.

LimitPlotDelta[x^2+1,x->2,5,1,.1]

In this case, the red portion of the sketch of f(x) is entirely within the blue horizontal strip, which signifies that this choice of d for e=1 satisfies our limit definition.

LimitPlot

The earlier set of questions asked the student to determine whether or not specific values for d satisfied the limit definition for a given value of e.  Why not up the ante?  The next set of exercises could ask the student to find a suitable d for a given e.  One such example might be to again consider the function f(x) = x2 + 1, but this time ask about the limit of f as x->1.  Suppose we first set e=1/2 and then require the student to find a suitable value for d.  Using the first two sets of questions as a guide, the student might try guessing a value for d and using LimitPlotDelta to see if his/her attempt was successful.  While this is not a bad strategy, it might be more productive to first see a picture of the function near the point of interest with the e-neighborhood of the proposed limit marked on the sketch.  This would enable the user to use Mathematica's ``cross-hairs'' to find a suitable d, thus eliminating the ``guess work.''  The command LimitPlot performs this function.

?LimitPlot

Using LimitPlot with f(x) = x2 + 1 as x->1 with e=1/2, we obtain:

LimitPlot[x^2+1,x->1,2,.5]

An examination of the graph using the cross-hairs shows that d = 0.2 should be a value which works for e = 0.5.  To verify whether or not this is a valid choice for d we then use the LimitPlotDelta command.

LimitPlotDelta[x^2+1,x->1,2,.5,.2]

As we see from the above graphic, our selection of d=0.2 is suitable for e=0.5.
     The code for LimitPlot may be found at the end of this article.

Besides verifying the existence of certain limits, both LimitPlotDelta and LimitPlot can be used to show that some limits do not exist.  Consider the (favorite) example where f(x)=Sin(1/x) near the x-value 0.  Suppose we wish to investigate whether or not the limit of f as x->0 is 0.  For a choice of e = 0.5, LimitPlot yields the following graphic:

LimitPlot[Sin[1/x],x->0,0,.5]

Because of the drawbacks of the graphing capabilities of Mathematica, it appears as if a very small value of d might just work.  We then put LimitPlotDelta to work.  Consider d=0.0001.

LimitPlotDelta[Sin[1/x],x->0,0,.5,.0001]

However the graphic produced by LimitPlotDelta conclusively shows that no suitable d can be found for e=0.5, and hence the limit of f as x->0 can not be 0.

Conclusion

Although gathering graphical evidence for the existence or nonexistence of a limit does not constitute an e-d proof, it can be a valuable precursor to a precise e-d argument.  It allows students to gain more insight into the concept of a limit and some understanding of the e-d definition of the limit, so that this definition and its meaning will no be so foreign when they encounter it again in later mathematics courses.  The two Mathematica commands presented here provide helpful visual tools which can be used to investigate the existence/nonexistence of a limit via the e-d definition.

Code for LimitPlot and LimitPlotDelta

BeginPackage["LimitPlot`"];

LimitPlot::usage="LimitPlot[f[x],x->a,L,epsilon] will plot the 
function y=f[x] near the x-value a, and will draw blue dashed 
horizontal lines at L-epsilon and L+epsilon.";

Begin["`Private`"];

LimitPlot[expr_,var_Symbol->a_,L_,epsilon_,opts___Rule]:=
         Module[{p1,list1,c1,c2,d1,d2,f,x,r,list2,k,list3},
         f[x_]=expr/.var->x;
         p1=Plot[expr,{var,a-1,a+1},PlotRange->{Automatic,
                 {L-2*epsilon,L+2epsilon}},
                 DisplayFunction->Identity];
         list1={L-2*epsilon,L+2*epsilon};
         Off[FindRoot::frmp];
         Off[FindRoot::cvnwt];
         Off[FindRoot::precw];
         Off[FindRoot::jsing];
         Off[LinearSolve::sing];
         list1=Map[{FindRoot[f[x]==#,{x,a-1}],
         FindRoot[f[x]==#,{x,a+1}]}&,list1];
         list1=Flatten[list1];
         list3=Position[list1,___Rule,{1}];
         list3=Flatten[list3];
         list1=Map[list1[[#]]&,list3];
         list1=Union[list1,{x->a}];
         r=Length[list1];
         list1=Table[x/.list1[[i]],{i,1,r}];
         On[FindRoot::frmp];
         On[FindRoot::cvnwt];
         On[FindRoot::precw];
         On[FindRoot::jsing];
         On[LinearSolve::sing];
         list1=Union[list1,{a-1,a+1}];
         list1=Sort[list1];
         list2=Flatten[Position[list1,a]];
         k=list2[[1]];
         c1=Max[a-1,list1[[k-1]]];
         c2=Min[a+1,list1[[k+1]]];
         d1=Min[L-2*epsilon,f[c1]];
         d2=Max[L+2*epsilon,f[c2]];
         p1=Plot[expr,{var,c1,c2},PlotRange->{Automatic,
                {L-2*epsilon,L+2*epsilon}},
                 AxesOrigin->{c1,d1}, Ticks->{Automatic,
                 {L-epsilon,L,L+epsilon}},
                 opts,DisplayFunction->Identity];        
         g=Show[Graphics[{RGBColor[0,0,1],Dashing[{.02,.02}],
               Line[{{c1,L-epsilon},{c2,L-epsilon}}],
               Line[{{c1,L+epsilon},{c2,L+epsilon}}]}],
               PlotRange->{Automatic,{L-2*epsilon,L+2*epsilon}},
               Axes->True,AxesOrigin->{c1,d1}, 
               Ticks->{Automatic,{L-epsilon,L,L+epsilon}},
               DisplayFunction->Identity];
         Show[p1,g,DisplayFunction->$DisplayFunction]
         ]

End[];

EndPackage[];

BeginPackage["LimitPlotDelta`"];

LimitPlotDelta::usage="LimitPlotDelta[f[x],x->a,L,epsilon,delta] 
will sketch the graph of y=f[x] near the point x=a, and will draw 
the horizontal lines y=L-epsilon and y=L+epsilon (in blue dashed 
lines), and will draw the vertical lines x=a-delta and x=a+delta 
(in red dashed lines).";

Begin["`Private`"];

LimitPlotDelta[expr_,var_->a_,L_,epsilon_,delta_,opts___Rule]:=
         Module[{f,x,c,d,g,e,e2,j,k,p,h,h1},
         f[x_]:=expr/.var->x;
         j[x_]:=f[x]/;x<a-delta;
         k[x_]:=f[x]/;a-delta<=x<=a+delta;
         p[x_]:=f[x]/;x>a+delta;
         Off[Plot::plnr];
         c=Max[a-1,a-2delta];
         d=Min[a+1,a+2delta];
         e=Min[L-2epsilon,f[a-delta]];
         e2=Max[L+2epsilon,f[a+delta]];
         g=Plot[{j[x],k[x],p[x]},{x,c,d},PlotRange->{e,e2},
              AxesOrigin->{c,e},PlotStyle->{RGBColor[0,0,0],
              RGBColor[1,0,0],RGBColor[0,0,0]},
              Ticks->{{a-delta,a,a+delta},
              {L-epsilon,L,L+epsilon}},
              DisplayFunction->Identity,opts];
         h=Graphics[{{RGBColor[.2,.6,.8], 
              Rectangle[{c,L-epsilon},{d,L+epsilon}]},
              {RGBColor[0,0,1],Dashing[{.05,.05}],
              Line[{{c,L-epsilon},{d,L-epsilon}}],
              Line[{{c,L+epsilon},{d,L+epsilon}}]},
              {RGBColor[1,0,0],
              Dashing[{.05,.05}],Line[{{a-delta,e},
              {a-delta,e2}}],Line[{{a+delta,e},
              {a+delta,e2}}]}}];
          h1=Show[h,Axes->True,PlotRange->{e,e2},AxesOrigin->{c,e},
              Ticks->{{a-delta,a,a+delta},
              {L-epsilon,L,L+epsilon}},DisplayFunction->Identity];
          Show[h1,g,opts,DisplayFunction->$DisplayFunction]; 
         On[Plot::plnr]
         ]

End[];

EndPackage[];

About the author

Shari Prevost is currently an Assistant Professor of Mathematics at Dickinson College.  She received her Ph.D in mathematics from Rutgers University in the fall of 1989.  Her research interests include affine Lie algebras and vertex operator theory.

Shari Prevost
Department of Mathematics and Computer Science
Dickinson College
Carlisle, PA  17013
prevost@dickinson.edu