1

As a complement to this formula, I have been considering a formula for a generalized Riemann Sum. However, in this case there are multiple facets to consider.

We can represent three of the Riemann Sum formulas in the following way.

Left Riemann Sum: $$A = \frac{b\ -\ a}{n} [f(x_0) + f(x_1) + f(x_2) + f(x_3) + \dotsb + f(x_{n-1}) + 0f(x_n)]$$

Trapezoidal Riemann Sum: $$A = \frac{b\ -\ a}{n}[\frac{1}{2}f(x_0) + f(x_1) + f(x_2) + f(x_3) + \dotsb + f(x_{n-1}) + \frac{1}{2}f(x_n)]$$

Right Riemann Sum: $$A = \frac{b\ -\ a}{n} [0f(x_0) + f(x_1) + f(x_2) + f(x_3) + \dotsb + f(x_{n-1}) + f(x_n)]$$

Geometrically, we can ignore the actual trapezoid shapes altogether, as shown here, and then switching between the above formulas can be visualized as shifting the rectangles horizontally. It stands to reason that we could stop at any point between the Left and Right Riemann Sums, not just half way as the Trapezoid formula does. So we could generalize these three formulas to $$A = \frac{b\ -\ a}{n}[Pf(x_0) + f(x_1) + f(x_2) + f(x_3) + \dotsb + f(x_{n-1}) + (1 - P)f(x_n)], where\ 0 <= P <= 1$$

On the other hand, vertically stretching/squishing the rectangles is necessary to switch between the Left or Right Riemann Sum and the Midpoint Riemann Sum. A generalization of the Left, Midpoint, and Right Riemann Sum formulas should look like $$A = \frac{b\ -\ a}{n} [f(x_Q) + f(x_{1+Q}) + f(x_{2+Q}) + f(x_{3+Q}) + \dotsb + f(x_{n-1+Q})], where\ 0 <= Q <= 1$$

Assuming these two generalization formulas are correct, is it valid to combine them into something like $$A = \frac{b\ -\ a}{n} [Pf(x_Q) + f(x_{1+Q}) + f(x_{2+Q}) + f(x_{3+Q}) + \dotsb + f(x_{n-1+Q}) + (1 - P)f(x_{n+Q})], where\ 0 <= P <= 1\ and\ 0 <= Q <= 1$$

Given any valid choice of $P$ and $Q$, does this formula become the integral of $f(x)dx$ when rectangle width is made arbitrarily small, and does it represent the entire set of formulas that achieve this?

user10478
  • 2,118

2 Answers2

2

Your formula is correct in the sense that it converges to $\int f(x)dx$, but it is not the entire set of formulas that achieve this.

Consider your setup where there are $n$ rectangles over the interval $[a,b]$. Now, I make the height of each rectangle the $\textit{minimum}$ value of $f$ on that particular subinterval. In another experiment, I could make the height of each rectangle the $\textit{maximum}$ of $f$ on that particular subinterval. A function $f$ is Riemann integrable if and only both of these "models" converge to the same value as rectangle width becomes arbitrarily small. If they converge to the same value, we call that value $\int_{a}^{b}f(x)$.

So it doesn't really matter how we construct our rectangles, as long as their height is between the minimum and the maximum value of $f$ over that particular subinterval. Your formula may be able to give good approximations for small $n$ if fine tuned for each particular function, but as $n$ becomes large it will be no better than any method.

1

It's a good idea to generalize the kinds of Riemann sums you're finding in your textbooks. The generalized formula in the question actually could be generalized a lot further, after we recognize and avoid one misstep it seems to be making.

One thing that is generally required by the Riemann sum is that the rectangles all have to fit within the interval $[a,b]$ over which you are integrating, and the height of each rectangle has to be gotten from the value of the function somewhere within the range of $x$ values covered by that rectangle (the leftmost, the rightmost, or something in between). This implies that the argument you pass to $f$ can never be less than $a$ or more than $b.$

The formulas on which yours is based all have a few assumptions in common, among which are the assumptions that $x_0 = a$ and $x_n = b.$ In other words, when we write $x_k,$ we really mean $a + k\frac{b-a}n.$ But under that assumption, if $Q > 0,$ then $$x_{n+Q} = a + (n+Q)\frac{b-a}n = b + Q \frac{b-a}n > b.$$ In other words, $x_{n+Q}$ is outside the interval $[a,b]$ and therefore is not the height of a rectangle of the Riemann sum, measured on or inside the rectangle.

As we will see, The formula is a valid Riemann sum whenever $0 \leq P \leq 1$ and $Q=0,$ and also whenever $P = 1$ and $0 \leq Q \leq 1.$ It just is not considered a Riemann sum for any other combination of $P$ and $Q.$

