# Riemann Sums

A **Riemann sum** is an approximation of a region's area, obtained by adding up the areas of multiple simplified slices of the region. It is applied in calculus to formalize the method of exhaustion, used to determine the area of a region. This process yields the integral, which computes the value of the area exactly.

#### Contents

## Definition

Let us decompose a given closed interval \( [a,b] \) into \( n \) subintervals by inserting \( n-1 \) points \( x_{1},x_{2}, \ldots, x_{n-1} \) such that

\[a=x_{0}<x_{1}<x_{2}<\ldots<x_{k}<\ldots<x_{n}=b.\]

Such a collection of points \( \{x_{0}, x_{1}, \ldots, x_{n}\} \) is called a *partition* of \( [a,b] \), and this partition determines the following \( n \) closed subintervals:

\[[x_{0},x_{1} ],[x_{1},x_{2} ],\ldots,[x_{n-1},x_{n} ].\]

Let \( [x_{k-1},x_{k}] \) denote the \( k^\text{th}\) closed subinterval of the partition, and let \( \Delta x_{k} \) denote the length of the \( k^\text{th}\) subinterval. Note that \( \Delta x_{k} \) need not be the same for each subinterval.

If \( f \) is defined on the closed interval \( [a,b] \) and \( c_k \) is any point in \( [x_{k-1},x_{k}] \), then a

Riemann sumis defined as\[\sum_{k=1}^n f(c_{k})\Delta x_{k}.\]

A Riemann sum can be visualized as a division of (approximately) the area under the curve \( f(x) \) on \( [a,b] \) into \( n \) adjacent rectangles spanning the interval, where the \( k^\text{th}\) rectangle has width \( \Delta x_{k} \) and height \( f(c_{k}) \). The area of each rectangle is \( f(c_{k}) \Delta x_{k} \) (height times width). The sum of the areas of all rectangles approximates the actual area under \( f \) on \( [a,b] \) and is equal to the Riemann sum. Note that \( c_{k} \) could be any point in the \( k^\text{th}\) subinterval, which means the definition leaves some latitude in choosing the height of each of the \( n \) rectangles.

## Relationship to Definite Integral

For more information on definite integrals, see Definite Integrals.

The Riemann sum of a function is related to the definite integral as follows:

\[\displaystyle\lim_{n\rightarrow \infty}\displaystyle\sum_{k=1}^{n}f(c_k)\Delta x_k =\displaystyle\int_{a}^{b} f(x) \, dx.\]

## Application and Examples

Evaluate the Riemann sum pictured below, which is a left-hand approximation of the area under

\[ f(x) = \sqrt{16-x^2}, \quad 0 \leq x \leq 4. \]

As we are using the left endpoints of 4 rectangles on the interval \([0,4],\) we can first find the value of \(f(x)\) at each left endpoint in the range:

\[\begin{align} f(0) &= 4 \\ f(1) &= \sqrt{15} \\ f(2) &= \sqrt{12} \\ f(3) &= \sqrt{7}. \end{align} \]

We also know that the interval is of length 4 and we are splitting it into 4 rectangles of equal width. So the width of each rectangle is 1, or \(\Delta x = 1\).

We are now left with a sum of the area of each rectangle to find the area of the total blue region in the image above:

