Tangent Lines and Rates of Change

Given a function $y = f(x)$ , how do you find the slope of the tangent line to the graph at the point $P(a,f(a))$ ?

(I'm thinking of the tangent line as a line that just skims the graph at $(a,f(a))$ , without going through the graph at that point. This is a vague description, but it will do for now.)

Here's the idea. Pick a point $(a + h,
   f(a + h))$ nearby, and draw the line connecting $(a,f(a))$ to $(a + h,
   f(a + h))$ . (A line connecting two points on a graph is called a secant line.)

$$\hbox{\epsfysize=2.5in \epsffile{tangent1.eps}}$$

Thus, h represents how much you "moved over" in the x-direction. The line has slope

$$\dfrac{f(a + h) - f(a)}{(a + h) - a} = \dfrac{f(a + h) - f(a)}{h}.$$

If you slide the second point $(a + h,
   f(a + h))$ along the graph toward P, the secant line gets closer and closer to the tangent line. Algebraically, this amounts to taking the limit as $h \to 0$ . Thus, the slope of the tangent at $x = a$ is

$$m_{\rm tan} = \lim_{h \to 0} \dfrac{f(a + h) - f(a)}{h}.$$


Example. Let $f(x) = x^2$ .

(a) Find the slope of the secant line joining $(0,f(0))$ to $(3,f(3))$ .

$$\dfrac{f(3) - f(0)}{3 - 0} = \dfrac{9 - 0}{3 - 0} = \dfrac{9}{3} = 3.\quad\halmos$$

(b) Find the slope of the tangent line to $f(x)$ at $x = 3$ .

In this case, I let $a = 3$ in the equation for $m_{\rm tan}$ and compute the limit:

$$m_{\rm tan} = \lim_{h \to 0} \dfrac{f(3 + h) - f(3)}{h} = \lim_{h \to 0} \dfrac{(3 + h)^2 - 3^2}{h} = \lim_{h \to 0} \dfrac{6h + h^2}{h} = \lim_{h \to 0} (6 + h) = 6.\quad\halmos$$


Another form of the tangent line formula is

$$m_{\rm tan} = \lim_{x \to a} \dfrac{f(x) - f(a)}{x - a}.$$

You can get this formula from the previous one by letting $h = x - a$ . Then $x = a + h$ , so $h \to 0$ gives $x \to a$ .


Example. Find the slope of the tangent line to $y = \dfrac{1}{x}$ at $\left(a,
   f(a)\right)$ .

$$m_{\rm tan} = \lim_{x \to a} \dfrac{f(x) - f(a)}{x - a} = \lim_{x \to a} \dfrac{\dfrac{1}{x} - \dfrac{1}{a}}{x - a} = \lim_{x \to a} \dfrac{\dfrac{a - x}{ax}}{x - a} = \lim_{x \to a} \dfrac{a - x}{ax(x - a)} = \lim_{x \to a} \dfrac{-1}{ax} = -\dfrac{1}{a^2}.$$

$$\hbox{\epsfysize=1.75in \epsffile{tangent2.eps}}$$

The graph of $y = \dfrac{1}{x}$ is a rectangular hyperbola. Notice that by not plugging in a specific number for a, I've obtained a formula which I can use for any a. For example, the slope of the tangent at $a = 3$ (i.e. at the point $\left(3,\dfrac{1}{3}\right)$ ) is

$$m_{\rm tan} = -\dfrac{1}{3^2} = -\dfrac{1}{9}.\quad\halmos$$


There is another interpretation of the slopes of the secant line and the tangent line. The slope of the secant line joining $(a,f(a))$ to $(b,f(b))$ is

$$\dfrac{f(b) - f(a)}{b - a}.$$

This is the change in f divided by the change in x, so it represents the average rate of change of f as x goes from a to b (i.e. on the interval $a \le x \le b$ ).

What is the slope of the tangent line at a? It represents the instantaneous rate of change at $x = a$ . (Sometimes people get lazy and just say "rate of change" to mean "instantaneous rate of change".)


Example. Let $f(x) = \sqrt{x}$

