WEBVTT

00:00:15.060 --> 00:00:19.800
Here, I want to discuss one common type of problem where integration comes up,

00:00:19.800 --> 00:00:22.500
finding the average of a continuous variable.

00:00:23.620 --> 00:00:26.297
This is a perfectly useful thing to know in its own right,

00:00:26.297 --> 00:00:29.426
but what's really neat is that it can give us a completely different

00:00:29.426 --> 00:00:32.740
perspective for why integrals and derivatives are inverses of each other.

00:00:33.460 --> 00:00:39.539
To start, take a look at the graph of sinx between 0 and pi, which is half of its period.

00:00:40.200 --> 00:00:43.800
What is the average height of this graph on that interval?

00:00:44.700 --> 00:00:46.120
It's not a useless question.

00:00:46.520 --> 00:00:50.380
All sorts of cyclic phenomena in the world are modeled using sine waves.

00:00:50.920 --> 00:00:54.349
For example, the number of hours the sun is up per day as a

00:00:54.348 --> 00:00:58.179
function of what day of the year it is follows a sine wave pattern.

00:00:58.820 --> 00:01:03.899
So if you wanted to predict the average effectiveness of solar panels in summer months vs.

00:01:04.159 --> 00:01:08.319
winter months, you'd want to be able to answer a question like this,

00:01:08.319 --> 00:01:12.659
what is the average value of that sine function over half of its period?

00:01:13.879 --> 00:01:18.247
Where as a case like this is going to have all sorts of constants mucking up the

00:01:18.248 --> 00:01:22.454
function, you and I are going to focus on a pure, unencumbered sinx function,

00:01:22.454 --> 00:01:27.039
but the substance of the approach would be totally the same in any other application.

00:01:28.260 --> 00:01:31.020
It's kind of a weird question to think about though, isn't it?

00:01:31.260 --> 00:01:33.320
The average of a continuous variable.

00:01:33.840 --> 00:01:37.594
Usually with averages we think of a finite number of variables,

00:01:37.594 --> 00:01:41.819
where you can add them all up and divide that sum by how many there are.

00:01:44.200 --> 00:01:48.221
But there are infinitely many values of sinx between 0 and pi,

00:01:48.221 --> 00:01:53.200
and it's not like we can just add up all those numbers and divide by infinity.

00:01:54.140 --> 00:01:58.215
This sensation comes up a lot in math, and it's worth remembering,

00:01:58.215 --> 00:02:02.656
where you have this vague sense that you want to add together infinitely

00:02:02.656 --> 00:02:07.340
many values associated with a continuum, even though that doesn't make sense.

00:02:08.060 --> 00:02:13.199
And almost always, when you get that sense, the key is to use an integral somehow.

00:02:13.840 --> 00:02:17.222
And to think through exactly how, a good first step is to

00:02:17.222 --> 00:02:20.780
just approximate your situation with some kind of finite sum.

00:02:20.780 --> 00:02:27.060
In this case, imagine sampling a finite number of points evenly spaced along this range.

00:02:27.919 --> 00:02:32.834
Since it's a finite sample, you can find the average by just adding up all the heights

00:02:32.835 --> 00:02:37.920
sinx at each one of these, and then dividing that sum by the number of points you sampled.

00:02:39.319 --> 00:02:43.594
And presumably, if the idea of an average height among all infinitely many

00:02:43.594 --> 00:02:47.527
points is going to make any sense at all, the more points we sample,

00:02:47.527 --> 00:02:50.549
which would involve adding up more and more heights,

00:02:50.550 --> 00:02:54.711
the closer the average of that sample should be to the actual average of

00:02:54.711 --> 00:02:56.080
the continuous variable.

00:02:57.159 --> 00:03:01.799
And this should feel at least somewhat related to taking an integral of sinx

00:03:01.799 --> 00:03:06.800
between 0 and pi, even if it might not be exactly clear how the two ideas match up.

00:03:07.460 --> 00:03:13.103
For that integral, remember, you also think of a sample of inputs on this continuum,

