Riemann sums are an alternative way
to calculate the integral of a function.
They are not very convenient to prove theorems,
but sometimes they are useful for computations.
I will assume that you have already
watched the video where I defined integral,
and the video where I explained how to
interpret integrals as limits.
They are both linked in the description.
I will continue using the concepts and notation
from those two videos.
For this video,
I will consider a function f
that is bounded and integrable,
on a closed interval [a, b].
For example,
If the function is continuous on [a, b],
then I know it is both bounded and integrable.
Let's say that this is the graph of the function f.
The integral I want to calculate
is the area of the shaded region.
Let's take a partition of the interval [a, b].
As you know,
the partition breaks the region into slices.
Then, I can estimate the area
of each slice with a rectangle.
I can under-estimate with a rectangle below,
pictured in red,
or I can over-estimate with a rectangle above,
pictured in green.
If I want to use this in the calculation,
there is one annoying step.
The height of each rectangle
is the infimum or supremum of the function
on that sub-interval.
Unless the function is monotonic,
that will be a pain to calculate.
So, what if, instead,
I choose a random point on the graph of f
over every sub-interval,
and I use the value of the function at that point
as the height of the rectangle?
That gives me a new set of rectangles
to estimate the area.
Notice that these rectangles
are always between the lower rectangles
and the upper rectangles,
so they are just an estimate.
We do not know if they are an under- or over-estimate.
These rectangles are going to depend
on the points I choose over each sub-interval.
Let's give a name to the x-coordinates of those points.
If the points in the partition are called x_0, x_1, x_2 and so on,
it is customary to call the points in the sub-intervals
x_1*, x_2*, and so on.
I'm not a big fan of this notation,
but it is very standard, so I will use it.
Okay then!
With this notation, what is the area of these new rectangles,
pictured in black?
The width of each rectangle is the same as before,
and the height of each rectangle
is the value of f at the point x_i*.
So the area is the sum from i = 1 to n
of f(x_i*) time ∆x_i.
Notice that I had many options
for the points x_i*, and each one of them
would give me different rectangles.
I can make things simpler by always picking
the left endpoint of each sub-interval,
or the right-endpoint, or perhaps the middle point,
or anything else I want.
Whatever choice I make,
I will call this sum a RIEMANN SUM.
Here's a more formal definition.
Let f be a bounded function on the interval [a, b],
and let P be a partition of [a, b],
consisting of the point x_0, x_1, x_2 and so on,
until x_n.
For each i, I define ∆x_i to be the length
of the i-th sub-interval,
and I choose a number x_i* on the i-th sub-interval.
This means that x_i* is between x_i and x_{i-1}.
Then, the sum I wrote on the previous picture
is what we call a "Riemann-sum for f and P."
Notice that I said A Riemann sum,
not THE Riemann sum.
This Riemann sum depends not only on the function,
the interval and the partition,
it also depends on the number x_i*
we choose on each sub-interval.
So, even after fixing the function and the partition,
there are lots of other Riemann sums.
I am going to denote this Riemann sum as S*_p(f).
The star in the name indicates that the Riemann sum
depends on the choice of point on each sub-interval.
How is this helpful???
Here is the theorem that justifies
caring about Riemann sums.
Let's fix a bounded function f
on the interval [a, b],
and assume f is integrable on [a, b].
As I said before, for example,
if f is continuous on [a, b], then f is integrable on [a, b].
Let's pick a sequence of partitions
P_1, P_2, P_3 and so on,
whose norms approach 0 as n approaches infinity.
For example, the simplest choice
is to take P_n to be the partition that breaks [a, b]
into n sub-intervals of equal length.
Then, on each sub-interval of each partition,
we pick a point x_i*.
For example, the simplest choice
is to just take the right endpoint of each sub-interval.
Then, the integral from a to b of f
equals the limit of these Riemann sums.
I want to emphasize that this is simpler than
computing the integral directly from the definition.
For, I do not need to worry about ALL partitions.
I can use just one sequence of partitions,
and I will pick simple-enough partitions
to simplify the calculations.
Second, I do not need to calculate suprema
and infima on each sub-interval.
I just have to pick a point on each sub-interval,
and I will make a choice that makes the calculation simpler.
I will explain this with an example at the end of the video.
Here's another way to write the same formula,
that is quite suggestive.
It suggests that in the limit,
the sum turns into an integral,
and the width of each sub-interval, ∆x,
turns into dx.
That's why some people like to say that dx
represents an infinitesimally small width.
There is some value to that interpretation,
but I won't go into it just yet.
I also want to mention that this notation is not perfect.
Strictly speaking, the numbers x_i and x_i*
should have two indices: i and n,
because they depend on the partition P_n.
However, this notation is quite standard,
so I will continue using it.
The proof of this theorem turns out to be quite simple,
if we use everything we know so far.
We know what happens when we take limits
of lower or upper sums.
The limit as n approaches infinity
of the P_n-lower sum of f is the lower integral of f.
And the limit of the P_n-upper sum is the upper integral.
That is always true for any bounded function,
given the choice of partitions we used.
But since the function is also integrable,
we know the lower and upper integrals
are both THE integral.
In addition, we know that any Riemann sum is sandwiched
between the corresponding lower and upper sums.
Therefore, using the Squeeze Theorem,
the limit of the Riemann sums
is also the integral.
That's it.
That is why we needed the function f to be integrable
to begin with.
On the positive side, this calculation is easier.
On the negative side, I needed to know the function f
was integrable before I even started.
If I try to use Riemann sums to compute the integral
of an arbitrary bounded function,
without knowing whether it is integrable or not,
this method won't work.
The limit may or may not exist,
and it may depend on the choices we made.
Even if the limit exists,
it does not tell me whether the function is integrable.
That is why in practice, we tend to use Riemann sums
only for continuous functions,
because those are guaranteed to be integrable.
To complete this video, I want to work out one example in detail.
Let's compute the integral from 0 to 1 of x,
with respect to x, using Riemann sums.
Using the notation in this video,
the function f is defined by f(x) = x
– it is continuous –
and the interval is [0, 1].
Let's use our shiny new formula!
Here is the graph.
We are trying to compute the shaded area.
To be fair, we do not need integrals to compute this area.
It's a triangle!
We know the answer should be 1/2.
I am only using this example
to illustrate how Riemann sums work.
I hope the answer at the end of the calculation
is indeed 1/2.
Okay then.
I am going to choose as the partition P_n
the one that breaks the interval [0, 1]
into n equal sub-intervals.
I can write this partition explicitly.
It consists of the points 0, 1/n, 2/n, 3/n and so on,
all the way to 1.
On each sub-interval, I am going to choose the right endpoint
to make the algebra simpler.
Here is the graph again.
As an example, I will use n = 5.
Here is the partition.
And here are the rectangles.
Now, to compute the Riemann sum.
The first rectangle has height 1/5 and width 1/5.
The second rectangle has height 2/5 and width 1/5.
And so on.
I can rewrite this with sigma notation,
as sum from i = 1 to 5 of i/5 times 1/5.
i/5 is the value of the function at the right endpoint,
and 1/5 is the common width.
And of course the same expression will work
for an arbitrary value of n.
Notice that in this case, the Riemann sum
happens to be the upper sum as well,
but that's an accident.
Then I just have to take the limit as n approaches infinity.
The rest is algebra.
Okay.
The integral from 0 to 1 of x with respect to x
is the limit as n approaches infinity of
the sum from i = 1 to n
of i/n times 1/n.
First, for the purpose of the sum, the variable is i,
and n is a constant.
n will be the variable for the purpose of the limit,
but a constant for the purpose of the sum.
So, I can factor 1/n^2 out of the sum.
Now we have the sum from i = 1 to n of i.
That is the sum of the first n positive integers.
There's a standard identity for it.
It is n(n+1)/2.
I simplify this a bit...
and now it is a limit of a quotient of polynomials.
Use any technique you want.
I trust you know how to compute this.
The answer is 1/2,
as it should be!
To summarize, Riemann sums
may look like a simpler way
to compute some integrals than the original definition.
But they only work if we know
in advance that the function is integrable.
For example, if it is continuous.
To develop the theory of integration
and to prove theorems and properties,
the original definition is still more useful.