# Limits

Before we discuss exactly what a limit is, let's take a moment to become familiarized with Sage worksheets, which you will be using throughout these lessons. Our work for each section will be kept in its own separate worksheet, which will make it easier to find and review past exercises.

A limit, to be concise, is the value that a function approaches as a variable (such as x) approaches a certain value. Most of the time, this is fairly straightforward. For a function f(x) = 2*x, for example, the limit of f(x) as x approaches 4 would simply be 8, since 2 times 4 is 8. The notation for this, as you will surely see in a calculus book, in a calculus classroom or on a calculus test, looks like:

\begin{align}\lim_{x\to 4}2x=8\end{align}

Where limits will come in handy, though, is in situations where there is some ambiguity as to the value of a function at a point. As an example of this ambiguity, let's look at the graph of f(x) = (x2 - 1)/(x - 1). Place your cursor in the cell below and press SHIFT-ENTER or click the "play" button above.

p = plot((x^2 - 1)/(x - 1), x, -1, 3)
pt = point((1, 2), rgbcolor='white', pointsize=30, faceted=True)
g = p+pt
g.show(xmin=0, xmax=3, ymin=0, ymax=4) Looking at f(x), one can see that setting x equal to 1 would make both the numerator and the denominator equal to zero, which is why there is a circle at that point on the graph. Even though f(1) is undefined, however, we can still analyze, by way of limits, what f(1) would equal if it did exist. The notation for this would be:

\begin{align}\lim_{x\to 1}\frac{x^2 - 1}{x -1}\end{align}

Just by looking at the graph, one can see that as x approaches 1, the y-value for f(x) approaches 2. To find this value algebraically, we can remove the discontinuity by factoring the numerator, then dividing both the top and the bottom by $(x - 1)$ to obtain:

\begin{align} \lim_{x\to 1}\frac{x^2 - 1}{x -1}=\lim_{x\to 1}\cancel{\frac{(x+1)(x-1)}{x-1}}=\lim_{x\to 1}{x+1}=2 \end{align}

Thus, both graphically and analytically, we can see that the limit of f(x) as x approaches 1 is equal to 2. To verify this result, we can actually use the following code to have CoCalc compute the limit for us:

limit((x^2 - 1)/(x - 1), x=1)

2

Running the code in a copy of this worksheet will verify the result. You can use the limit function to check your answers to the following practice problems, as well.

On your own, now, try evaluating the following five limits first graphically, then by algebraic simplification. To aid this pursuit, I have included SageMath code to plot the first two functions, though it won't circle the discontinuities for you this time. Simply run the code for each cell in your copy of this worksheet and evaluate it. For the last three, see if you can modify the code from one of the other examples to graph the function. On a sidenote, use "pi" without the quotes to reference $\pi$ from SageMath.

## Practice Problems

Evaluate each limit graphically and analytically.

\begin{align}\mbox{1) }\lim_{x\to 4}\frac{x^2-2x-8}{x -4}\end{align}

plot((x^2 - 2*x - 8)/(x - 4), x, -1, 5).show(xmin=0, ymin=0)


\begin{align}\mbox{2) }\lim_{x\to \pi}\frac{1-\cos^2{x}}{\sin{x}}\end{align}

plot((1 - cos(x)^2)/sin(x), x, -1, 5).show(xmin=0, ymin=0)


\begin{align}\mbox{3) }\lim_{x\to 2}\frac{(x-2)^4}{x^2-4x+4}\end{align}

# plot(...)


\begin{align}\mbox{4) }\lim_{x\to 0}\frac{\sin{x}}{x}\end{align}

# plot(...)


\begin{align}\mbox{5) }\lim_{x\to 0}\frac{1-\cos{x}}{x}\end{align}

# plot(...)