00:03:13.103 --> 00:03:18.812
but instead of adding the height sinx at each one and dividing by how many there are,

00:03:18.812 --> 00:03:23.460
you add up sinx times dx, where dx is the spacing between the samples.

00:03:24.400 --> 00:03:27.200
That is, you're adding up little areas, not heights.

00:03:28.300 --> 00:03:31.550
And technically, the integral is not quite this sum,

00:03:31.550 --> 00:03:34.800
it's whatever that sum approaches as dx approaches 0.

00:03:35.500 --> 00:03:39.764
But it is actually quite helpful to reason with respect to one of these finite

00:03:39.764 --> 00:03:44.406
iterations, where we're looking at a concrete size for dx and some specific number of

00:03:44.406 --> 00:03:45.000
rectangles.

00:03:45.960 --> 00:03:50.526
So what you want to do here is reframe this expression for the average,

00:03:50.526 --> 00:03:54.649
this sum of the heights divided by the number of sampled points,

00:03:54.649 --> 00:03:57.439
in terms of dx, the spacing between samples.

00:03:59.039 --> 00:04:04.117
And now, if I tell you that the spacing between these points is, say, 0.1,

00:04:04.117 --> 00:04:09.400
and you know that they range from 0 to pi, can you tell me how many there are?

00:04:11.099 --> 00:04:14.430
Well, you can take the length of that interval, pi,

00:04:14.431 --> 00:04:18.338
and divide it by the length of the space between each sample.

00:04:19.360 --> 00:04:23.812
If it doesn't go in perfectly evenly, you'd have to round down to the nearest integer,

00:04:23.812 --> 00:04:26.319
but as an approximation, this is completely fine.

00:04:27.240 --> 00:04:31.023
So if we write that spacing between samples as dx,

00:04:31.023 --> 00:04:34.140
the number of samples is pi divided by dx.

00:04:34.699 --> 00:04:38.017
And when we substitute that into our expression up here,

00:04:38.017 --> 00:04:42.559
you can rearrange it, putting that dx up top and distributing it into the sum.

00:04:43.759 --> 00:04:47.139
But think about what it means to distribute that dx up top.

00:04:48.120 --> 00:04:51.586
It means that the terms you're adding up will look like

00:04:51.586 --> 00:04:55.300
sinx times dx for the various inputs x that you're sampling.

00:04:56.079 --> 00:04:59.079
So that numerator looks exactly like an integral expression.

00:04:59.819 --> 00:05:02.944
And so for larger and larger samples of points,

00:05:02.944 --> 00:05:07.699
this average will approach the actual integral of sinx between 0 and pi,

00:05:07.699 --> 00:05:10.759
all divided by the length of that interval, pi.

00:05:11.939 --> 00:05:17.139
In other words, the average height of this graph is this area divided by its width.

00:05:18.079 --> 00:05:21.038
On an intuitive level, and just thinking in terms of units,

00:05:21.038 --> 00:05:23.060
that feels pretty reasonable, doesn't it?

00:05:23.459 --> 00:05:26.039
Area divided by width gives you an average height.

00:05:26.939 --> 00:05:30.399
So with this expression in hand, let's actually solve it.

00:05:31.180 --> 00:05:36.069
As we saw last video, to compute an integral, you need to find an antiderivative

00:05:36.069 --> 00:05:41.020
of the function inside the integral, some other function whose derivative is sinx.

00:05:42.000 --> 00:05:45.550
And if you're comfortable with derivatives of trig functions,

00:05:45.550 --> 00:05:48.759
you know that the derivative of cosine is negative sine.

00:05:49.439 --> 00:05:53.449
So if you just negate that, negative cosine is the function we want,

00:05:53.449 --> 00:05:55.019
the antiderivative of sine.

00:05:55.639 --> 00:05:59.620
And to gut-check yourself on that, look at this graph of negative cosine.