(a) Find the average rate of change of $f(x)$ on the interval $1 \le x \le 4$ .

$$\dfrac{f(4) - f(1)}{4 - 1} = \dfrac{\sqrt{4} - \sqrt{1}}{4 - 1} = \dfrac{2 - 1}{3} = \dfrac{1}{3}.\quad\halmos$$

(b) Find the instantaneous rate of change of $f(x)$ at $x = 4$ .

The instantaneous rate of change of $f(x)$ at $x = 4$ is $m_{\rm tan}$ at $a = 4$ . I'll use the second formula for $m_{\rm tan}$ :

$$m_{\rm tan} = \lim_{x \to a} \dfrac{f(x) - f(a)}{x - a}.$$

I set $a = 4$ and compute the limit:

$$m_{\rm tan} = \lim_{x \to 4} \dfrac{f(x) - f(4)}{x - 4} = \lim_{x \to 4} \dfrac{\sqrt{x} - \sqrt{4}}{x - 4} = \lim_{x \to 4} \dfrac{\sqrt{x} - 2}{x - 4} = \lim_{x \to 4} \dfrac{\sqrt{x} - 2}{x - 4}\cdot \dfrac{\sqrt{x} + 2}{\sqrt{x} + 2} =$$

$$\lim_{x \to 4} \dfrac{x - 4}{(x - 4)(\sqrt{x} + 2)} = \lim_{x \to 4} \dfrac{1}{\sqrt{x} + 2} = \dfrac{1}{4}.$$

Thus, the instantaneous rate of change of $f(x)$ at $x = 4$ is $\dfrac{1}{4}$ . This means that if f continued to change at the same rate, then for every 4 units that x increased, the function would increase by 1 unit.

Of course, the function does not continue to change at the same rate. In fact, the rate of change of the function changes! --- the rate of change of the function is a function itself.


Suppose that the function under investigation gives the position of an object moving in one dimension. (Think of something moving left or right along the x-axis, or an object that is thrown straight upward, and which eventually falls back to earth.) For instance, suppose that $s(t)$ is the position of the object at time t.

The average velocity of the object from $t = a$ to $t = b$ is the change in position divided by the time elapsed:

$$v_{\rm avg} = \dfrac{s(b) - s(a)}{b - a}.$$

Notice that this is the same as the slope of the secant line to the curve, or the average rate of change.

The instantaneous velocity at $t = a$ is

$$v(a) = \lim_{h \to 0} \dfrac{s(a + h) - s(a)}{h}.$$

This is the slope of the tangent line to the curve, or the instantaneous rate of change. You can also use the second formula

$$v(a) = \lim_{t \to a} \dfrac{s(t) - s(a)}{t - a}.$$

Roughly speaking, the instantaneous velocity measures how fast the object is travelling at a particular instant.


Example. The position of an object at time t is

$$s(t) = t^2 - 5t + 6.$$

(a) Find the average velocity from $t =
   4$ to $t = 5$ .

$$v_{\rm avg} = \dfrac{s(5) - s(4)}{5 - 4} = \dfrac{6 - 2}{1} = 2.\quad\halmos$$

(b) Find the average velocity from $t =
   1$ to $t = 4$ .

$$v_{\rm avg} = \dfrac{s(4) - s(1)}{4 - 1} = \dfrac{2 - 2}{3} = 0.$$

What does this mean? Notice that $s(1)
   = 2$ and $s(4) = 2$ . In other words, the object moved around from $t = 1$ to $t = 4$ , but it wound up back where it started. Since the net change in position was 0, the average velocity was 0.

(c) Find the instantaneous velocity when $t = 3$ .

I set $a = 3$ in

$$v(a) = \lim_{t \to a} \dfrac{s(t) - s(a)}{t - a}.$$

I get

$$v(3) = \lim_{t \to 3} \dfrac{s(t) - s(3)}{t - 3} = \lim_{t \to 3} \dfrac{t^2 - 5t + 6 - 0}{t - 3} = \lim_{t \to 3} \dfrac{t^2 - 5t + 6}{t - 3} = \lim_{t \to 3} \dfrac{(t - 3)(t - 2)}{t - 3} = \lim_{t \to 3} (t - 2) = 1.\quad\halmos$$