\[\begin{align} \sum_{i=0}^3 f(x_i) \Delta x &= \big[f(x_0) + f(x_1) + f(x_2) + f(x_3)\big]\Delta x \\ &= \big[(f(0) + f(1) + f(2) + f(3)\big]\Delta x \\ &= \big(4 + \sqrt{15} + \sqrt{12} + \sqrt{7}\big)\cdot 1 \\ &\approx 13.982, \end{align}\]

which, as we can see from the graph, is a slight overestimate of the area under the curve as the function is decreasing on the interval. \(_\square\)

Let \( f(x) \) be a continuous function bounded from below by the \(x\)-axis. Find an overestimation and an underestimation of the area of the bounded region on the closed interval \( [a,b] \) using Riemann sums.

For simplicity we divide the interval \( [a,b] \) into \( n \) subintervals of equal length, \( \Delta x = \frac {b-a}{n} \). By the extreme value theorem \( f(x) \) has a minimum and a maximum value on each subinterval, and for the \(k^\text{th}\) subinterval we will denote them by \( f(m_{k}) \) and \( f(M_{k}) ,\) respectively. At point \( m_{k} \) we construct a rectangle with height \( f(m_{k}) \) which lies below the curve, and at point \( M_{k} \) we construct a rectangle with height \( f(M_{k}) \) which lies partially above the curve.

To compute the area of each rectangle, we find the product of the corresponding length and height:

\[\begin{align} (\text{Area of inner rectangle}) = \Delta x f(m_{k}) &\leq \big(\text{Area under } f \text{ on }k^\text{th} \text{ subinterval}\big)\\ & \leq \Delta x f(M_{k}) \\ &= (\mbox{Area of outer rectangle}). \end{align}\]

(We omit the proof of this statement and for now rely on inspection.)

Let us denote by \( s_{n} \) the sum of the areas of all inner rectangles, and by \( S_{n} \) the sum of the areas of all outer rectangles. Then we obtain the formulas

\[\begin{align} (\mbox{Approximation from below}) &= s_{n}= \sum_{k=1}^n f(m_{k}) \Delta x=(\mbox{Total area of inner rectangles}) \nonumber \\ (\mbox{Approximation from above})&=S_{n}=\sum_{k=1}^n f(M_{k}) \Delta x=(\mbox{Total area of outer rectangles} \nonumber). \end{align}\]

The area under the curve of the bounded function \( f(x) \) is larger than the total area of the inner rectangles but smaller than that of the outer rectangles. That is, applying the property of inequalities which states if \( a<b \) and \( c<d \), then \( a+c<b+d \) on the inequality above describing the \(k^\text{th}\) subinterval, we obtain

\[s_{n}=\sum_{k=1}^n f(m_{k} )\Delta x\leq (\mbox{Area of region}) \leq \sum_{k=1}^n f(M_{k} ) \Delta x=S_{n},\]

making \( s_{n} \) an underestimation and \( S_{n} \) an overestimation. \(_\square\)

**Note:**

- If \( m_{k}=x_{k-1} \), then \( s_{n}=\sum_{k=1}^nf(x_{k-1}) \Delta x \) and we call this the left-hand Riemann sum approximation.
- If \( M_{k}=x_{k} \), then \( S_{n}=\sum_{k=1}^n f(x_{k})\Delta x \) and we call this the right-hand Riemann sum approximation.

Evaluate the Riemann sum for \( f(x) = x^2 \) on the interval \( [0,4] \), which uses the left endpoint for each of

- a) 10 equal subintervals
- b) 100 equal subintervals.

We divide the interval \( [a,b] = [0,4] \) into \( n \) subintervals of equal length:

\[\Delta x_{k}= \Delta x=\frac{b-a}{n}=\frac{4-0}{n}=\frac{4}{n}.\]

This partition of \( [0,4] \) includes the following points:

\[0=a=x_{0}<x_{0}+ \Delta x<x_{0}+2\Delta x< \cdots < x_{0}+k\Delta x<\cdots<x_{0}+n\Delta x=b=4.\]

Substituting for \( x_{0} \) and \( \Delta x \), we obtain

\[0<\frac{4}{n}<2\times\frac{4}{n}<\cdots<k\times\frac{4}{n}<\cdots<n\times\frac{4}{n}=4.\]

Then

\[ x_{k}=k\times\frac{4}{n}.\]

Next, we find the left-hand Riemann sum approximation:

