[00:15] Here, I want to discuss one common type of problem where integration comes up, [00:19] finding the average of a continuous variable. [00:23] This is a perfectly useful thing to know in its own right, [00:26] but what's really neat is that it can give us a completely different [00:29] perspective for why integrals and derivatives are inverses of each other. [00:33] To start, take a look at the graph of sinx between 0 and pi, which is half of its period. [00:40] What is the average height of this graph on that interval? [00:44] It's not a useless question. [00:46] All sorts of cyclic phenomena in the world are modeled using sine waves. [00:50] For example, the number of hours the sun is up per day as a [00:54] function of what day of the year it is follows a sine wave pattern. [00:58] So if you wanted to predict the average effectiveness of solar panels in summer months vs. [01:04] winter months, you'd want to be able to answer a question like this, [01:08] what is the average value of that sine function over half of its period? [01:13] Where as a case like this is going to have all sorts of constants mucking up the [01:18] function, you and I are going to focus on a pure, unencumbered sinx function, [01:22] but the substance of the approach would be totally the same in any other application. [01:28] It's kind of a weird question to think about though, isn't it? [01:31] The average of a continuous variable. [01:33] Usually with averages we think of a finite number of variables, [01:37] where you can add them all up and divide that sum by how many there are. [01:44] But there are infinitely many values of sinx between 0 and pi, [01:48] and it's not like we can just add up all those numbers and divide by infinity. [01:54] This sensation comes up a lot in math, and it's worth remembering, [01:58] where you have this vague sense that you want to add together infinitely [02:02] many values associated with a continuum, even though that doesn't make sense. [02:08] And almost always, when you get that sense, the key is to use an integral somehow. [02:13] And to think through exactly how, a good first step is to [02:17] just approximate your situation with some kind of finite sum. [02:20] In this case, imagine sampling a finite number of points evenly spaced along this range. [02:27] Since it's a finite sample, you can find the average by just adding up all the heights [02:32] sinx at each one of these, and then dividing that sum by the number of points you sampled. [02:39] And presumably, if the idea of an average height among all infinitely many [02:43] points is going to make any sense at all, the more points we sample, [02:47] which would involve adding up more and more heights, [02:50] the closer the average of that sample should be to the actual average of [02:54] the continuous variable. [02:57] And this should feel at least somewhat related to taking an integral of sinx [03:01] between 0 and pi, even if it might not be exactly clear how the two ideas match up. [03:07] For that integral, remember, you also think of a sample of inputs on this continuum, [03:13] but instead of adding the height sinx at each one and dividing by how many there are, [03:18] you add up sinx times dx, where dx is the spacing between the samples. [03:24] That is, you're adding up little areas, not heights. [03:28] And technically, the integral is not quite this sum, [03:31] it's whatever that sum approaches as dx approaches 0. [03:35] But it is actually quite helpful to reason with respect to one of these finite [03:39] iterations, where we're looking at a concrete size for dx and some specific number of [03:44] rectangles. [03:45] So what you want to do here is reframe this expression for the average, [03:50] this sum of the heights divided by the number of sampled points, [03:54] in terms of dx, the spacing between samples. [03:59] And now, if I tell you that the spacing between these points is, say, 0.1, [04:04] and you know that they range from 0 to pi, can you tell me how many there are? [04:11] Well, you can take the length of that interval, pi, [04:14] and divide it by the length of the space between each sample. [04:19] If it doesn't go in perfectly evenly, you'd have to round down to the nearest integer, [04:23] but as an approximation, this is completely fine. [04:27] So if we write that spacing between samples as dx, [04:31] the number of samples is pi divided by dx. [04:34] And when we substitute that into our expression up here, [04:38] you can rearrange it, putting that dx up top and distributing it into the sum. [04:43] But think about what it means to distribute that dx up top. [04:48] It means that the terms you're adding up will look like [04:51] sinx times dx for the various inputs x that you're sampling. [04:56] So that numerator looks exactly like an integral expression. [04:59] And so for larger and larger samples of points, [05:02] this average will approach the actual integral of sinx between 0 and pi, [05:07] all divided by the length of that interval, pi. [05:11] In other words, the average height of this graph is this area divided by its width. [05:18] On an intuitive level, and just thinking in terms of units, [05:21] that feels pretty reasonable, doesn't it? [05:23] Area divided by width gives you an average height. [05:26] So with this expression in hand, let's actually solve it. [05:31] As we saw last video, to compute an integral, you need to find an antiderivative [05:36] of the function inside the integral, some other function whose derivative is sinx. [05:42] And if you're comfortable with derivatives of trig functions, [05:45] you know that the derivative of cosine is negative sine. [05:49] So if you just negate that, negative cosine is the function we want, [05:53] the antiderivative of sine. [05:55] And to gut-check yourself on that, look at this graph of negative cosine. [06:00] At 0, the slope is 0, and then it increases up to some maximum slope at pi halves, [06:06] and then goes back down to 0 at pi. [06:09] And in general, its slope does indeed seem to [06:12] match the height of the sine graph at every point. [06:17] So what do we have to do to evaluate the integral of sine between 0 and pi? [06:22] We evaluate this antiderivative at the upper bound, [06:25] and subtract off its value at the lower bound. [06:29] More visually, that's the difference in the height of [06:32] this negative cosine graph above pi and its height at 0. [06:37] And as you can see, that change in height is exactly 2. [06:41] That's kind of interesting, isn't it? [06:43] That the area under this sine graph turns out to be exactly 2? [06:48] So the answer to our average height problem, this integral divided by the width [06:53] of the region, evidently turns out to be 2 divided by pi, which is around 0.64. [07:01] I promised at the start that this question of finding the average of a function offers [07:06] an alternate perspective on why integrals and derivatives are inverses of each other, [07:11] why the area under one graph has anything to do with the slope of another graph. [07:16] Notice how finding this average value, 2 divided by pi, [07:20] came down to looking at the change in the antiderivative, [07:24] negative cosine x, over the input range, divided by the length of that range. [07:30] And another way to think about that fraction is as the rise over run slope between [07:35] the point of the antiderivative graph below 0 and the point of that graph above pi. [07:41] Think about why it might make sense that this slope would [07:45] represent an average value of sine of x on that region. [07:50] By definition, sine of x is the derivative of this antiderivative graph, [07:55] giving us the slope of negative cosine at every point. [07:59] Another way to think about the average value of sine of x is [08:03] as the average slope over all tangent lines between 0 and pi. [08:08] And when you view things like that, doesn't it make a lot of sense [08:12] that the average slope of a graph over all its points in a certain [08:16] range should equal the total slope between the start and end points? [08:23] To digest this idea, it helps to think about what it looks like for a general function. [08:28] For any function f of x, if you want to find its average value on some interval, [08:33] say between a and b, what you do is take the integral of f on that [08:38] interval divided by the width of that interval, b minus a. [08:43] You can think of this as the area under the graph divided by its width, [08:47] or more accurately, it is the signed area of that graph, [08:50] since any area below the x-axis is counted as negative. [08:55] And it's worth taking a moment to remember what this area has to do with the usual notion [09:00] of a finite average, where you add up many numbers and divide by how many there are. [09:05] When you take some sample of points spaced out by dx, [09:08] the number of samples is about equal to the length of the interval divided by dx. [09:14] So if you add up the values of f of x at each sample and divide by [09:18] the total number of samples, it's the same as adding up the product [09:23] f of x times dx and dividing by the width of the entire interval. [09:27] The only difference between that and the integral is that the integral asks [09:32] what happens as dx approaches 0, but that just corresponds with samples of [09:36] more and more points that approximate the true average increasingly well. [09:42] Now for any integral, evaluating it comes down to finding an antiderivative of f of x, [09:48] commonly denoted capital F of x. [09:51] What we want is the change to this antiderivative between a and b, [09:56] capital F of b minus capital F of a, which you can think of as [10:00] the change in height of this new graph between the two bounds. [10:06] I've conveniently chosen an antiderivative that passes through 0 at the lower bound here, [10:11] but keep in mind you can freely shift this up and down adding whatever [10:16] constant you want and it would still be a valid antiderivative. [10:21] So the solution to the average problem is the change in the height of [10:25] this new graph divided by the change to the x value between a and b. [10:31] In other words, it is the slope of the antiderivative graph between the two endpoints. [10:37] And again, when you stop to think about it, that should make a lot of sense, [10:41] because little gives us the slope of the tangent line to this graph at each point. [10:47] After all, it is by definition the derivative of capital F. [10:52] So why are antiderivatives the key to solving integrals? [10:57] My favorite intuition is still the one I showed last video, [11:01] but a second perspective is that when you reframe the question of finding an average of [11:06] a continuous value as instead finding the average slope of a bunch of tangent lines, [11:11] it lets you see the answer just by comparing endpoints, [11:15] rather than having to actually tally up all the points in between. [11:23] In the last video I described a sensation that should bring integrals to your mind, [11:27] namely if you feel like the problem you're solving could be approximated by [11:31] breaking it up somehow and adding up a large number of small things. [11:36] Here I want you to come away recognizing a second [11:38] sensation that should also bring integrals to your mind. [11:42] If ever there's some idea that you understand in a finite context, [11:46] and which involves adding up multiple values, like taking the average of a [11:51] bunch of numbers, and if you want to generalize that idea to apply to an infinite [11:56] continuous range of values, try seeing if you can phrase things in terms of an integral. [12:02] It's a feeling that comes up all the time, especially in probability, [12:05] and it's definitely worth remembering. [12:09] My thanks, as always, go to those making these videos possible. [12:31] Thank you.