# Understanding Riemann sums

I am trying to understand Riemann sums. As far as I can understand, we have $\Delta x$ which is $\frac{b-a}{n}$ and $n$ is the number of subintervals I want to divide my function between $a$ and $b$. But I still don't understand how to calculate $C_i$. For example I have a function in my book which is:

$$f(x) = \sqrt{x}$$

And it says that the right point of the rectangle is:

$$c_i(right) = \frac{i^2}{n^2}$$

And the left point is:

$$c_i(left) = \frac{(i-1)^2}{n^2}$$

So $c_i(right) - c_i(left)$:

$$\Delta x = \frac{2i-1}{n^2}$$

I don't understand why. I have another examples where $\Delta x = \frac{2}{5}$ and $c_i = \frac{2}{5}i$. I undestand that but don't know how here it is that.

-
$f(x) = \sqrt{x}$ or $f(x) = x^2$? –  user17762 Jun 26 '12 at 1:30
$f(x)=\sqrt{x}$ –  Andres Jun 26 '12 at 1:31
What is $Ci$? ${}$ –  user17762 Jun 26 '12 at 1:33
I modified the tags since this is definitely not Riemannian Geometry. –  Patrick Da Silva Jun 26 '12 at 1:34
$\Delta x$ is the length of each subinterval. If your Riemann sums are always made by dividing the interval into $n$ equal parts, then $\Delta x = \frac{b-a}{n}$ is constant. Your "So" above does not follow. –  Arturo Magidin Jun 26 '12 at 1:34

We want to approximate the are under the graph with easy to calculate areas. The way we do this is by constructing rectangles that approximate the area. To construct such a rectangle, we "sample" the value of the function on the interval in question and use that value to approximate the value of the function on the entire interval. If $f(x)$ is continuous and the interval is small, then the values of $f(x)$ will not change much over the interval, so this will be a good approximation.

There are many ways of doing the "sampling". The two most common are by doing a "left sample" (always take the leftmost point of the interval as your sampling point), and doing a "right sample" (always take the rightmost point of the interval as your sampling point). These are often called the Left Riemann Sum and the Right Riemann Sum, respectively. Our approximation will then be a rectangle of height $f(x^*)$ where $x^*$ is the sampling point, and of base the length of the interval. Their product is the area of our approximating rectangle.

So what we do is we divide the interval $[a,b]$ into a bunch of smaller intervals, and approximate the function using these "rectangles" in each of the smaller intervals. As we make the intervals smaller and smaller and smaller, the approximation will get better and better and better. It is a theorem that if the function is continuous, then it doesn't matter how we do the sampling or how we divide the big interval into smaller ones, as long as the "mesh size" (the length of the largest subinterval we select) gets smaller and smaller and smaller and goes to zero, the limit will always be the same.

So you are looking at the special construction in which we take $[a,b]$ and we divide it into $n$ equal subintervals, each of which will have length $\frac{b-a}{n}$. Call this $\Delta x$, because if we write the points we are selecting to break up the interval as $$a = x_0 \lt x_1 \lt x_2 \lt \cdots \lt x_n = b$$ then the increment to get from $x_i$ to $x_{i+1}$ is precisely $\Delta x = \frac{b-a}{n}$ ($\Delta x$ is pronounced "the increase in $x$" or "the change in $x$").

If we use the left sampling method, we obtain what is called the "Left Riemann Sum with $n$ equal subintervals". Let's call it $L(n)$ ($f$ and $[a,b]$ are understood from context). How much is each rectangle? The first rectangle has height $f(x_0)$ and base $\Delta x$; the second has height $f(x_1)$ and base $\Delta x$; etc, until the $n$th rectangle that has height $f(x_{n-1})$ and height $\Delta x$. So \begin{align*} L(n) &= f(x_0)\Delta x + f(x_1)\Delta x + \cdots + f(x_{n-1})\Delta x\\ &= \sum_{i=0}^{n-1}f(x_i)\Delta x. \end{align*}

If we use the right sampling method we get the "Right Riemann Sum with $n$ equal subintervals", let's call it $R(n)$. we have: \begin{align*} R(n) &= f(x_1)\Delta x + f(x_2)\Delta x + \cdots + f(x_n)\Delta x\\ &= \sum_{i=1}^n f(x_i)\Delta x.\end{align*}

