This material was developed by Aaron Tresham at the University of Hawaii at Hilo and is

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.

- Intro to Sage
- Graphing and Solving Equations
- Limits

This week we will zoom in on graphs of functions to explore the "local linearity" property. Then we will find and graph tangent lines.

Consider the function $f(x)=2\ln(x)$. Here is a typical graph:

What happens when we zoom in on a particular point? What does the graph look like? For example, let's zoom in on the point $(1,0)$.

On the first graph above, it is easy to see that the graph is not straight, but when we zoom in the curvature is much harder to see. Let's zoom in once more:

When we are this close to the graph of $f$, it appears that the graph is a straight line. We know this is not the case, but very close to the point $(1,0)$ the graph is almost a line. This is called the local linearity property. Not every function has this property, but there are many important functions that do have this property.

Consider the graph of $g(x)=\cos(x)$ near the point $(0,1)$.

In the animation below, we will zoom in on this graph near this point. Note that both the x- and y-axes will change to maintain the scale.

It appears that the graph of $\cos(x)$ has the local linearity property at $(0,1)$.

Now let's consider the graph of $h(x)=|x|$ near the point $(0,0)$.

For this function, it does not matter how much you zoom in. You will always get a sharp corner, never a straight line. This is an example of a function that does not have the local linearity property at a point. [Note: this function does have the local linearity property at every other point on the graph - it's already a straight line everywhere else.]

From what we've seen above, it's safe to conclude that graphs alone are not sufficient for determining local linearity (depending on the viewing window, the picture can look very different). We want an algebraic way of determining local linearity.

If a function $f$ has the local linearity property at a particular point $(x_0,f(x_0))$, then the graph of $f$ looks like a line near that point. But which line does it look like?

The line that $f$ is "close to" at $(x_0,f(x_0))$ is called the "tangent line" at that point, and the point $(x_0,f(x_0))$ is called the "point of tangency." In order to find the equation of a line, we need two pieces of information, either two points on the line or one point on the line and the slope of the line. We know one point on the tangent line: $(x_0,f(x_0))$. We don't know a second point on the tangent line, but we can find the slope of the tangent line.

First, we will approximate the slope of the tangent line by choosing a second point close to $(x_0,f(x_0))$. Say the distance away from $x_0$ is $h$, then the second point is $(x_0+h,f(x_0+h))$. We'll find the slope of the line through these two points (called a "secant line").

Here is a sample graph.

Now we will improve our approximation by making $h$ closer and closer to $0$, moving $(x_0+h,f(x_0+h))$ closer to $(x_0,f(x_0))$.

This process sounds like a limit, so that's how we'll find our answer. The slope of the secant line through $(x_0+h,f(x_0+h))$ and $(x_0,f(x_0))$ is $\displaystyle\frac{f(x_0+h)-f(x_0)}{x_0+h-x_0}=\frac{f(x_0+h)-f(x_0)}{h}$ (rise over run).

We want to know what happens to this slope as $h$ approaches $0$. In limit notation, we want to find $\displaystyle\lim_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h}$.

If the function $f$ has the local linearity property at $(x_0,f(x_0))$, then this limit will exist (and conversely). The value of this limit is the slope of the tangent line.

Now that we have a point on the line and the slope of the line, we can find the equation of the line. Remember point-slope form?

**Point-Slope Form of a Line:** $y-y_0=m\cdot(x-x_0)$, where $m$ is the slope and $(x_0,y_0)$ is a point on the line.

In this case, $(x_0,y_0)=(x_0,f(x_0))$ and $m=\displaystyle\lim_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h}$.

Therefore, an equation for the tangent line is $y-f(x_0)=m\cdot(x-x_0)$. Adding $f(x_0)$ to both sides produces:

**Equation for the Tangent Line at $x=x_0$:**

$y=f(x_0)+m\cdot(x-x_0),$

where $m=\displaystyle\lim_{h\to 0}\frac{f(x_0+h)-f(x_0)}{h}$.

This is a general formula for finding an equation for the line tangent to the graph of $f$ at the point $(x_0,f(x_0))$.

To see how secant lines approach the tangent line graphically, let's look at the animation below.

You will see secant lines for the curve $f(x)=2\ln(x)$ through the point $(x_0,f(x_0))=(1,0)$ and $(x_0+h,f(x_0+h))$, where $h$ starts at $1$ and approaches $0$.

You can see that the secant lines (in green) approach the tangent line (in red) as $h$ approaches $0$.

Now $h$ can also be negative, so we'll also look at secant lines when $h$ starts at $-\frac{3}{4}$ and approaches $0$.

Note: We can't start at $h=-1$, since that gives us $x_0+h=0$, which is not in the domain.

Once again, the secant lines approach the tangent line as $h$ approaches $0$.

Now consider $f(x)=\cos(x)$ and $(x_0,f(x_0))=(0,1)$. We'll start at $h=1$ and let $h$ approach $0$.

Now we'll start at $h=-1$ and let $h$ approach $0$.

Whether $h$ approaches $0$ from the left or right, the secant lines approach the tangent line.

Now let's find the equation of the line tangent to the graph of $f(x)=2\ln(x)$ at the point $(1,0)$.

First, we need the slope. As we saw above, the slope is $\displaystyle\lim_{h\to0}\frac{f(1+h)-f(1)}{h}$.

2

So the slope is 2.

Now use the equation of a tangent line: $y=f(x_0)+m\cdot(x-x_0)$.

$\displaystyle 2 \, x - 2$

Now I'll plot the function and the tangent line.

Now let's try to find the tangent line to $g(x)=|x|$ at $(0,0)$. We saw above that this function does not have the local linearity property here, so something should go wrong.

Let's try to calculate the slope: $\displaystyle m=\lim_{h\to 0}\frac{|0+h|-|0|}{h}$.

We find that the limit does not exist (Sage returns "und").

und

Notice that the one-sided limits exist but are not equal:

$\displaystyle \lim_{h\to 0^+}\frac{|0+h|-|0|}{h}=\lim_{h\to 0^+}\frac{|h|}{h}=\lim_{h\to 0^+}\frac{h}{h}=1$

$\displaystyle \lim_{h\to 0^-}\frac{|0+h|-|0|}{h}=\lim_{h\to 0^-}\frac{|h|}{h}=\lim_{h\to 0^-}\frac{-h}{h}=-1$

So the two-sided limit does not exist.

If we try to find the slope at any point other than $x=0$, it works fine. Let's use $(-5,5)$.

$\displaystyle m=\lim_{h\to 0}\frac{|-5+h|-|-5|}{h}$

-1

Now we see the slope of the tangent line is $-1$, so the tangent line has equation $y=g(-5)+(-1)(x-(-5))=5-(x+5)$, or $y=-x$.

$\displaystyle -x$

Now I'll plot the function and the tangent line.