People who have seen calculus before know that $m_{\rm tan}$ is usually called the derivative of $f(x)$ at a. It is denoted by

$$f'(a) \quad\hbox{or}\quad y'(a) \quad\hbox{or}\quad \der y x \quad\hbox{or}\quad \der {f(x)} x \quad\hbox{or}\quad D_xf(a).$$

That is, the derivative of $y = f(x)$ at $x = a$ is given by

$$f'(a) = \lim_{h\to 0} \dfrac{f(a + h) - f(a)}{h}.$$

$f'(a)$ gives the instantaneous rate of change of f at a, or the slope of the tangent line to the graph of $y = f(x)$ at $(a,f(a))$ .

The derivative is a function in its own right. Since x is usually used to denote the input variable for a function, it's common to write the definition of the derivative in this form:

$$f'(x) = \lim_{h\to 0} \dfrac{f(x + h) - f(x)}{h}.$$

f is differentiable at x if $f'(x)$ exists --- that is, if the limit above is defined.


Example. Compute $f'(x)$ for $f(x) = \dfrac{1}{\sqrt{x}}$ .

$$f'(x) = \lim_{h\to 0} \dfrac{f(x + h) - f(x)}{h} = \lim_{h\to 0} \dfrac{\dfrac{1}{\sqrt{x + h}} - \dfrac{1}{\sqrt{x}}}{h} = \lim_{h\to 0} \dfrac{\dfrac{\sqrt{x} - \sqrt{x + h}} {\sqrt{x}\sqrt{x + h}}}{h} = \lim_{h\to 0} \dfrac{\sqrt{x} - \sqrt{x + h}} {h\sqrt{x}\sqrt{x + h}} =$$

$$\lim_{h\to 0} \dfrac{\sqrt{x} - \sqrt{x + h}} {h\sqrt{x}\sqrt{x + h}}\cdot \dfrac{\sqrt{x} + \sqrt{x + h}}{\sqrt{x} + \sqrt{x + h}} = \lim_{h\to 0} \dfrac{x - (x + h)} {h\sqrt{x}\sqrt{x + h}(\sqrt{x} + \sqrt{x + h})} = \lim_{h\to 0} \dfrac{-h} {h\sqrt{x}\sqrt{x + h}(\sqrt{x} + \sqrt{x + h})} =$$

$$\lim_{h\to 0} \dfrac{-1} {\sqrt{x}\sqrt{x + h}(\sqrt{x} + \sqrt{x + h})} = -\dfrac{1}{2x^{3/2}}.\quad\halmos$$


Example. Suppose

$$f(x) = \cases{2 - x & if $x \le 1$ \cr \dfrac{1}{x} & if $x > 1$ \cr}.$$

Is f differentiable at $x = 1$ ?

$$f'(1) = \lim_{h\to 0} \dfrac{f(1 + h) - f(1)}{h}.$$

However, the definition of $f(1 + h)$ depends on whether h is positive or negative. I need to take the left- and right-hand limits at 1.

The right-hand limit is

$$\lim_{h\to 0^+} \dfrac{f(1 + h) - f(1)}{h} = \lim_{h\to 0^+} \dfrac{\dfrac{1}{1 + h} - 1}{h} = \lim_{h\to 0^+} \dfrac{\dfrac{1 - (1 + h)}{1 + h}}{h} = \lim_{h\to 0^+} \dfrac{\dfrac{-h}{1 + h}}{h} =$$

$$\lim_{h\to 0^+} \dfrac{-h}{h(1 + h)} = \lim_{h\to 0^+} \dfrac{-1}{1 + h} = -1.$$

The left-hand limit is

$$\lim_{h\to 0^-} \dfrac{f(1 + h) - f(1)}{h} = \lim_{h\to 0^-} \dfrac{2 - (1 + h) - 1}{h} = \lim_{h\to 0^-} \dfrac{-h}{h} = \lim_{h\to 0^-} (-1) = -1.$$