For example, for $f(x) = \sqrt{x}$ and $[a,b] = [0,1]$, dividing the interval into $n$ equal subintervals means marking off the points $0=\frac{0}{n}$, $\frac{1}{n}$, $\frac{2}{n},\ldots,\frac{n-1}{n}$, and $\frac{n}{n} = 1$. Then $\Delta x = \frac{1-0}{n} = \frac{1}{n}$. The left hand Riemann sum would then be \begin{align*} L(n) &= \sum_{i=0}^{n-1}f\left(\frac{i}{n}\right)\Delta x\\ &= \sum_{i=0}^{n-1}\sqrt{\frac{i}{n}} \frac{1}{n}\\ &= \frac{1}{n}\sum_{i=0}^{n-1}\sqrt{\frac{i}{n}}\\ &= \frac{1}{n\sqrt{n}}\sum_{i=0}^{n-1}\sqrt{i}\\ &= \frac{1}{n^{3/2}}\left( \sqrt{0} + \sqrt{1} + \sqrt{2}+\cdots + \sqrt{n-1}\right). \end{align*} If you look at the graph of $y=\sqrt{x}$, you will see that this is an underestimate of the area under the graph, because all of these rectangles lie completely under the graph.

The right hand Riemann sum will be $$R(n) = \frac{1}{n^{3/2}}\left(\sqrt{1}+\sqrt{2}+\cdots + \sqrt{n-1}+\sqrt{n}\right);$$ if you look at the graph of $y=\sqrt{x}$, you will see that this is an overestimate of the area under the graph. So we know that the true value of the area, $\int_0^1\sqrt{x}\,dx$ lies somewhere between $L(n)$ and $R(n)$.

-
Shouldn't be each points $iΔx$ for the right point and $(i-1)Δx$ for the left one instead $\frac{i}{n}$ ? I don't understand that :/ By the way very nice explanation :) –  Andres Jun 26 '12 at 2:33
@Andrews: In the situation I write, $\Delta x = \frac{1}{n}$, so $i\Delta x = \frac{i}{n}$ in the right hand approximation, and $(i-1)\Delta x = \frac{i-1}{n}$ in the left hand approximation, giving the point as $x_{i-1} = \frac{i-1}{n} = (i-1)\Delta x$ for the $i$th summand in $L(n)$, and $x_i = \frac{i}{n} = i\Delta x$ for the $i$th summand in $R(n)$. That's exactly what I wrote. In the more general situation, it would be $x_{i-1}=x_0 + (i-1)\Delta x$ in the left approximation, and $x_i = x_0+i\Delta x$ in the right approximation. –  Arturo Magidin Jun 26 '12 at 3:46

Remember that the Riemann integral is always meant to be computed over an interval, and I assume you want to compute $$\int_0^1 x^2 \, dx$$ using the formal definition. Let $f(x) = x^2$. If I understood your notation well, then you want to compute $$\sum_{i=1}^n C_i({\rm right}) \left( \frac in - \frac{i-1}n \right)$$ where $C_i(\rm right)$ stands for $f(i/n) = (i/n)^2$. If you have already prove that the integral exists, then you could either compute the integral by computing the sum above and letting $n$ go to infinity, or you could compute $$\sum_{i=1}^n C_i({\rm left}) \left( \frac in - \frac {i-1}n \right)$$ where $C_i(\rm left)$ here means $f((i-1)/n) = ((i-1)/n)^2$. In both cases the computations are really not that hard, if you know $\sum_{i=1}^n i^2 = n(n+1)(2n+1)/6$.

This was definitely too big for a comment, but I don't think I helped you enough for it to be an answer either. Feel free to discuss in the comments.

Hope that helps,

-
Thank you :) I understand what you are saying. But my $f(x) = \sqrt{x}$ That's why I don't understand why it is $\frac{i^2}{n^2}$ unless my book had an error. I understand that Riemann is: $$\sum_{i=1}^n f(C_i)Δx$$ But the divisions in n intervals of the funtion are not neccessarily equal. –  Andres Jun 26 '12 at 1:48
@Andres : Perhaps your book has an error, but it would help finding who's wrong if we knew which integral you were computing! –  Patrick Da Silva Jun 26 '12 at 6:37