Calculus I (AB)
The study of limits, infinitesimals, continuous functions, rates of change (derivatives), sums of infinitesimals (integrals), and applications.
Section 2: Derivatives
2.1 The limit of slope
One of the most useful concepts in the study of linear functions is that of slope. The slope represents the function’s rate of change: for every unit we move to the right in the $x$-direction, the slope tells us how many units to move in the $y$-direction. For linear functions, the slope has a constant value and is often denoted by the letter $m,$ as seen in the standard point-slope and slope-intercept equations: $$y \,-\, y_1 = m(x \,-\, x_1),$$ $$y = mx + b.$$
For a linear function, the slope can be calculated as “rise over run”: for any two points $(x_1, y_1)$ and $(x_2, y_2)$ on the line1, find the difference between their $y$-coordinates (the rise), and divide it by the difference between their $x$-coordinates (the run). As an equation, this looks like2 $$m = \frac{y_2 \,-\, y_1}{x_2 \,-\, x_1}.$$
Visually, the slope is the ratio of (1) the vertical distance between two points on the line, and (2) the horizontal distance between those same two points.
So far so good. But throughout this discussion, I’ve made a point of referring only to linear functions, which are admittedly a pretty small fraction of all the functions we might like to study. What about higher-degree polynomials like $y = x^2$ or $y = -3x^5 +7x^4 + x -2$? What about exponentials, logarithms, trig functions? Can we say anything about the slopes of those functions?
In short: yes, we can! It will just take a bit of work in order to do so. Let’s consider a relatively simple function as an example, $y = x^2$:
One clear difference between this graph and the previous one is that the slope of $y = x^2$ changes: we have a steep negative slope on the left side of the curve, a shallow slope (close to 0) near the middle, and a steep positive slope on the right. This means that the slope of $y = x^2$ (and indeed, of any function with a curved graph) is going to be a function of $x$ rather than a constant, since the value of the slope depends on our $x$-position along the curve.
To calculate the slope, we might first try the same approach we used with linear functions: find two points on the graph, calculate the rise and run between those points, and take the ratio. For example, if we choose the points $(1,1)$ and $(2,4),$ we find that the slope between these points is $$m = \frac{4\,-\,1}{2\,-\,1} = 3.$$ However, nowhere in this calculation did we take into account that we want the slope of $y = x^2$ between these points; indeed, this slope calculation would look exactly the same for any function containing the points $(1,1)$ and $(2,4).$ This is because rise-over-run doesn’t tell us the slope of an arbitrary function connecting two points; it tells us the slope of the straight line connecting those points.
Even so, the slope of this line does look like a decent approximation of the slope of $y = x^2$ between those two points! The red line looks steeper than the blue curve near $(1,1),$ and less steep than the blue curve near $(2,4),$ so it seems to tell us something about the function’s average slope between those points.3 But we don’t just want the average slope over a range of points; we want to find the slope of the function at a particular point. How might we achieve this?
The gap between the two points we chose gives the blue curve plenty of leeway to deviate from its slope; perhaps we can get a better approximation if we pick two points that are closer together? Let’s try another slope calculation, this time using $(1,1)$ and $(1.5,2.25).$
The slope decreased from $3$ to $2.5$ when we made the second point closer to the first, and excitingly, the red line with this slope appears to more closely match the blue curve between those points! Of course, we don’t want to keep doing slope calculations with smaller and smaller decimals to get closer and closer approximations; we want to cut to the chase and take the best possible approximation, which would be the secant line formed by two distinct points as close together as possible.
How can we find the slope of this best possible secant line? By using a limit!
Here’s the idea: we’ll leave our first point $(1,1)$ as-is, and give the second point an $x$-coordinate of $1 + h,$ where $h$ represents the horizontal distance (aka the “run”) between the two points. (In our first slope calculation, we had $h = 1,$ since the run from $(1,1)$ to $(2,4)$ is $2-1=1.$ In our second, we had $h = 0.5.)$ The second point must be on the graph of $y = x^2,$ so its $y$-coordinate must be the square of its $x$-coordinate, namely $(1+h)^2.$ Our general slope calculation therefore looks like $$m = \frac{(1 + h)^2 \,-\, 1}{(1 + h) \,- \,1}.$$ Expanding this out and simplifying, we have $$\begin{align*} m &= \frac{1 + 2h + h^2 \,- \,1}{1 + h \,-\, 1} \\ &= \frac{2h + h^2}{h} \\ &= 2 + h \end{align*}$$ for the slope of the line between $(1,1)$ and the point $h$ units to the right of it.
Our best possible secant line has these two points as close together as possible, which means we should look at what happens when $h$ (the horizontal distance between them) approaches zero: $$m = \lim_{h\to 0} \;(2+h) = 2.$$
Would you look at that — we just found the slope of $y = x^2$ at $x = 1$!
This example was quite specific, though, so let’s see if we can generalise this process a bit. Suppose we wanted to find the slope of $y = x^2$ at any point, rather than specifically at $(1,1).$ In that case, we could write our first point as $(x, x^2)$ and our second point as $(x + h, (x + h)^2).$ The limit of the slope between these points would then be $$\begin{align*} m &= \lim_{h \to 0} \frac{(x+h)^2 \,-\, x^2}{(x+h) \,-\, x} \\ &= \lim_{h \to 0} \frac{x^2 + 2xh + h^2 — x^2}{h} \\ &= \lim_{h \to 0} \;(2x + h) \\ &= 2x. \end{align*}$$
This is our coveted slope-as-a-function-of-$x$! Whatever point we’re looking at on the graph of $y = x^2,$ this tells us that the slope of the graph at that point is simply two times the $x$-coordinate of that point.
Now that we’ve found the slope of $y = x^2$ at an arbitrary point $(x,x^2),$ let’s see if we can generalise this one step further: what is the slope of $y = f(x)$ at an arbitrary point $(x, f(x))?$
Just like before, we start by creating a second point that’s $h$ units to the right of this first point, which gives it an $x$-coordinate of $x + h.$ We want this second point to also be on the graph of $f,$ so its $y$-coordinate must be $f(x + h).$ We therefore need to calculate the slope between $(x,f(x))$ and $(x + h, f(x + h)),$ then take the limit as $h$ approaches zero in order to make those points as close together as possible: $$m = \lim_{h\to0}\frac{f(x+h) \,-\, f(x)}{(x + h) \,- \,x}.$$ We can simplify this slightly by cancelling out the $x$’s in the denominator, and we can also make our lives easier by introducing a bit of notation and terminology. This slope-as-a-function-of-$x$ is called the derivative of $f$, and we’ll denote it by $f'(x)$ (pronounced “f prime of x”) rather than calling it $m$ like we do for linear functions. Hence, the slope of a function $f$ at any value of $x$ is given by its derivative function $$\boxed{f'(x) = \lim_{h\to0}\frac{f(x+h) \,-\, f(x)}{h}.}$$ If this definition looks intimidatingly complicated for a simple concept like slope, don’t worry! We’ll calculate a few derivatives by hand to start getting comfortable with this definition, and shortly thereafter we’ll develop an arsenal of shortcuts that’ll make calculating derivatives much, much easier.
Worked Example
Find the slope of $f(x) = 2x^3$ at $x = 5.$
To find the slope of a function at a given point, we can calculate its derivative function using the boxed formula above, then plug in the value of $x$ we’re interested in. Rather than cramming that formula into our brains with rote memorisation, it’s helpful to remember where it comes from: starting at a point $(x,f(x))$ on our graph, we move $h$ units to the right to a nearby point $(x+h, f(x+h))$ on our graph, calculate the slope between those two points, then make the points as close together as possible by taking the limit as $h$ approaches $0.$
Without further ado, here’s the calculation: \begin{align*} f'(x) &= \lim_{h\to0}\frac{f(x+h) \,-\, f(x)}{h} \\ &= \lim_{h\to0}\frac{2(x+h)^3 \,-\, 2x^3}{h} \\ &= \lim_{h\to0}\frac{2x^3 + 6x^2h + 6xh^2 + 2h^3 \,-\, 2x^3}{h} \\ &= \lim_{h\to0}\frac{6x^2h + 6xh^2 + 2h^3}{h} \\ &= \lim_{h\to0}\;(6x^2 + 6xh + 2h^2) \\ &= 6x^2. \end{align*}
Recall that the derivative function $f'(x)$ tells us the slope of $f(x)$ at any value of $x,$ so the slope of $f$ at $x = 5$ is simply $$f'(5) = 6(5)^2 = \boxed{150}.$$
Now You Try
Find the derivative of $g(x) = 6.$ Can you guess at a general rule for derivatives of constant functions?
Find the derivative of $h(x) = x^3 + x^2 + x + 1.$ Can you guess at a general rule for derivatives of polynomials?
What is the slope of $h(x)$ (the function from the previous problem) at $x = 3?$ (Hint: remember what the derivative function tells us!)
- A coordinate pair $(x,y)$ is included in the graph of a function exactly when it satisfies the equation defining the function, so saying that these two points are "on the line" is equivalent to saying that they each satisfy the linear equation.
- Note that we get the same value of $m$ if we subtract the second coordinate pair from the first (rather than subtracting the first from the second). The important thing is to use the same order in the numerator as we do in the denominator, whichever order we pick.
- As we'll see later on, it turns out that the slope of this secant line is the average slope of the function between those points.