Since the left- and right-hand limits agree, the two-sided limit exists. Thus,

$$f'(1) = \lim_{h\to 0} \dfrac{f(1 + h) - f(1)}{h} = -1.$$

This shows that f is differentiable at $x = 1$ .


Example. A differentiable function is continuous.

Geometrically, a differentiable function has a tangent line at each point of its graph. You'd suspect that this would rule out gaps, jumps, or vertical asymptotes --- typical discontinuities. In fact, the requirement that a differentiable function have a tangent line at each point means that its graph has no "corners" --- all of the curves and turns are "smooth".

To see algebraically why this result is true, suppose $f(x)$ is differentiable at a point c. By definition,

$$f'(c) = \lim_{x\to c} \dfrac{f(x) - f(c)}{x - c}.$$

Then

$$f'(c)\cdot \left(\lim_{x\to c} (x - c)\right) = \left(\lim_{x\to c} \dfrac{f(x) - f(c)}{x - c}\right)\cdot \left(\lim_{x\to c} (x - c)\right).$$

On the one hand, $\displaystyle
   \lim_{x\to c} (x - c) = 0$ , so the left side is 0. On the other hand, the product of the limits is the limit of the product, so

$$0 = \lim_{x\to c} \dfrac{f(x) - f(c)}{x - c}\cdot (x - c) = \lim_{x\to c} \left(f(x) - f(c)\right).$$

I can rewrite this as

$$\lim_{x\to c} f(x) = \lim_{x\to c} f(c) = f(c).$$

This says that f is continuous at c.


Example. The picture below shows that graph of a function $y = f(x)$ . Sketch the graph of $f'(x)$ .

$$\hbox{\epsfysize=2in \epsffile{tangent3.eps}}$$

I'll do each piece separately from left to right. The left hand piece starts out with a small positive slope. The slope increases till it is large and positive at the asymptote.

The piece in the middle starts out with a big positive slope at the left-hand asymptote. It decreases to 0 --- there's a horizontal tangent at the top of the "bump". It continues to decrease, becoming big and negative at the right-hand asymptote.

Finally, the right-hand piece starts out with a big negative slope near the asymptote. As you go out to the right, the slope continues to be negative, but the curve flattens out --- that is, the slope approaches 0.

Putting these observations together produces a picture like this:

$$\hbox{\epsfysize=2in \epsffile{tangent4.eps}}\quad\halmos$$


Example. An often-used rule of thumb is:

The derivative is undefined at a place where a graph has a corner.

Here's an example which illustrates this point. Suppose

$$f(x) = \cases{2x & if $x < 0$ \cr x - x^2 & if $x \ge 0$ \cr}$$

Here's the graph:

$$\hbox{\epsfysize=2in \epsffile{tangent5.eps}}$$

It looks as though there might be a corner at $x = 0$ , but it's hard to tell. Compute the derivative at 0:

$$f'(0) = \lim_{h \to 0} \dfrac{f(0 + h) - f(0)}{h} = \lim_{h \to 0} \dfrac{f(h)}{h},$$

since $f(0) = 0$ .

Since f is defined in two pieces, I have to compute the limit on the left and right:

$$\lim_{h \to 0-} \dfrac{f(h)}{h} = \lim_{h \to 0-} \dfrac{2h}{h} = \lim_{h \to 0-} 2 = 2,$$

$$\lim_{h \to 0+} \dfrac{f(h)}{h} = \lim_{h \to 0+} \dfrac{h - h^2}{h} = \lim_{h \to 0+} (1 - h) = 1.$$

The left- and right-hand limits do not agree. Therefore, the two-sided limit $f'(0)$ is undefined --- f is not differentiable at $x = 0$ .

The left- and right-hand limits I computed are sometimes called the left- and right-hand derivatives of f at $x = 0$ . Intuitively, they give the slope of the tangent as you come in from the left and right, respectively. Thus, the left-hand derivative at 0 is 2 and the right-hand derivative at 0 is 1.


Send comments about this page to: Bruce.Ikenaga@millersville.edu.

Bruce Ikenaga's Home Page

Copyright 2005 by Bruce Ikenaga