00:06:00.019 --> 00:06:06.335
At 0, the slope is 0, and then it increases up to some maximum slope at pi halves,

00:06:06.336 --> 00:06:09.000
and then goes back down to 0 at pi.

00:06:09.879 --> 00:06:12.735
And in general, its slope does indeed seem to

00:06:12.735 --> 00:06:15.840
match the height of the sine graph at every point.

00:06:17.060 --> 00:06:21.120
So what do we have to do to evaluate the integral of sine between 0 and pi?

00:06:22.079 --> 00:06:25.570
We evaluate this antiderivative at the upper bound,

00:06:25.571 --> 00:06:28.660
and subtract off its value at the lower bound.

00:06:29.560 --> 00:06:32.838
More visually, that's the difference in the height of

00:06:32.838 --> 00:06:36.240
this negative cosine graph above pi and its height at 0.

00:06:37.259 --> 00:06:40.779
And as you can see, that change in height is exactly 2.

00:06:41.920 --> 00:06:43.400
That's kind of interesting, isn't it?

00:06:43.540 --> 00:06:47.460
That the area under this sine graph turns out to be exactly 2?

00:06:48.220 --> 00:06:53.845
So the answer to our average height problem, this integral divided by the width

00:06:53.845 --> 00:06:59.400
of the region, evidently turns out to be 2 divided by pi, which is around 0.64.

00:07:01.300 --> 00:07:06.341
I promised at the start that this question of finding the average of a function offers

00:07:06.341 --> 00:07:11.324
an alternate perspective on why integrals and derivatives are inverses of each other,

00:07:11.324 --> 00:07:15.960
why the area under one graph has anything to do with the slope of another graph.

00:07:16.980 --> 00:07:20.662
Notice how finding this average value, 2 divided by pi,

00:07:20.661 --> 00:07:24.475
came down to looking at the change in the antiderivative,

00:07:24.475 --> 00:07:29.540
negative cosine x, over the input range, divided by the length of that range.

00:07:30.600 --> 00:07:35.820
And another way to think about that fraction is as the rise over run slope between

00:07:35.819 --> 00:07:41.040
the point of the antiderivative graph below 0 and the point of that graph above pi.

00:07:41.939 --> 00:07:45.552
Think about why it might make sense that this slope would

00:07:45.552 --> 00:07:48.980
represent an average value of sine of x on that region.

00:07:50.459 --> 00:07:55.298
By definition, sine of x is the derivative of this antiderivative graph,

00:07:55.298 --> 00:07:58.879
giving us the slope of negative cosine at every point.

00:07:59.759 --> 00:08:03.879
Another way to think about the average value of sine of x is

00:08:03.879 --> 00:08:08.000
as the average slope over all tangent lines between 0 and pi.

00:08:08.899 --> 00:08:12.620
And when you view things like that, doesn't it make a lot of sense

00:08:12.620 --> 00:08:16.341
that the average slope of a graph over all its points in a certain

00:08:16.341 --> 00:08:20.120
range should equal the total slope between the start and end points?

00:08:23.220 --> 00:08:27.520
To digest this idea, it helps to think about what it looks like for a general function.

00:08:28.319 --> 00:08:33.706
For any function f of x, if you want to find its average value on some interval,

00:08:33.706 --> 00:08:38.162
say between a and b, what you do is take the integral of f on that

00:08:38.162 --> 00:08:42.019
interval divided by the width of that interval, b minus a.

00:08:43.080 --> 00:08:47.321
You can think of this as the area under the graph divided by its width,

00:08:47.321 --> 00:08:50.678
or more accurately, it is the signed area of that graph,

00:08:50.678 --> 00:08:53.919
since any area below the x-axis is counted as negative.

00:08:55.500 --> 00:09:00.154
And it's worth taking a moment to remember what this area has to do with the usual notion

00:09:00.154 --> 00:09:04.500
of a finite average, where you add up many numbers and divide by how many there are.

00:09:05.059 --> 00:09:08.331
When you take some sample of points spaced out by dx,

