Calculus in a nutshell

Matt Helm


I. Limits & continuity

From Wikipedia:

In mathematics, a limit is the value that a function (or sequence) "approaches" as the input (or index) "approaches" some value. Limits are essential to calculus and mathematical analysis, and are used to define continuity, derivatives, and integrals.

Let's dive right in and start with a couple of discontinuous functions:

The above function, which we'll call , is equal to 1.0 from 1.0 up to, but not including, 2.0; it is equal to 2.0 from 2.0 up to 3.0; and it is equal to 3.0 from 3.0 up to 4.0. A filled dot marks a point that belongs to the function and a hollow dot marks one that doesn't, so the function jumps — it is discontinuous — at 2.0 and again at 3.0.

Ask yourself the following question: what is the value of this function as approaches 2.0 from the left-hand side? In other words, as you get closer and closer to the value of 2.0, what is the value?

The answer to the above question is 1.0. What if we asked the question but approach 2.0 from the right-hand side? The answer in that case is that the value of equals 2.0 as we approach an value of 2.0 from the right.

Let's write the above two statements using mathematical notation:

We use a − sign to indicate an approach from the left and a + sign to denote an approach from the right. You can see that we have a bit of a problem here: the two limits (approaching from the left and again from the right) are not equal. This means that doesn't exist! The limit must be the same when approaching from the left and from the right in order for it to be an actual limit.

Finally, let's determine the value of . We can see graphically that . So,

and

Approaching from the right, on the other hand, does land on . We'll see why comparing a limit with the function's actual value matters when we define continuity below.

Here is the second function, which we'll also call : it is , except that it is not defined at . Use the slider to walk two points in toward , one from each side, and watch their values:

Review the following:

Therefore,

However, is undefined — the hollow dot marks a hole in the graph — so there is no value of for the limit to equal. That hole is what makes the function discontinuous. With this, we can now write a definition of continuity! A function is said to be continuous at a point when is defined, the limit exists, and the two are equal:

The below graph, which fills in the hole so that everywhere, makes this clear (the orange dot marks ):

II. Derivatives

From Wikipedia:

The derivative of a function of a real variable measures the sensitivity to change of the function value (output value) with respect to a change in its argument (input value).

Another way to state this is that the derivative of a function simply measures the rate of change of the function output compared to the function input at a particular point. Let's define our continuous function above and see what this really means:

Plotting this function yields the same plot, but this time I've removed the markers (dots):

At , what is happening with this function? What about at ? If we think about this function as a map of the trajectory of a cannonball (with as the horizontal distance and as the height), we might say that at the ball is moving upward and at it is falling. Let's look at the derivative of this function at those two points by simply drawing tangent lines at those points and measuring their slopes. We write the derivative of at a point as , read "f prime of a." You can draw a tangent line to the curve with the slider below:

You can see that the slope of the line at is 2 and at it is −2. This makes sense in the context of the cannonball example: at the cannonball is rising 2 units of height for every unit it travels horizontally, and at it's dropping 2 units of height for every unit it travels.

Conceptually, derivatives are quite simple. But, how do we calculate them? This is where the concept of limits that we learned above comes in.

First, let's draw a secant line between two points on the curve. The first point will be at , the point at which we'd like to compute the derivative, and the second point will be chosen arbitrarily with the slider. A secant line will be drawn between the two points.

I've left the tangent line on the graph for a reason. Notice what happens when the distance between the two values gets smaller and smaller. The secant line gets closer and closer to the tangent line. When both values equal −1, the secant line goes away and all we see is the tangent line. In other words, as the difference between our two values approaches zero, the slope of our secant line approaches the slope of our tangent line. Since we know that the slope of the tangent line is the derivative, we can say that the slope of the secant line approaches the derivative of as the distance between our two values approaches zero. Let's write that out mathematically.

First, let's name the two points. We'll call the first value (at −1) simply , and the second value . Nothing below depends on the first point being at −1, so the same reasoning works at any point on the curve. The slope of the secant line is, as for any other line, the rise over run. To evaluate the rise, we simply evaluate our function at and at , take the difference between the two values, and divide by the run which is simply . So, the slope of the secant line is:

To compute the derivative, though, we need to take the limit of this function, where the difference between and approaches zero. Let's use ("delta x") to denote the difference between and , so that , and then we can write our limit as:

This is indeed the definition of the derivative of a function at ! That's right, the derivative is a limit!! 😃

For our function , its derivative with respect to the variable , written or , is:

To see where the comes from, expand the square and cancel what you can:

As approaches zero, all that remains is . That agrees with the slopes we measured with the tangent line: and .

III. Integrals

From Wikipedia:

In mathematics, an integral assigns numbers to functions in a way that can describe displacement, area, volume, and other concepts that arise by combining infinitesimal data. Integration is one of the two main operations of calculus; its inverse operation, differentiation, is the other. Given a function of a real variable and an interval of the real line, the definite integral of from to can be interpreted informally as the signed area of the region in the xy-plane that is bounded by the graph of , the x-axis and the vertical lines and .

Let's look at an example to make this more concrete. The definite integral of the function below, , from 0 to 2 is represented by the shaded region:

