Riemann Sums Riemann Sums
Introduction
Riemann sums approximate the area under a curve by dividing the domain into rectangles and summing the areas of those rectangles.
The grey represents the area calculated by the riemann sum.
The red is the true area under the curve.
We divided the domain
(-2, 2)
into 5 rectangles.
Each rectangle's width is
(2 - (-2))/5 = 0.8
.
Each rectangle's height is the value of the function where the box starts.
Each rectangle's area is the width times the height.
Notation
Before showing the equation for the Riemann sum, we need to define a sum:
\sum_{i=1}^{n} f(x_i) = f(x_1) + f(x_2) + f(x_3) + \ldots + f(x_n)
Here is the equation for the Riemann sum of
f
on
[a, b]
with
n
rectangles:
\Delta x = \frac{b - a}{n} \\ \text{} \\
\sum_{i=1}^{n} f(x_i) \Delta x = f(x_1) \Delta x + f(x_2) \Delta x + f(x_3) \Delta x + \ldots + f(x_n) \Delta x
\Delta x
is the width of the rectangles.
x_i
is the
x
-value of the
i
th rectangle.
f(x_i) \Delta x
is the area of the
i
th rectangle.
Alignment
Riemann sums can use different alignments. Above, we used a left alignment.
Here are the other options.
Left
Each box's height is calculated by finding the value of the function at its left side.
Right
Each box's height is calculated by finding the value of the function at its right side.
Midpoint
Each box's height is calculated by finding the value of the function at its midpoint.
Trapezoidal
Each box's height is calculated by finding the value of the function at both its left and right sides and averaging them.
This could be represented by a box with its height equal to the average of its left and right heights, but it is more obvious when represented by trapezoids.
Number of Boxes
Riemann sums can also use different numbers of boxes. Above we used 5, but we can use any number from
1
to
\infty
.
10
1
100
As the number of boxes approaches
\infty
, the Riemann sum approaches the integral.
\lim_{n \to \infty} \sum_{i=1}^{n} f(x_i) \Delta x = \int_a^b f(x) dx