In mathematics, a Riemann sum is a summation of a large number of small partitions of a region. It may be used to define the integration operation. The method was named after German mathematician Bernhard Riemann.
Definition
Let f : D → R be a function defined on a subset, D, of the real line, R. Let I = [a, b] be a closed interval contained in D, and let
be a partition of I, where
The Riemann sum of f over I with partition P is defined as
The choice of in the interval is arbitrary.
Example: Specific choices of give us different types of Riemann sums:
If for all i, then S is called a left Riemann sum.
If for all i, then S is called a right Riemann sum.
If for all i, then S is called a middle Riemann sum.
The average of the left and right Riemann sum is the trapezoidal sum.
If it is given that
where is the supremum of f over , then S is defined to be an upper Riemann sum.
Similarly, if is the infimum of f over , then S is a lower Riemann sum.
Riemann sum methods of x3 over [0,2] using 4 subdivisions
Left
Right
Middle
Trapezoidal
Simpson's Method
Any Riemann sum on a given partition (that is, for any choice of between and ) is contained between the lower and the upper Riemann sums. A function is defined to be Riemann integrable if the lower and upper Riemann sums get ever closer as the partition gets finer and finer. This fact can also be used for numerical integration.
Methods
The four methods of Riemann summation are usually best approached with partitions of equal size. The interval [a, b] is therefore divided into n subintervals, each of length
The points in the partition will then be
Right sum
f is here approximated by the value at the right endpoint. This gives multiple rectangles with base Δx and with the first partition having the height f(a + Δx''). The right Riemann sum amounts to an underestimation if f is monotonically decreasing, and an overestimation if it is monotonically increasing.
Middle sum
Approximating f at the midpoint of intervals gives f(a + Q/2) for the first interval, for the next one f(a + 3Q/2), and so on until f(b − Q/2). Summing up the areas gives
The error of this formula will be
where is the maximum value of the absolute value of on the interval.
Trapezoidal rule
In this case, the values of the function f on an interval are approximated by the average of the values at the left and right endpoints. In the same manner as above, a simple calculation using the area formula
for a trapezium with parallel sides b1, b2 and height h produces
The error of this formula will be
where is the maximum value of the absolute value of
The approximation obtained with the trapezoid rule for a function is the same as the average of the left hand and right hand sums of that function.
Example
Taking an example, the area under the curve of y = x2 between 0 and 2 can be procedurally computed using Riemann's method.
The interval [0, 2] is firstly divided into n subintervals, each of which is given a width of ; these are the widths of the Riemann rectangles. Because the right Riemann sum is to be used, the sequence of x coordinates for the boxes will be . Therefore, the sequence of the heights of the boxes will be . It is an important fact that , and .
The area of each box will be and therefore the nth right Riemann sum will be:
If the limit is viewed as n → ∞, it can be concluded that the approximation approaches the actual value of the area under the curve as the number of boxes increases. Hence:
This method agrees with the definite integral as calculated in more mechanical ways: