Recent from talks
Nothing was collected or created yet.
Riemann sum
View on Wikipedia
In mathematics, a Riemann sum is a certain kind of approximation of an integral by a finite sum. It is named after nineteenth century German mathematician Bernhard Riemann. One very common application is in numerical integration, i.e., approximating the area of functions or lines on a graph, where it is also known as the rectangle rule. It can also be applied for approximating the length of curves and other approximations.
The sum is calculated by partitioning the region into shapes (rectangles, trapezoids, parabolas, or cubics—sometimes infinitesimally small) that together form a region that is similar to the region being measured, then calculating the area for each of these shapes, and finally adding all of these small areas together. This approach can be used to find a numerical approximation for a definite integral even if the fundamental theorem of calculus does not make it easy to find a closed-form solution.
Because the region by the small shapes is usually not exactly the same shape as the region being measured, the Riemann sum will differ from the area being measured. This error can be reduced by dividing up the region more finely, using smaller and smaller shapes. As the shapes get smaller and smaller, the sum approaches the Riemann integral.
Definition
[edit]Let be a function defined on a closed interval of the real numbers, , and as a partition of , that is A Riemann sum of over with partition is defined as where and .[1] One might produce different Riemann sums depending on which 's are chosen. In the end this will not matter, if the function is Riemann integrable, when the difference or width of the summands approaches zero.
Types of Riemann sums
[edit]Specific choices of give different types of Riemann sums:
- If for all i, the method is the left rule[2][3] and gives a left Riemann sum.
- If for all i, the method is the right rule[2][3] and gives a right Riemann sum.
- If for all i, the method is the midpoint rule[2][3] and gives a middle Riemann sum.
- If (that is, the supremum of over ), the method is the upper rule and gives an upper Riemann sum or upper Darboux sum.
- If (that is, the infimum of f over ), the method is the lower rule and gives a lower Riemann sum or lower Darboux sum.
All these Riemann summation methods are among the most basic ways to accomplish numerical integration. Loosely speaking, a function is Riemann integrable if all Riemann sums converge as the partition "gets finer and finer".
While not derived as a Riemann sum, taking the average of the left and right Riemann sums is the trapezoidal rule and gives a trapezoidal sum. It is one of the simplest of a very general way of approximating integrals using weighted averages. This is followed in complexity by Simpson's rule and Newton–Cotes formulas.
Any Riemann sum on a given partition (that is, for any choice of between and ) is contained between the lower and upper Darboux sums. This forms the basis of the Darboux integral, which is ultimately equivalent to the Riemann integral.
Riemann summation methods
[edit]The four Riemann summation methods are usually best approached with subintervals of equal size. The interval [a, b] is therefore divided into subintervals, each of length
The points in the partition will then be
Left rule
[edit]
For the left rule, the function is approximated by its values at the left endpoints of the subintervals. This gives multiple rectangles with base Δx and height f(a + iΔx). Doing this for i = 0, 1, ..., n − 1, and summing the resulting areas gives
The left Riemann sum amounts to an overestimation if f is monotonically decreasing on this interval, and an underestimation if it is monotonically increasing. The error of this formula will be where is the maximum value of the absolute value of over the interval.
Right rule
[edit]
For the right rule, the function is approximated by its values at the right endpoints of the subintervals. This gives multiple rectangles with base Δx and height f(a + iΔx). Doing this for i = 1, ..., n, and summing the resulting areas gives
The right Riemann sum amounts to an underestimation if f is monotonically decreasing, and an overestimation if it is monotonically increasing. The error of this formula will be where is the maximum value of the absolute value of over the interval.
Midpoint rule
[edit]
For the midpoint rule, the function is approximated by its values at the midpoints of the subintervals. This gives f(a + Δx/2) for the first subinterval, f(a + 3Δx/2) for the next one, and so on until f(b − Δx/2). Summing the resulting areas gives
The error of this formula will be where is the maximum value of the absolute value of over the interval. This error is half of that of the trapezoidal sum; as such the middle Riemann sum is the most accurate approach to the Riemann sum.
Generalized midpoint rule
[edit]A generalized midpoint rule formula, also known as the enhanced midpoint integration, is given by where is the number of intervals denotes even derivative.
For a function defined over interval , its integral is Therefore, we can apply this generalized midpoint integration formula by assuming that . This formula is particularly efficient for the numerical integration when the integrand is a highly oscillating function.
Trapezoidal rule
[edit]
For the trapezoidal rule, the function is approximated by the average of its values at the left and right endpoints of the subintervals. Using the area formula for a trapezium with parallel sides b1 and b2, and height h, and summing the resulting areas gives
The error of this formula will be where is the maximum value of the absolute value of .
The approximation obtained with the trapezoidal sum for a function is the same as the average of the left hand and right hand sums of that function.
Connection with integration
[edit]For a one-dimensional Riemann sum over domain , as the maximum size of a subinterval shrinks to zero (that is the limit of the norm of the subintervals goes to zero), some functions will have all Riemann sums converge to the same value. This limiting value, if it exists, is defined as the definite Riemann integral of the function over the domain,
For a finite-sized domain, if the maximum size of a subinterval shrinks to zero, this implies the number of subinterval goes to infinity. For finite partitions, Riemann sums are always approximations to the limiting value and this approximation gets better as the partition gets finer. The following animations help demonstrate how increasing the number of subintervals (while lowering the maximum subinterval size) better approximates the "area" under the curve:
-
Left Riemann sum
-
Right Riemann sum
-
Middle Riemann sum
Since the red function here is assumed to be a smooth function, all three Riemann sums will converge to the same value as the number of subintervals goes to infinity.
Example
[edit]Taking an example, the area under the curve y = x2 over [0, 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 (hereafter "boxes"). 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:
Because the function is continuous and monotonically increasing over the interval, a right Riemann sum overestimates the integral by the largest amount (while a left Riemann sum would underestimate the integral by the largest amount). This fact, which is intuitively clear from the diagrams, shows how the nature of the function determines how accurate the integral is estimated. While simple, right and left Riemann sums are often less accurate than more advanced techniques of estimating an integral such as the Trapezoidal rule or Simpson's rule.
The example function has an easy-to-find anti-derivative so estimating the integral by Riemann sums is mostly an academic exercise; however it must be remembered that not all functions have anti-derivatives so estimating their integrals by summation is practically important.
Higher dimensions
[edit]The basic idea behind a Riemann sum is to "break-up" the domain via a partition into pieces, multiply the "size" of each piece by some value the function takes on that piece, and sum all these products. This can be generalized to allow Riemann sums for functions over domains of more than one dimension.
While intuitively, the process of partitioning the domain is easy to grasp, the technical details of how the domain may be partitioned get much more complicated than the one dimensional case and involves aspects of the geometrical shape of the domain.[4]
Two dimensions
[edit]In two dimensions, the domain may be divided into a number of two-dimensional cells such that . Each cell then can be interpreted as having an "area" denoted by .[5] The two-dimensional Riemann sum is where .
Three dimensions
[edit]In three dimensions, the domain is partitioned into a number of three-dimensional cells such that . Each cell then can be interpreted as having a "volume" denoted by . The three-dimensional Riemann sum is[6] where .
Arbitrary number of dimensions
[edit]Higher dimensional Riemann sums follow a similar pattern. An n-dimensional Riemann sum is where , that is, it is a point in the n-dimensional cell with n-dimensional volume .
Generalization
[edit]In high generality, Riemann sums can be written where stands for any arbitrary point contained in the set and is a measure on the underlying set. Roughly speaking, a measure is a function that gives a "size" of a set, in this case the size of the set ; in one dimension this can often be interpreted as a length, in two dimensions as an area, in three dimensions as a volume, and so on.
See also
[edit]- Antiderivative
- Euler method and midpoint method, related methods for solving differential equations
- Lebesgue integration
- Riemann integral, limit of Riemann sums as the partition becomes infinitely fine
- Simpson's rule, a powerful numerical method more powerful than basic Riemann sums or even the Trapezoidal rule
- Trapezoidal rule, numerical method based on the average of the left and right Riemann sum
References
[edit]- ^ Hughes-Hallett, Deborah; McCullum, William G.; et al. (2005). Calculus (4th ed.). Wiley. p. 252. (Among many equivalent variations on the definition, this reference closely resembles the one given here.)
- ^ a b c Hughes-Hallett, Deborah; McCullum, William G.; et al. (2005). Calculus (4th ed.). Wiley. p. 340.
So far, we have three ways of estimating an integral using a Riemann sum: 1. The left rule uses the left endpoint of each subinterval. 2. The right rule uses the right endpoint of each subinterval. 3. The midpoint rule uses the midpoint of each subinterval.
- ^ a b c Ostebee, Arnold; Zorn, Paul (2002). Calculus from Graphical, Numerical, and Symbolic Points of View (Second ed.). p. M-33.
Left-rule, right-rule, and midpoint-rule approximating sums all fit this definition.
- ^ Swokowski, Earl W. (1979). Calculus with Analytic Geometry (Second ed.). Boston, MA: Prindle, Weber & Schmidt. pp. 821–822. ISBN 0-87150-268-2.
- ^ Ostebee, Arnold; Zorn, Paul (2002). Calculus from Graphical, Numerical, and Symbolic Points of View (Second ed.). p. M-34.
We chop the plane region R into m smaller regions R1, R2, R3, ..., Rm, perhaps of different sizes and shapes. The 'size' of a subregion Ri is now taken to be its area, denoted by ΔAi.
- ^ Swokowski, Earl W. (1979). Calculus with Analytic Geometry (Second ed.). Boston, MA: Prindle, Weber & Schmidt. pp. 857–858. ISBN 0-87150-268-2.
External links
[edit]Riemann sum
View on GrokipediaFundamentals
Definition
In mathematics, a Riemann sum provides a finite approximation to the definite integral of a function over an interval by discretizing the domain into subintervals and evaluating the function at selected points within each. For a function continuous on the closed interval , consider a partition of into subintervals for , where each subinterval has length . The Riemann sum associated with this partition and a choice of points (known as tag points) is defined as This summation computes the total of products of function values at the tag points and corresponding subinterval widths, yielding an estimate of the net signed area under the curve of .[2] Geometrically, the Riemann sum corresponds to the combined area of rectangles, each with base and height , positioned beneath (or above, depending on the sign of ) the graph of over . These rectangles approximate the region bounded by the curve, the x-axis, and the vertical lines at and , with the accuracy improving as the subintervals become narrower.[10] Although continuity of ensures well-behaved approximations in introductory contexts, the formal definition of a Riemann sum applies more broadly to any bounded function on the closed interval , where boundedness guarantees that for some and all , preventing the sum from diverging.[5]Partitions and Tags
A partition of a closed interval is a finite ordered set of points , where is a positive integer, dividing the interval into subintervals for .[11] The length of each subinterval is denoted , which may vary across the partition.[11] The norm of the partition, denoted , is defined as the maximum length among these subintervals: . This measure quantifies the coarseness of the partition, with smaller norms indicating finer divisions of the interval.[5] To form a Riemann sum, each subinterval is associated with a tag point , which can be chosen arbitrarily within the subinterval; the collection of these points is called a tagging of the partition. This flexibility allows the evaluation of the function at any point in each subinterval, enabling various approximation strategies.[5] Partitions can be regular (or uniform), where all subinterval lengths are equal, for all , or irregular, where the differ, accommodating non-uniform sampling of the interval. Uniform partitions simplify computations, particularly in introductory examples, while irregular ones provide greater adaptability for complex functions.[12] Refinement of a partition involves adding additional points to an existing partition , creating a new partition that includes all points of plus the new ones, which necessarily reduces the norm . This process allows for increasingly precise approximations by systematically decreasing the maximum subinterval length.[13]Approximation Rules
Left Riemann Sum
The left Riemann sum is a specific type of Riemann sum where the sample point, or tag, , in each subinterval of a partition of is chosen as the left endpoint .[14] This choice aligns the approximation with the function value at the start of each subinterval.[8] For a uniform partition where the interval is divided into equal subintervals of width , the left Riemann sum is given by the formula where .[2] This sum represents the total area of rectangles, each with base and height . Geometrically, the left Riemann sum constructs rectangles that touch the curve at their left edges, providing a stepwise approximation to the area under from to . If is monotonically increasing on , this method underestimates the integral because the left endpoints yield smaller heights than the curve's average over each subinterval; conversely, for a monotonically decreasing , it overestimates the integral.[15] The left Riemann sum offers computational simplicity, resembling a forward difference scheme in numerical analysis, which facilitates easy implementation in basic algorithms for integral approximation.[16]Right Riemann Sum
In the right Riemann sum, the tag point for each subinterval is chosen as the right endpoint .[10] For a uniform partition of the interval into subintervals, each of width , the right Riemann sum is given by where .[10] Geometrically, this approximation constructs rectangles with bases and heights , aligned such that each rectangle touches the curve at its right edge; for an increasing function , this typically overestimates the area under the curve, while for a decreasing function, it underestimates it.[7] The right Riemann sum relates to backward difference methods in numerical analysis, where the endpoint evaluation mirrors the structure of backward approximations for integrals in solving differential equations.[17] As the number of subintervals approaches infinity, the right Riemann sum converges to the definite integral provided that is Riemann integrable on .[5] In practical implementations, such as numerical programming, the right Riemann sum is computed using loops that evaluate at the end of each subinterval, facilitating straightforward iteration from left to right across the partition.[18]Midpoint Riemann Sum
In the midpoint Riemann sum, the sample point, or tag, in each subinterval of a partition of the interval is selected as the midpoint . This choice evaluates the function at the center of each subinterval, providing a representative value that balances the endpoints. For a uniform partition where the subintervals each have width , the midpoints are for , and the midpoint Riemann sum is given by Geometrically, this constructs approximating rectangles centered beneath the curve, with heights determined by at the midpoint; for slowly varying functions, this centering reduces systematic bias compared to endpoint selections by capturing a more average behavior over the subinterval.[19] The midpoint rule offers advantages over left and right endpoint rules, particularly in accuracy for non-linear functions. It is exact for linear functions, as the value at the midpoint equals the average value over the interval, yielding the precise integral without error. For concave or convex functions, the midpoint evaluation typically produces lower error bounds than endpoint methods, since it avoids the over- or underestimation at the edges where curvature effects are more pronounced. Additionally, the midpoint Riemann sum relates to tangent line approximations at the midpoints, where the rectangle height aligns with the linear tangent, providing a local linearization that enhances precision for mildly curved functions.[20][21]Trapezoidal Rule
The trapezoidal rule provides an approximation to the definite integral of a continuous function over an interval by treating the area under the curve as a series of trapezoids. It is constructed as the average of the left and right Riemann sums over a partition of the interval, which symmetrically weights the function values at the endpoints of each subinterval.[22] For a general partition , the approximation is given by where . This formula arises from applying the single-interval trapezoidal approximation to each subinterval and summing the results, forming the composite trapezoidal rule.[23] Geometrically, the rule interprets the area under as the union of trapezoids, where each trapezoid spans a subinterval and has parallel sides of lengths and f(x_i}, connected by a straight line segment that linearly interpolates between the function values at the endpoints. The area of each such trapezoid is exactly , providing a piecewise linear approximation to the curve.[22] For a uniform partition where for all , the composite trapezoidal rule simplifies to This form weights the interior points with a factor of 2 while halving the contributions at the endpoints and .[24] The trapezoidal rule is exact for any linear function , as the piecewise linear interpolation matches the function itself, resulting in zero error. More generally, the local truncation error in each subinterval is proportional to times the second derivative for some in that subinterval, while the global error for the composite rule scales with . This quadratic convergence in stems from the rule's reliance on linear approximation, which captures constant and linear terms precisely but deviates for higher-order curvature captured by the second derivative.[25]Convergence and Integration
Riemann Integrability
A bounded function is Riemann integrable if the upper and lower Darboux integrals coincide.[26] For a partition of , the upper Darboux sum is defined as where and , while the lower Darboux sum is with .[26] The upper Darboux integral is the infimum of over all partitions , and the lower Darboux integral is the supremum of over all ; is integrable if these values are equal, and the common value is the integral.[5] The Darboux formulation using upper and lower sums is equivalent to the original Riemann definition, which considers the limit of Riemann sums as the mesh , independent of the choice of tags in each subinterval.[26] Specifically, is Riemann integrable if and only if, for every , there exists a partition such that .[5] This criterion ensures that the oscillation of can be controlled arbitrarily well by refining the partition. A fundamental characterization, known as Lebesgue's criterion, states that a bounded function on is Riemann integrable if and only if its set of discontinuities has Lebesgue measure zero.[5] This result highlights that Riemann integrability allows for discontinuities but only on sets of "negligible size," extending the class of integrable functions beyond continuous ones while excluding highly oscillatory or pathological cases.Limit as Definite Integral
The definite integral of a Riemann integrable function over the closed interval is given by the limit of its Riemann sums as the mesh (or norm) of the partition approaches zero. Specifically, if is Riemann integrable on , then where is a partition of with mesh , , and are arbitrary tags; this limit exists and is independent of the choice of tags and partitions, provided the mesh tends to zero.[5] A sketch of the proof relies on the definitions of upper and lower Darboux sums associated with the partition : for any choice of tags, the Riemann sum satisfies , where and are the lower and upper sums, respectively. Riemann integrability implies that both the upper integral and lower integral equal the common value , and as , both and approach this value. By the squeeze theorem, the Riemann sum converges to the same limit.[5] The notation explicitly denotes this limit of Riemann sums taken over all sequences of partitions with mesh approaching zero; it represents the net signed area under the curve of and generalizes the antiderivative-based definition from calculus to a broader class of functions.[5] This formalization of the definite integral as a limit of sums originated in Bernhard Riemann's 1854 habilitation thesis at the University of Göttingen, where he extended Augustin's Cauchy's earlier concepts of integrability to handle a wider range of functions, including those with discontinuities, by emphasizing the role of partition refinement.[27] For continuous functions on the compact interval , uniform continuity (guaranteed by the Heine-Borel theorem) ensures that the oscillation of on each subinterval is bounded by whenever , for some . This uniformity implies that , so is Riemann integrable, and the Riemann sums converge to independently of the tag selection rule.[5]Applications and Examples
One-Dimensional Numerical Example
To illustrate the practical computation of Riemann sums, consider the function defined on the interval . The exact value of the definite integral is . For a uniform partition with subintervals, the width of each subinterval is , and the partition points are for , or . The left Riemann sum uses the function values at the left endpoints of each subinterval: This underestimates the integral, as is increasing on . The right Riemann sum uses the right endpoints: This overestimates the integral for the same reason. The midpoint Riemann sum uses the midpoints of each subinterval (): This provides a closer approximation to the exact value. The trapezoidal rule approximates the area using trapezoids formed by connecting the function values at the endpoints: This slightly overestimates the integral. The following table shows the approximations for increasing values of (1, 2, 4, 8), demonstrating convergence toward the exact integral of :| Left Riemann Sum | Right Riemann Sum | Midpoint Riemann Sum | Trapezoidal Rule | |
|---|---|---|---|---|
| 1 | 0 | 1 | 0.25 | 0.5 |
| 2 | 0.125 | 0.625 | 0.3125 | 0.375 |
| 4 | 0.21875 | 0.46875 | 0.328125 | 0.34375 |
| 8 | 0.2734375 | 0.3984375 | 0.33203125 | 0.3359375 |
Error Analysis
The error between a Riemann sum approximation and the definite integral depends on the selection of sample points within each subinterval and the granularity of the partition. For left and right endpoint rules with uniform partitions of subintervals, the absolute error satisfies , assuming is continuously differentiable on . This bound arises from applying the mean value theorem to the difference between the function value at the endpoint and the average over the subinterval.[28] In contrast, the midpoint rule achieves a higher order of accuracy for smoother functions. If is twice continuously differentiable, the error is , with the bound . Similarly, the trapezoidal rule, which averages left and right endpoints, has error for some , yielding the bound . These rates reflect the quadratic convergence enabled by the second derivative, making both methods superior to endpoint rules for twice-differentiable functions.[29] Key factors influencing the error include the norm of the partition, defined as the maximum subinterval length, and the smoothness of . Convergence to the integral is guaranteed for continuous as the partition norm approaches zero, but the error rate accelerates with higher-order bounded derivatives; for instance, mere continuity yields no specific rate beyond , while differentiability provides the bound for endpoint rules. Non-uniform partitions can exacerbate errors if the norm does not decrease uniformly.[5] The following table compares the error bounds for the rules on a uniform partition, highlighting the advantages of midpoint and trapezoidal approximations for smooth functions:| Rule | Error Bound | Asymptotic Order |
|---|---|---|
| Left/Right | $\frac{(b-a)^2}{2n} \max | f'(x) |
| Midpoint | $\frac{(b-a)^3}{24 n^2} \max | f''(x) |
| Trapezoidal | $\frac{(b-a)^3}{12 n^2} \max | f''(x) |