Video: What Does Area Have to Do with Slope?

Grant Sanderson • 3Blue1Brown • Boclips

What Does Area Have to Do with Slope?


Video Transcript

Here, I wanna discuss one common type of problem where integration comes up: finding the average of a continuous variable. This is a perfectly useful thing to know in its own, right? But whatโ€™s really neat is that it can give us a completely different perspective for why integrals and derivatives are inverses of each other.

To start, take a look at the graph of sin of ๐‘ฅ between zero and ๐œ‹, which is half of its period. What is the average height of this graph on that interval? Itโ€™s not a useless question. All sorts of cyclic phenomena in the world are modeled using sine waves. For example, the number of hours that the sun is up per day as a function of what day of the year it is follows a sine-wave pattern. So if you wanted to predict, say, the average effectiveness of solar panels in summer months versus winter months, youโ€™d wanna be able to answer a question like this. What is the average value of that sine function over half of its period? Whereas a case like this is gonna have all sorts of constants mucking up the function, you and I are just gonna focus on a pure unencumbered sin of ๐‘ฅ function. But the substance of the approach would be totally the same in any other application.

Itโ€™s kind of a weird question to think about though, isnโ€™t it? The average of a continuous variable. Usually, with averages, we think of a finite number of variables, where you can add them all up and divide that sum by how many there are. But there are infinitely many values of sin of ๐‘ฅ between zero and ๐œ‹. And itโ€™s not like we can just add up all of those numbers and divide by infinity. Now, this sensation actually comes up a lot in math, and itโ€™s worth remembering, where you have this vague sense that what you wanna do is add together infinitely many values associated with a continuum, even though that doesnโ€™t really make sense.

And almost always, when you get that sense, the key is gonna be to use an integral somehow. And to think through exactly how, a good first step is usually to just approximate your situation with some kind of finite sum. In this case, imagine sampling a finite number of points, evenly spaced along this range. Since itโ€™s a finite sample, you can find the average by just adding up all of the heights, sin of ๐‘ฅ at each one of these, and then dividing that sum by the number of points that you sampled, right? And presumably, if the idea of an average height among all infinitely many points is gonna make any sense at all, the more points we sample, which would involve adding up more and more heights, the closer the average of that sample should be to the actual average of the continuous variable.

And this should feel at least somewhat related to taking an integral of sin of ๐‘ฅ between zero and ๐œ‹, even if it might not be exactly clear how the two ideas match up. For that integral, remember, you also think of a sample of inputs on this continuum. But instead of adding the height, sin of ๐‘ฅ at each one, and dividing by how many there are, you add up sin of ๐‘ฅ times d๐‘ฅ, where d๐‘ฅ is the spacing between the samples. That is, youโ€™re adding up little areas, not heights. And technically, the integral is not quite this sum. Itโ€™s whatever that sum approaches as d๐‘ฅ approaches zero. But it is actually quite helpful to reason with respect to one of these finite iterations, where weโ€™re looking at a concrete size for d๐‘ฅ and some specific number of rectangles.

So what you wanna do here is reframe this expression for the average, this sum of the heights divided by the number of sampled points, in terms of d๐‘ฅ, the spacing between samples. And now, if I tell you that the spacing between these points is, say, 0.1 and you know that they range from zero to ๐œ‹, can you tell me how many there are? Well, you can take the length of that interval, ๐œ‹, and divide it by the length of the space between each sample. If it doesnโ€™t go in perfectly evenly, you would have to round down to the nearest integer. But as an approximation, this is completely fine. So if we write that spacing between samples as d๐‘ฅ, the number of samples is ๐œ‹ divided by d๐‘ฅ. And when we substitute that into our expression up here, you can rearrange it, putting that d๐‘ฅ up top and distributing it into the sum.

But think about what it means to distribute that d๐‘ฅ up top. It means that the terms youโ€™re adding up will look like sin of ๐‘ฅ times d๐‘ฅ for the various inputs ๐‘ฅ that youโ€™re sampling. So that numerator looks exactly like an integral expression. And so for larger and larger samples of points, this average will approach the actual integral of sin of ๐‘ฅ between zero and ๐œ‹, all divided by the length of that interval, ๐œ‹. In other words, the average height of this graph is this area divided by its width. On an intuitive level, and just thinking in terms of units, that feels pretty reasonable, doesnโ€™t it? Area divided by width gives you an average height.

So with this expression in hand, letโ€™s actually solve it. As we saw last video, to compute an integral, you need to find an antiderivative of the function inside the integral, some other function whose derivative is sin of ๐‘ฅ. And if youโ€™re comfortable with derivatives of trig functions, you know that the derivative of cosine is negative sine. So if you just negate that, negative cosine is the function we want, the antiderivative of sine. And to go check yourself on that, look at this graph of negative cosine. At zero, the slope is zero. And then it increases up to some maximum slope at ๐œ‹ halves and then goes back down to zero at ๐œ‹. And in general, its slope does indeed seem to match the height of the sine graph at every point.

