Concept: Definition of a limit.
The notion of a limit of a function was originally introduced in
order to make the definition of
make sense. However, it
can also be used to describe the behavior of a function near a given
point, as well as to find and describe
One needs to compute limits of the form limx ® a
) to compute the slope of a tangent line or the derivative of a
function, as well as to determine whether a function is continuous.
The definition of a limit of a function, which can be found in any
calculus textbook, forms the basis for both a graphical and
numerical approach to finding limits.
To summarize it in a means suitable for MATLAB exploration, one has
as the value of x
gets close to a desired number (often called
), then the value of f
) gets close to a number L
called the limit.
If we want to check out a limit with MATLAB we need to understand
this graphically and numerically. Graphically it says if we follow
the graph of f
) towards c
from the left or the right, the
to a limit. Numerically,
this says if we look at the
corresponding to any sequence of x
values which gets close to c
then the y
values should get very close to a single number -- the limit.
A key result we'll need is that limx ® a f
) = L
if and only
limx ® a- f
) = L
® a+ f
) = L
. In other words, we have the
The two-sided limit exists if and only if the left- and
right-sided limits both exist and are equal
Thus, to show that the limit is L
, essentially we need to show
that, as x
takes values closer to a
(on both sides of a
) takes values closer to L
Example: Finding Limits Graphically
Let us use a graphical approach to determine
limx ® 0 sin x/x.
Notice this function is not defined at x=0, and ``plugging in''
x=0 gives an indeterminate form of 0/0. Thus the limit takes
work to figure out. However, this function is defined for all x
except at x=0, which is all that is required to apply the limit
definition. The following MATLAB commands will
graph of sin x / x near x=0.
Figure 20: plot of sin(x) / x
>> x=linspace(-1,1); % plot for x in the interval [-1, 1]
>> y=sin(x)./x; % `dot' makes division point wise
>> plot(x,y), grid
From the graph you notice as one moves toward 0 from either side
on the x-axis, the y values move toward 1. From the graph
you can tell what the limit is 1.
Example: Finding Limits Numerically
Here is a simple method for finding the same limit numerically.
>> format long % gives extra decimal places
>> x=[-.1 -.01 -.001 -.0001 -.00001] % x approaches 0 from the left
>> y=sin(x)./x; [x;y]' % print x,y in a 2-column table
>> x=[.1 .01 .001 .0001 .00001] % x approaches 0 from the right
>> y=sin(x)./x; [x:y]'
You should get the following results (x on the left, sin
(x)/x on the right):
Since the values in the right columns both approach 1, we conclude
that both right and left limits are 1 and so the limit is 1 as
Example: limit of slope of the secant line:
See the secant line example
to find the definition of the secant line. Essentially we have a
function f(x) a point x1 and a point x2. Let x2 = x1 +
h. So that h measures the difference between the two values of
x. Then as h gets close to 0 x2 and x1 get close to each
other. If the limit as h goes to zero exists then the function
is said to have a
In the secant line example
we see how to plot the function sin(x) and the secant line
between x1 = p/4 and x2 = x1 + h with h = p/8. By
changing the value of h we see it is a simple matter to find
graphically the limit of the secant lines.
To find the slope numerically we recall the definition of the
of a line
m = (f(x1+h) - f(x1))/(x1 + h - x1)
= (f(x1+h) - f(x1))/ h
So in MATLAB we define a sequence of values h converging to 0, and
then plug into the formula:
>> x_1=pi/4; n = 1:5; h = 10.^(-n); % suppress the output with ;
>> m = ( sin(x_1 + h) - sin(x_1)) ./ h; % we need the ./ as h is a
>> [h;m]' % print out in columns
If you repeat this using -h in the second and 3rd line
you will see that the left and right limits are the same and equal