\[\begin{align} s_{n}=\sum_{k=1}^nf(x_{k-1}) \Delta x &=\sum_{k=1}^n\big(x_{k-1}^2\big)\left(\frac{4}{n}\right) \nonumber \\ &=\sum_{k=1}^n\left[(k-1)\left(\frac{4}{n}\right)\right]^2\left(\frac{4}{n}\right) \nonumber \\ &=\sum_{k=1}^n\left(\frac{64}{n^3}\right)\left(k^2-2k+1\right) \nonumber \\ &=\frac{64}{n^3}\left[\sum_{k=1}^n k^2 - 2\sum_{k=1}^n k + \sum_{k=1}^n 1\right] \nonumber \\ &=\left(\frac{64}{n^3}\right)\left[\frac{n(n+1)(2n+1)}{6} - 2\times\frac{n(n+1)}{2} + n\right] \nonumber \\ &=\left(\frac{32}{3n^3}\right)\left(2n^3 +3n^2+n-6n^2-6n+6n\right) \nonumber \\ &=\left(\frac{32}{3n^2}\right)\left(2n^2-3n+1\right), \nonumber \end{align}\]

where we have used summation formulas to expand the sums.

Therefore, the answers are as follows:

- a) For \( n=10 \), \( s_{n}=18.24. \)
- b) For \( n=100 \), \( s_{n} = 21.0144. \) \(_\square\)

Notethat \( \int_0^4 x^2 dx = 21.\overline{3} \) is the actual area under the curve, and by adding more rectangles we would achieve a better approximation.

Evaluate the Riemann sum for \( f(x) = 1 - x^2 \) on the interval \( [0,1] \), which uses the right endpoint for each of the infinitely many subintervals.

Let's first divide the \(x\)-axis into many intervals each of width \(\Delta x =\frac 1n\), so the intervals would be

\[\left[0,\dfrac 1n\right], \left[\dfrac 1n ,\dfrac 2n\right],\dots ,\left[\dfrac{n-1}{n},1\right].\]

Then we have subintervals each of width \(\frac 1n\) and height:

\[\left[f\left(\dfrac 1n\right)\right], \left[f\left(\dfrac 2n\right)\right],\dots , \left[f\left(\dfrac kn\right)\right], \dots, \left[f\left(\dfrac nn\right)\right].\]

Thus the area of all the subintervals would be given by the following sum (and we call it the Reimann sum):

\[\begin{align} \displaystyle\sum_{k=1}^n f\left(\dfrac kn \right)\left(\dfrac 1n\right)&=\displaystyle\sum_{k=1}^n\left(1-\left(\dfrac kn\right)^2\right)\left(\dfrac 1n\right)\\ &=\displaystyle\sum_{k=1}^n \left(\dfrac 1n-\dfrac{k^2}{n^3}\right)\\ &=\displaystyle\sum_{k=1}^n\dfrac 1n - \displaystyle\sum_{k=1}^n \dfrac{k^2}{n^3}\\ &=n\times\dfrac {1}{n} -\dfrac {1}{n^3}\displaystyle\sum_{k=1}^n k^2\\ &=1-\left(\dfrac 1{n^3}\right)\dfrac{n(n+1)(2n+1)}{6}\\ &=1-\dfrac{2n^3+3n^2+n}{6n^3}. \end{align}\]

Therefore, the area would be the limit as \(n\to \infty\) of the above expression, which is equal to

\[\displaystyle\lim_{n\to\infty} 1-\dfrac{2n^3+3n^2+n}{6n^3}=1-\dfrac 26=\dfrac 23. \ _\square\]

## Definite Integral as a Limit of a Sum

We can express definite integral as a limit of the sum of a certain number of terms. Let \(f(x)\) be a continuous function in the interval \([a,b]\). Divide \(a-b\) into \(n\) equal parts such that the width of each part is \(h\). Then

\[nh=b-a.\]

The definite integral of a function \(f(x)\) in the interval \([a,b]\) can be defined as

\[\begin{align} \int _{ a }^{ b } f(x)\, dx &= \lim _{ n\rightarrow \infty, h\rightarrow 0 }{ h \big[f(a+h)+f(a+2h)+\cdots+f(a+nh)\big] } \\ &=\lim _{ n\rightarrow \infty, h\rightarrow 0 }{ h\sum _{ r=1 }^{ n }{ f(a+rh) }} . \end{align} \]