So what do we have to do to evaluate the integral of sine between 0 and ๐œ‹? Well, we evaluate this antiderivative at the upper bound and subtract off its value at the lower bound. More visually, that is the difference in the height of this negative cosine graph above ๐œ‹ and its height at zero. And as you can see, that change in height is exactly two. Thatโ€™s kind of interesting, isnโ€™t it? That the area under this sine graph turns out to be exactly two. So the answer to our average height problem, this integral divided by the width of the region, evidently turns out to be two divided by ๐œ‹, which is around 0.64.

I promised at the start that this question of finding the average of a function offers an alternate perspective on why integrals and derivatives are inverses of each other, why the area under one graph has anything to do with the slope of another graph. Notice how finding this average value, two divided by ๐œ‹, came down to looking at the change in the antiderivative negative cos ๐‘ฅ over the input range divided by the length of that range. And another way to think about that fraction is as the rise-over-run slope between the point of the antiderivative graph below zero and the point of that graph above ๐œ‹. And now think about why it might make sense that this slope would represent an average value of sin of ๐‘ฅ on that region.

Well, by definition, sin of ๐‘ฅ is the derivative of this antiderivative graph. It gives us the slope of negative cosine at every point. So another way to think about the average value of sin of ๐‘ฅ is as the average slope over all tangent lines here between zero and ๐œ‹. And when you view things like that, doesnโ€™t it make a lot of sense that the average slope of a graph over all of its points in a certain range should equal the total slope between the start and end points?

To digest this idea, it helps to think about what it looks like for a general function. For any function ๐‘“ of ๐‘ฅ, if you wanna find its average value on some interval, say between ๐‘Ž and ๐‘, what you do is take the integral of ๐‘“ on that interval, divide it by the width of that interval, ๐‘ minus ๐‘Ž. You can think of this as the area under the graph divided by its width. Or more accurately, it is the signed area of that graph, since any area below the ๐‘ฅ-axis is counted as negative. And itโ€™s worth taking a moment to remember what this area has to do with the usual notion of a finite average, where you add up many numbers and divide by how many there are.

When you take some sample of points spaced out by d๐‘ฅ, the number of samples is about equal to the length of the interval divided by d๐‘ฅ. So if you add up the values of ๐‘“ of ๐‘ฅ at each sample and divide by the total number of samples, itโ€™s the same as adding up the product, ๐‘“ of ๐‘ฅ times d๐‘ฅ, and dividing by the width of the entire interval. The only difference between that and the integral is that the integral asks what happens as d๐‘ฅ approaches zero. But that just corresponds with samples of more and more points that approximate the true average increasingly well.

Now, for any integral, evaluating it comes down to finding an antiderivative of ๐‘“ of ๐‘ฅ, commonly denoted capital ๐น of ๐‘ฅ. What we want is the change to this antiderivative between ๐‘Ž and ๐‘, capital ๐น of ๐‘ minus capital ๐น of ๐‘Ž, which you can think of as the change in height of this new graph between the two bounds. Iโ€™ve conveniently chosen an antiderivative that passes through zero at the lower bound here. But keep in mind, you can freely shift this up and down, adding whatever constant you want to it. And it would still be a valid antiderivative. So the solution to the average problem is the change in the height of this new graph divided by the change to the ๐‘ฅ-value between ๐‘Ž and ๐‘. In other words, it is the slope of the antiderivative graph between the two endpoints.

And again, when you stop to think about it, that should make a lot of sense because little ๐‘“ of ๐‘ฅ gives us the slope of the tangent line to this graph at each point. After all, it is by definition the derivative of capital ๐น. So, why are antiderivatives the key to solving integrals? Well, my favorite intuition is still the one that I showed last video. But a second perspective is that when you reframe the question of finding an average of a continuous value as, instead, finding the average slope of bunch of tangent lines, it lets you see the answer just by comparing endpoints, rather than having to actually tally up all of the points in between.

In the last video, I described the sensation that should bring integrals to your mind. Namely, if you feel like the problem youโ€™re solving could be approximated by breaking it up somehow and adding up a large number of small things. And here, I want you to come away recognizing a second sensation that should also bring integrals to your mind. If ever thereโ€™s some idea that you understand in a finite context and which involves adding up multiple values, like taking the average of a bunch of numbers, and if you wanna generalize that idea to apply to an infinite continuous range of values, try seeing if you can phase things in terms of an integral. Itโ€™s a feeling that comes up all the time, especially in probability. And itโ€™s definitely worth remembering.

Nagwa uses cookies to ensure you get the best experience on our website. Learn more about our Privacy Policy.