If we really want to generalize the Riemann sum, we get rid of the assumptions that force us to use $x$ values in such rigid arithmetic sequences, either for where we put the left and right edges of the rectangles or where we measure the height of each rectangle.

To begin with, all the kinds of Riemann sums you have considered have forced all the rectangles (except possibly two) to have the same width, $\Delta x_0 = \frac{b-a}n,$ and if we have two narrower rectangles then they have to be the first and last and their widths have to sum to $\Delta x_0.$ The width $\Delta x_0$ is called the "mesh size" of the Riemann sum. A more general Riemann sum allows more variation in the widths of the rectangles, in fact none of the rectangles has to have the same width as any other. (You can have two or more rectangles of the same width, of course; this is permitted but not required.)

In the generalized Riemann sum, we decide how many rectangles we want, let's say $m$ rectangles, and then we fit the bottoms of the $m$ rectangles in any way we want within the interval $[a,b].$ That is, we choose arbitrary $x$ values $x_1, x_2, \ldots, x_{m-1}$ such that $$ a = x_0 < x_1 < x_2 < \cdots < x_{m-1} < x_m = b,$$ and for $k = 1, 2, \ldots, m - 1$ we let $x_k$ be the $x$-coordinate of the line that separates the $k$th rectangle from the $(k+1)$st rectangle.

The width of the $k$th rectangle therefore is $$ \Delta x_k = x_k - x_{k - 1}.$$ The width of the widest rectangle (choose any of the widest ones if there's a tie) is then called the mesh size of the sum.

To determine the height of each rectangle, we choose any $x$ value within the footprint of that rectangle: the $x$ coordinate of the leftmost edge, the $x$ coordinate of the rightmost edge, or anything in between. The choice within one rectangle is independent of the choice in any other; we can choose the left sides of some rectangles, the right sides of others, the midpoints of a few more, and the rest at random points between the sides if we like. But whatever choices we make, we call the chosen $x$ coordinate within the $k$th rectangle $x_k^*.$

The generalized Riemann sum then is $$ \sum_{k=1}^m f(x_k^*) \Delta x_k. $$ There are various places you can find this kind of sum documented, for example here or (in more detail) here.

If you consider this carefully, you may see that the left, right, and midpoint rules are all generalized Riemann sums with $m = n$ and with $\Delta x_k = \frac{b-a}n$ for every rectangle. We could call all of these "uniform mesh" sums. You may also see that the trapezoid rule is equivalent to a Riemann sum with $m = n + 1,$ with $\Delta x_k = \frac{b-a}n$ for every rectangle except the first and last, and with $\Delta x_1 = \Delta x_{n+1} = \frac{b-a}{2n}$ (the widths of the first and last rectangles). To choose the $x_k^*$ values, the left, right, and midpoint rules each follow a regular pattern (left edge, right edge, or centerline of the rectangle). The Riemann sum that is equivalent to trapezoid rule uses the leftmost point of its first rectangle, the rightmost point of its last rectangle, and the centerline of every other rectangle. So the trapezoid rule is almost equivalent to a "uniform mesh" Riemann sum; only the first and last rectangle widths are smaller.

No matter how we choose the $x$ coordinates in the Riemann sum, however, it will converge to the exact Riemann integral of the function in the limit as the mesh size goes to zero. (In this limit, the number of rectangles also goes to infinity, but just increasing the number of rectangles is not enough, because we could foolishly choose to always use the first half of the interval, $[a, (a+b)/2],$ for the first rectangle and squeeze all the rest of the rectangles into the other half of the interval $[a,b].$)

As you might suspect, not every Riemann sum of $n$ terms of a given function $f$ over a given interval $[a,b]$ will give an equally good approximation of the exact integral. The error depends on various things: the width of each rectangle, where you place $x_k^*$ in each rectangle, an the first and second derivatives of $f$ at each value of $x.$ The midpoint rule tends to be the best of the bunch (even slightly better than the trapezoid rule), though for any given mesh size on a given interval you can always gin up a continuous function $f$ such that whichever rule you want beats all the others.

The generalized sum could turn out to give a relatively bad approximation for the same number of rectangles, but if you adjust the widths of the rectangles so that they are narrower when the second derivative of $f$ is large and wider when the second derivative is small, it might have an advantage. I suppose the main motivations for definining such a generalization, however, are (first) that it describes all the other Riemann sums in the textbooks, and (second) that it allows other useful Riemann sums such as the upper integral and the lower integral to be defined. (For the upper integral you choose $x_k^*$ so that it maximizes $f(x_k^*)$ in each interval; for the lower integral you minimize $f(x_k^*)$.) So it really is the do-everything sum when it comes to proving that a function can be Riemann-integrated, even if it does not automatically give you a (usually) good approximation like the midpoint or trapezoid rules.

David K
  • 108,155