We can see that this is simply the area under the curve and above the x axis, between 0 and 2. (Wherever a curve dips below the x axis, that area counts as negative, which is what Wikipedia means by signed area. On this interval stays positive, so the question doesn't come up here or in the examples that follow.) How would we compute such an area? We can't simply multiply the height by the width as we would do for a rectangle. One option would be to approximate the area by drawing rectangles under the curve between 0 and 2 and summing their areas. Let's start by drawing a few rectangles, each as tall as the curve at its left edge (so where the curve starts to come back down, a few poke slightly above it), and inspecting visually how well this approximation would do. Slowly increase the number of rectangles by sliding the slider to the right.

It should be apparent that, as you increase the number of rectangles, the sum of their areas gets closer and closer to the area of the green-shaded region in the previous graph. In other words, as the number of rectangles approaches infinity, the sum of their areas approaches the actual area under the curve that we are trying to measure.

So, how do we compute this? Before we get to that, let's look at the notation:

The way to read this is that we want to compute the integral of our function from to , and that we are integrating with respect to the variable . Let's break this down further. The symbol is used to indicate that we need to take a sum of some infinitesimally small values. The and simply denote the lower and upper bounds of our interval. is obviously the function that we are integrating and can be understood as the "delta x," just like with derivatives. It represents an infinitesimally-small change in .

Let's think about this a little more. In our graph, how exactly would we compute the area of one of our rectangles? We can see that the height of any one of the rectangles corresponds to the value of our function and the width of the rectangle depends on how many there are. Since we've already stated that we want an infinite number of rectangles, their widths are represented as , some infinitesimally small value of . So, is literally the height multiplied by the width. Note that this interpretation of is the same as in derivatives. The derivative is measuring some infinitesimally small change in (the rise) over some infinitesimally small change in (the run).

Now that we understand integration conceptually, how do we compute an integral? First, we need to make a distinction that we've not yet made. In the world of integrals there exist definite integrals, which is what has been illustrated above, and indefinite integrals. A definite integral can be thought of as an area, as we saw above, and an indefinite integral can be thought of as a function, called an anti-derivative. An anti-derivative is simply a function that, when differentiated, yields the function over which we are integrating.

Take, for example, the function we worked with in the derivatives section:

The anti-derivative, or indefinite integral, of this function is simply any function that, when differentiated, would yield . One example would be

We haven't explored any of the rules for differentiation in this notebook (you can memorize those later), but differentiating with the power rule (or with the limit from the derivatives section) yields the function , its derivative. In other words, . Note, however, that the possibilities for anti-derivatives are endless because a constant added to a function disappears when differentiating: its derivative is zero (after all, it just shifts the function up or down but doesn't change its slope). So, a valid in this case could also be

Now that we have an indefinite integral for our function , computing the following integral is very simple, using a rule we'll name in a moment:

Any anti-derivative gives the same answer: an added constant, like the + 3 above, appears in both and and cancels when we subtract.

The rule we just used, for any anti-derivative of (that is, any with ), is the fundamental theorem of calculus. It shows that the process of integration is the inverse of differentiation: to find the integral of from to , we find a function whose derivative is and take the difference of its values at and . What's incredible about this is that we can compute the entire area under a curve by simply evaluating an anti-derivative at the beginning and ending points of the interval (rather than summing the areas of an infinite number of rectangles 😄).

Let's see an illustration of this. First, let's see how the area under the curve changes as we increase the value of in , where once again and :

At each , the height of the orange-dashed line in the graph above is the area of the shaded region from 0 up to that , so its end point shows the total area. Because is positive here, as we integrate over a larger interval, we see that the shaded region becomes larger and its area becomes larger. An interesting question to ask is: how fast is the area of this shaded region increasing? In other words, what's the derivative of the function that produces the orange-dashed line?

To answer that, let's first look at what function produces the area of the green-shaded region, for each value of . By the fundamental theorem, the area from 0 to is for any anti-derivative of . In this example, , and a convenient anti-derivative is : the + 1 makes , so is exactly the area under from 0 to . In fact, is the orange-dashed line.

Now let's measure the slope of exactly the way we measured slopes in the derivatives section: step from to and divide the rise by the run. Stepping to the right by adds a thin strip to the shaded region, so the amount rises (the short red segment) is exactly the area of that strip. Pick a point , then make smaller and smaller:

What do you notice about this? When is large, the strip has a curved top and the rise over run is only a rough estimate of the tangent line's slope. But as shrinks, the strip turns into one of the rectangles from earlier: tall and wide, with an area of . Dividing that area by the run leaves just . At the same time the two orange points on close in on each other, just as the two points did in the secant example, so rise over run becomes the slope of the tangent line. In other words, the slope of the tangent line touching at any value of is equal to the value of evaluated at that same :

This is the heart of the fundamental theorem of calculus. Nothing in this figure used the formula for : every number came from measuring areas. Yet the area under , as a function of , has as its derivative, which makes it an anti-derivative of . That's why we were able to compute areas earlier by evaluating an anti-derivative. It also answers the question we started with: the rate at which the (signed) area under a curve changes is simply the height of the curve at the edge of that area.