00:09:08.331 --> 00:09:13.240
the number of samples is about equal to the length of the interval divided by dx.

00:09:14.220 --> 00:09:18.595
So if you add up the values of f of x at each sample and divide by

00:09:18.595 --> 00:09:23.035
the total number of samples, it's the same as adding up the product

00:09:23.034 --> 00:09:27.279
f of x times dx and dividing by the width of the entire interval.

00:09:27.919 --> 00:09:32.269
The only difference between that and the integral is that the integral asks

00:09:32.269 --> 00:09:36.562
what happens as dx approaches 0, but that just corresponds with samples of

00:09:36.562 --> 00:09:40.740
more and more points that approximate the true average increasingly well.

00:09:42.240 --> 00:09:48.365
Now for any integral, evaluating it comes down to finding an antiderivative of f of x,

00:09:48.365 --> 00:09:50.620
commonly denoted capital F of x.

00:09:51.500 --> 00:09:56.315
What we want is the change to this antiderivative between a and b,

00:09:56.315 --> 00:10:00.843
capital F of b minus capital F of a, which you can think of as

00:10:00.842 --> 00:10:05.299
the change in height of this new graph between the two bounds.

00:10:06.559 --> 00:10:11.958
I've conveniently chosen an antiderivative that passes through 0 at the lower bound here,

00:10:11.958 --> 00:10:16.219
but keep in mind you can freely shift this up and down adding whatever

00:10:16.220 --> 00:10:20.000
constant you want and it would still be a valid antiderivative.

00:10:21.320 --> 00:10:25.986
So the solution to the average problem is the change in the height of

00:10:25.985 --> 00:10:30.519
this new graph divided by the change to the x value between a and b.

00:10:31.399 --> 00:10:36.139
In other words, it is the slope of the antiderivative graph between the two endpoints.

00:10:37.120 --> 00:10:41.604
And again, when you stop to think about it, that should make a lot of sense,

00:10:41.604 --> 00:10:46.379
because little gives us the slope of the tangent line to this graph at each point.

00:10:47.120 --> 00:10:51.060
After all, it is by definition the derivative of capital F.

00:10:52.980 --> 00:10:56.500
So why are antiderivatives the key to solving integrals?

00:10:57.600 --> 00:11:01.267
My favorite intuition is still the one I showed last video,

00:11:01.267 --> 00:11:06.646
but a second perspective is that when you reframe the question of finding an average of

00:11:06.645 --> 00:11:11.841
a continuous value as instead finding the average slope of a bunch of tangent lines,

00:11:11.841 --> 00:11:15.264
it lets you see the answer just by comparing endpoints,

00:11:15.264 --> 00:11:19.299
rather than having to actually tally up all the points in between.

00:11:23.120 --> 00:11:27.658
In the last video I described a sensation that should bring integrals to your mind,

00:11:27.658 --> 00:11:31.764
namely if you feel like the problem you're solving could be approximated by

00:11:31.764 --> 00:11:35.439
breaking it up somehow and adding up a large number of small things.

00:11:36.100 --> 00:11:38.835
Here I want you to come away recognizing a second

00:11:38.835 --> 00:11:41.900
sensation that should also bring integrals to your mind.

00:11:42.879 --> 00:11:46.878
If ever there's some idea that you understand in a finite context,

00:11:46.878 --> 00:11:51.354
and which involves adding up multiple values, like taking the average of a

00:11:51.354 --> 00:11:56.248
bunch of numbers, and if you want to generalize that idea to apply to an infinite

00:11:56.248 --> 00:12:01.500
continuous range of values, try seeing if you can phrase things in terms of an integral.

00:12:02.139 --> 00:12:05.794
It's a feeling that comes up all the time, especially in probability,

00:12:05.794 --> 00:12:07.779
and it's definitely worth remembering.

00:12:09.039 --> 00:12:12.039
My thanks, as always, go to those making these videos possible.

00:12:31.500 --> 00:12:38.840
Thank you.
