WEBVTT
00:00:04.360 --> 00:00:22.280
Here, I wanna discuss one common type of problem where integration comes up: finding the average of a continuous variable.
00:00:23.560 --> 00:00:25.880
This is a perfectly useful thing to know in its own, right?
00:00:26.200 --> 00:00:32.440
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.
00:00:33.560 --> 00:00:39.440
To start, take a look at the graph of sin of ๐ฅ between zero and ๐, which is half of its period.
00:00:40.440 --> 00:00:43.720
What is the average height of this graph on that interval?
00:00:44.840 --> 00:00:46.040
Itโs not a useless question.
00:00:46.520 --> 00:00:50.400
All sorts of cyclic phenomena in the world are modeled using sine waves.
00:00:51.000 --> 00:00:58.040
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.
00:00:58.760 --> 00:01:07.800
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.
00:01:08.280 --> 00:01:12.560
What is the average value of that sine function over half of its period?
00:01:13.840 --> 00:01:22.400
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.
00:01:22.960 --> 00:01:26.960
But the substance of the approach would be totally the same in any other application.
00:01:28.360 --> 00:01:30.880
Itโs kind of a weird question to think about though, isnโt it?
00:01:31.280 --> 00:01:33.240
The average of a continuous variable.
00:01:33.840 --> 00:01:41.040
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.
00:01:41.040 --> 00:01:49.880
But there are infinitely many values of sin of ๐ฅ between zero and ๐.
00:01:49.880 --> 00:01:53.040
And itโs not like we can just add up all of those numbers and divide by infinity.
00:01:53.040 --> 00:02:07.320
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.
00:02:08.120 --> 00:02:13.040
And almost always, when you get that sense, the key is gonna be to use an integral somehow.
00:02:13.840 --> 00:02:20.600
And to think through exactly how, a good first step is usually to just approximate your situation with some kind of finite sum.
00:02:21.640 --> 00:02:27.040
In this case, imagine sampling a finite number of points, evenly spaced along this range.
00:02:27.880 --> 00:02:38.520
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?
00:02:39.480 --> 00:02:55.800
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.
00:02:57.200 --> 00:03:06.480
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.
00:03:07.560 --> 00:03:12.000
For that integral, remember, you also think of a sample of inputs on this continuum.
00:03:12.680 --> 00:03:23.480
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.
00:03:24.360 --> 00:03:27.280
That is, youโre adding up little areas, not heights.
00:03:28.240 --> 00:03:30.680
And technically, the integral is not quite this sum.
00:03:31.000 --> 00:03:34.800
Itโs whatever that sum approaches as d๐ฅ approaches zero.
00:03:35.560 --> 00:03:45.040
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.
00:03:46.360 --> 00:03:57.440
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.
00:03:59.040 --> 00:04:08.840
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?
00:04:08.840 --> 00:04:18.320
Well, you can take the length of that interval, ๐, and divide it by the length of the space between each sample.
00:04:19.360 --> 00:04:23.280
If it doesnโt go in perfectly evenly, you would have to round down to the nearest integer.
00:04:23.600 --> 00:04:26.080
But as an approximation, this is completely fine.
00:04:27.200 --> 00:04:34.160
So if we write that spacing between samples as d๐ฅ, the number of samples is ๐ divided by d๐ฅ.
00:04:35.160 --> 00:04:43.840
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.
00:04:44.200 --> 00:04:47.000
But think about what it means to distribute that d๐ฅ up top.
00:04:48.080 --> 00:04:55.200
It means that the terms youโre adding up will look like sin of ๐ฅ times d๐ฅ for the various inputs ๐ฅ that youโre sampling.
00:04:56.080 --> 00:04:59.160
So that numerator looks exactly like an integral expression.
00:05:00.000 --> 00:05:12.240
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, ๐.
00:05:12.240 --> 00:05:17.160
In other words, the average height of this graph is this area divided by its width.
00:05:18.080 --> 00:05:22.840
On an intuitive level, and just thinking in terms of units, that feels pretty reasonable, doesnโt it?
00:05:23.400 --> 00:05:25.960
Area divided by width gives you an average height.
00:05:27.440 --> 00:05:30.200
So with this expression in hand, letโs actually solve it.
00:05:31.160 --> 00:05:41.120
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 ๐ฅ.
00:05:42.080 --> 00:05:48.600
And if youโre comfortable with derivatives of trig functions, you know that the derivative of cosine is negative sine.
00:05:49.400 --> 00:05:54.840
So if you just negate that, negative cosine is the function we want, the antiderivative of sine.
00:05:55.800 --> 00:05:59.320
And to go check yourself on that, look at this graph of negative cosine.
00:06:00.000 --> 00:06:01.800
At zero, the slope is zero.
00:06:02.560 --> 00:06:10.440
And then it increases up to some maximum slope at ๐ halves and then goes back down to zero at ๐.
00:06:10.440 --> 00:06:15.720
And in general, its slope does indeed seem to match the height of the sine graph at every point.
00:06:17.040 --> 00:06:21.120
So what do we have to do to evaluate the integral of sine between 0 and ๐?
00:06:22.120 --> 00:06:28.440
Well, we evaluate this antiderivative at the upper bound and subtract off its value at the lower bound.
00:06:29.520 --> 00:06:36.240
More visually, that is the difference in the height of this negative cosine graph above ๐ and its height at zero.
00:06:37.240 --> 00:06:40.680
And as you can see, that change in height is exactly two.
00:06:41.920 --> 00:06:43.160
Thatโs kind of interesting, isnโt it?
00:06:43.560 --> 00:06:48.920
That the area under this sine graph turns out to be exactly two.
00:06:49.120 --> 00:06:59.240
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.
00:06:59.240 --> 00:07:15.840
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.
00:07:17.320 --> 00:07:29.600
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.
00:07:30.560 --> 00:07:43.080
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 ๐.
00:07:43.280 --> 00:07:48.880
And now think about why it might make sense that this slope would represent an average value of sin of ๐ฅ on that region.
00:07:50.280 --> 00:07:54.960
Well, by definition, sin of ๐ฅ is the derivative of this antiderivative graph.
00:07:55.560 --> 00:07:58.520
It gives us the slope of negative cosine at every point.
00:07:59.640 --> 00:08:09.440
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 ๐.
00:08:09.440 --> 00:08:20.120
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?
00:08:23.600 --> 00:08:27.440
To digest this idea, it helps to think about what it looks like for a general function.
00:08:28.320 --> 00:08:43.480
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 ๐.
00:08:43.480 --> 00:08:46.520
You can think of this as the area under the graph divided by its width.
00:08:47.080 --> 00:08:53.600
Or more accurately, it is the signed area of that graph, since any area below the ๐ฅ-axis is counted as negative.
00:08:53.600 --> 00:09:03.920
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.
00:09:03.920 --> 00:09:13.360
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๐ฅ.
00:09:14.200 --> 00:09:27.160
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.
00:09:27.160 --> 00:09:34.320
The only difference between that and the integral is that the integral asks what happens as d๐ฅ approaches zero.
00:09:35.080 --> 00:09:40.240
But that just corresponds with samples of more and more points that approximate the true average increasingly well.
00:09:40.240 --> 00:09:53.160
Now, for any integral, evaluating it comes down to finding an antiderivative of ๐ of ๐ฅ, commonly denoted capital ๐น of ๐ฅ.
00:09:53.160 --> 00:10:05.360
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.
00:10:06.560 --> 00:10:11.240
Iโve conveniently chosen an antiderivative that passes through zero at the lower bound here.
00:10:11.680 --> 00:10:16.960
But keep in mind, you can freely shift this up and down, adding whatever constant you want to it.
00:10:17.520 --> 00:10:19.920
And it would still be a valid antiderivative.
00:10:21.280 --> 00:10:32.120
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 ๐.
00:10:32.120 --> 00:10:36.160
In other words, it is the slope of the antiderivative graph between the two endpoints.
00:10:37.120 --> 00:10:46.240
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.
00:10:47.040 --> 00:10:51.040
After all, it is by definition the derivative of capital ๐น.
00:10:53.000 --> 00:10:56.600
So, why are antiderivatives the key to solving integrals?
00:10:57.600 --> 00:11:00.600
Well, my favorite intuition is still the one that I showed last video.
00:11:01.040 --> 00:11:19.080
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.
00:11:19.080 --> 00:11:27.000
In the last video, I described the sensation that should bring integrals to your mind.
00:11:27.520 --> 00:11:35.520
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.
00:11:35.520 --> 00:11:42.240
And here, I want you to come away recognizing a second sensation that should also bring integrals to your mind.
00:11:42.720 --> 00:12:01.520
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.
00:12:02.480 --> 00:12:05.680
Itโs a feeling that comes up all the time, especially in probability.
00:12:05.920 --> 00:12:07.600
And itโs definitely worth remembering.