With the help of this formula, we can evaluate some simple definite integrals. The process of finding definite integrals with the use of the above formula is known as **definite integral as a limit of a sum**.

## Summation of Series with help of Definite Integrals

Consider the "limit of sum" formula defined in the previous section, i.e.

\[\int _{ a }^{ b }{ f(x)\, dx=\lim _{ n\rightarrow \infty, h\rightarrow 0 }{ h\big[f(a+h)+f(a+2h)+\cdots+f(a+nh)\big] } } .\]

Now that we got the concept in the previous section, we will look for the working rules.

Working rules:

- First of all, express the given series in the form \( \frac { 1 }{ n } \sum { f\left(\frac { r }{ n } \right) } \).
- Replace \(\sum\) for the integral sign \( \int ,\) \(\frac{r}{n}\) for \(x,\) and \(\frac{1}{n}\) for \(dx.\)
- The lower and upper limits of the integration are the values of \(\displaystyle \lim _{ n\rightarrow \infty }{ \tfrac { r }{ n } } \) and \(r,\) respectively.

Note that the expression \(\displaystyle \lim _{ n\rightarrow \infty ,h\rightarrow 0 }{ h\sum _{ r=1 }^{ n }{ f(a+rh) } } \) is also of the form \( \frac { 1 }{ n } \sum { f\left(\frac { r }{ n }\right) } \) because \(h=\frac{b-a}{n}\).

Find the sum of the series \( \displaystyle \lim _{ n\rightarrow \infty } \left( \frac { 1 }{ n } +\frac { 1 }{ n+1 } +\frac { 1 }{ n+2 }+\cdots+\frac { 1 }{ 6n } \right). \)

First, we will express it in the form \( \frac { 1 }{ n } \sum { f\left(\frac { r }{ n } \right) } :\)

\[\begin{align} S &= \lim _{ n\rightarrow \infty } \left( \frac { 1 }{ n } +\frac { 1 }{ n+1 } +\frac { 1 }{ n+2 }+\cdots+\frac { 1 }{ 6n } \right) \\ &= \lim _{ n\rightarrow \infty } \frac{1}{n}\left( 1+\frac { 1 }{ 1+\frac{1}{n} } +\frac { 1 }{ 1+\frac{2}{n} } +\cdots+\frac { 1 }{ 1+\frac{5n}{n} } \right) \\ &= \lim _{ n\rightarrow \infty } \frac { 1 }{ n } \sum_{r=0}^{5n} \frac {1}{1+\frac { r }{ n } }. \end{align} \]

Since

\[(\text{Lower limit}) = a=\lim _{ n\rightarrow \infty }{ \frac { r }{ n } } = \lim _{ n\rightarrow \infty }{ \frac { 0}{ n } } =0, \qquad (\text{Upper limit}) = a=\lim _{ n\rightarrow \infty }{ \frac { r }{ n } } = \lim _{ n\rightarrow \infty }{ \frac { 5n}{ n } } =5,\]

we have

\[\displaystyle S= \lim _{ n\rightarrow \infty } \frac { 1 }{ n } \sum_{r=1}^{5n} \frac {1}{1+\frac { r }{ n } } = \int _{ 0 }^{ 5 }{ \frac { dx }{ 1+x } } =\Big[\ln |1+x| \Big]^{ 5 }_{ 0 }=\ln6. \ _\square\]

Find

\[\lim_{n \to ∞} \frac{\sqrt{1}+\sqrt{2}+\sqrt{3}+\sqrt{4}+\cdots+\sqrt{n}}{n\sqrt{n}}.\]

This can be rewritten as

\[\lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^n \sqrt{\frac{k}{n}} = \int_0^1\sqrt{x}\, dx = \frac{2}{3}.\ _\square\]