Calculus – Perfect Understanding of Riemann Sums

calculusintegrationriemann sum

I am not sure I have completely and properly understood Riemann sums.

Given a sum like:

$$S_n = \displaystyle\sum_{r=1}^n \dfrac{r^4+ r^3n +r^2n^2 +2n^4}{n^5}$$

After dividing by $n^4$ we will get several $r/n$s, how is it that they represent $x$ when we take the $\lim_{n\to \infty}S_n$? What would be the width of the Riemann sum? Someone told me that the width is one but then when we take $\lim_{n \to \infty}$, the width becomes $\frac{1}{n} = dx$? How is that?

How do we actually graph them? I tried plotting them on Desmos but in vain.

So I would like to receive a proper answer on Riemann sums, preferably with neat graphs covering the following aspects:

  • Left and Right Riemann sums

  • Limit of Riemann sum

  • Graphing Riemann sums

  • Intricacies like $r/n$ represents $x$ and $1/n$ represents $dx$

  • Other things that might be useful to future readers and me.

Best Answer

It is best to understand that the concept of Riemann sum is far more general than an introductory calculus text will lead you to believe.

Let us then consider a function $f:[a, b] \to\mathbb {R} $ which is bounded. A partition of $[a, b] $ is a set of the form $$P=\{x_0,x_1,x_2,\dots,x_n\} $$ where $$a=x_0<x_1<x_2<\dots<x_n=b$$ Thus a partition of a closed interval is just a finite set of points of $[a, b] $ and the partition necessarily includes the end points $a, b$. And it is conventional to list the points of partition in increasing order. The points of partition divide the interval $[a, b] $ into $n$ sub-intervals of the form $[x_{k-1},x_k]$ for $k=1,2,\dots, n$. The length of largest such sub-interval is called the norm or mesh of partition $P$ and denoted by $||P||$ so that $||P||=\max_{k=1}^{n}(x_k-x_{k-1})$.

Next we come to the concept of a Riemann sum. Let $P=\{x_0,x_1,\dots,x_n\} $ be a partition of $[a, b] $. A Riemann sum for function $f$ over partition $P$ is a sum of the form $$S(P, f) =\sum_{k=1}^{n}f(t_k)(x_k-x_{k-1})$$ where $t_k\in[x_{k-1},x_k]$. The points $t_k$ are called tags and their choice is totally arbitrary. Thus a Riemann sum depends on the partition as well as the tags. The following image shows how a Riemann sum approximates the area under graph of a function :

Approximation of area via Riemann sum

The points where the green curve intersects the top edge of various rectangles correspond to tags $t_k$ so that function values at tags control the height of the rectangles. The points of partition control the number and width of the rectangles and the Riemann sum represents the total area of these rectangles.

To summarize, in order to form a Riemann sum for a bounded function $f:[a, b] \to\mathbb {R} $ on interval $[a, b] $ we first need to choose a specific partition $P$ of $[a, b] $ and then choose specific tags for this already chosen partition and then form a sum as defined earlier.

A typical example of a partition is uniform partition where the sub-intervals are of equal length and the points of partition are in arithmetic progression $$x_{k} =a+k\cdot\frac{b-a} {n} $$ and here the norm $||P||=(b-a) /n$. If we choose the left end point of each sub-interval as tag so that $t_k=x_{k-1}$ we get the left Riemann sum for this partition $$\sum_{k=1}^{n}f\left(a+(k-1)\cdot\frac{b-a}{n}\right)\cdot\frac {b-a} {n} =\frac{b-a} {n} \sum_{k=0}^{n-1}f\left(a+k\cdot\frac{b-a}{n}\right)$$ If we choose right end point of each sub-interval as tag so that $t_k=x_k$ we get the right Riemann sum for this partition $$\frac{b-a}{n} \sum_{k=1}^{n}f\left(a+k\cdot\frac{b-a}{n}\right)$$

With a reasonable amount of theoretical investigation one can define the Riemann integral $\int_{a} ^{b} f(x) \, dx$ as the limit of Riemann sums as the norm of partition tends to $0$. The key idea here is that if the function is Riemann integrable then the choice of partition as well as tags is arbitrary and the limit of Riemann sum equals the Riemann integral when the norm of partition tends to $0$.

And thus if the Riemann integral $\int_{a} ^{b} f(x) \, dx$ exists then $$\int_{a} ^{b} f(x) \, dx=\lim_{n\to\infty} \frac{b-a} {n} \sum_{k=1}^{n}f\left(a+k\cdot\frac {b-a} {n} \right) $$ Note also that the above is not a definition of Riemann integral but rather a formula which holds true if the integral exists.

A lot of simplification is achieved if $a=0,b=1$ and then we get the formula $$\int_{0}^{1}f(x)\,dx=\lim_{n\to\infty} \frac{1}{n}\sum_{k=1}^{n}f\left(\frac{k}{n}\right)\tag{1}$$ and thus if you wish to convert the sum in question into a Riemann sum then you first need to take the factor $1/n$ out of the sum and write your sum as $$\lim_{n\to \infty} \frac{1}{n}\sum_{k=1}^{n}\frac{k^4+k^3n+k^2n^2+2n^4}{n^4}=\lim_{n\to \infty} \frac{1}{n}\sum_{k=1}^{n}\left\{\left(\frac{k}{n}\right)^4+\left(\frac{k}{n}\right)^3+\left(\frac{k}{n}\right)^2+2\right\}$$ and now you can guess the function $f$ as $f(x) =x^4+x^3+x^2+2$ and the desired limit is $\int_{0}^{1}f(x)\,dx$.


Here is another example which does not use uniform partition. Let us evaluate $\int_{0}^{1}\sqrt{x}\,dx$. We choose the partition points as $x_k=k^2/n^2$ then clearly $x_{k-1}<x_k$ and $x_0=0,x_n=1$ so that the above points form a valid partition of $[0,1]$. And choose tags $t_k=x_k=k^2/n^2$. The corresponding Riemann sum is $$\sum_{k=1}^{n}f(t_k)(x_k-x_{k-1})=\sum_{k=1}^{n}\sqrt{\frac{k^2}{n^2}}\left(\frac{k^2}{n^2}-\frac{(k-1)^2}{n^2}\right)$$ and this simplifies to $$\sum_{k=1}^{n}\frac{2k^2-k}{n^3}=\frac{n(n+1)(2n+1)}{3n^3}-\frac{n+1}{2n^2}$$ and the limit of the above is $\dfrac{2}{3}$ as $n\to\infty$ and hence $\int_{0}^{1}\sqrt{x}\,dx=2/3$. In this case it is difficult to use a uniform partition (you may try it to convince yourself). If you are observant enough the limit of last sum is also equal to $2\int_{0}^{1}x^2\,dx$.


From your comments to this answer it appears that you think of replacing $k/n$ as $x$ and $1/n$ as $dx$. Thats not really the way to go although many cheap textbooks often explain the concept in that manner. You just have to look at the formula $(1)$ and try to bring your limit of sum in the form of RHS of $(1)$ and then guess the function $f$.

Related Question