# Thread: Find the Riemann sum

1. ## Find the Riemann sum

Determinate the Riemann sum: SUM[ f(Xk)deltaXk ] where k=1 to n if f(x)=x^2-x-2 for x E [-2,2] and n=4. The partition is regular and we should use the left end point of the subintervals.

Now i got Deltaxk=1 ; Xk=k-3 ; f(Xk)= k^2 - 7k + 10 ; And the final result i have is 60 .

I want to know should i have the same result if im solving the definite integral Integral of: (x^2-x-2)dx where a=-2; b=2 ; as the riemann sum result , which doesnt happens.

2. ## Re: Find the Riemann sum

If I understand your question you have

$f(x)=x^2-x-2$

and you want to find the Riemann Sum approximation of

$\displaystyle{\int_{-2}^{2}}f(x)~dx$

With $n=4$ It should be pretty clear that your left endpoints will be $-2, -1, 0, 1$, and that $\Delta x=1$

This matches with what you found.

$f(-2)+f(-1)+f(0)+f(1) = 4+0-2-2=0$

how you got 60 out of this I don't know.

The actual definite integral above is equal to $-\dfrac 8 3$.

The Riemann Sum is just an approximation. If you let n=8 you find the Riemann Sum equals $-\dfrac 3 2$, i.e.

the approximation improves with increasing $n$ as is expected.

3. ## Re: Find the Riemann sum

Originally Posted by MirceM
Determinate the Riemann sum: SUM[ f(Xk)deltaXk ] where k=1 to n if f(x)=x^2-x-2 for x E [-2,2] and n=4. The partition is regular and we should use the left end point of the subintervals.

Now i got Deltaxk=1 ; Xk=k-3 ; f(Xk)= k^2 - 7k + 10 ; And the final result i have is 60 .

I want to know should i have the same result if im solving the definite integral Integral of: (x^2-x-2)dx where a=-2; b=2 ; as the riemann sum result , which doesnt happens.
In general, a Riemann sum will not equal the corresponding definite integral. What will equal the corresponding definite integral is the limit of the Riemann sum as the number of partitions approaches infinity.

4. ## Re: Find the Riemann sum

@romsek Right , the definite integral is -8/3 . Now how i got 60 from the sum:
by the formula i have f(Xk)=(k^2-7k+10) , cause Xk=k-3 , than in the SUM[ f(Xk)deltaXk ] where k=1 to n , im replacing f(Xk)deltaXk and so i got the SUM [(k^2 -7k+10)*1] where k=1 to n , solving this and replacing n=4 i got the result 60.

I think JeffM is right , it actually has sense , the reason i dont get the same result is that in the sum i have only 4 parts of a function.. but what bothers me is that if i write n->+inf i cant solve the sum than.. i got undefined answer +inf-inf.

This after all tells me that im making some mistake in the Riemann sum solving process..

Note: im solving this with Sigma notation, i will explain how i got the results once again to be more clear:
Xk=a+(k-1)DeltaXk= -2+(k-1)*1=k-3=Xk
replacing Xk in f(x) so i could get f(Xk) will give me f(Xk)= (k-3)^2-(k-3)-2=k^2-6k+9-k+3-2=k^2-7k+10=f(Xk)
from that i have 3 separate sums like: SUM[k^2]-7SUM[k]+SUM[10] where k=1 to n;
evaluating all of them gives me: [n(n+1)(2n+1)]/2 -[7n(n+1)]/2 +40 ; replacing for n=4 , sum=60..

5. ## Re: Find the Riemann sum

Let's establish the general formula for the left-hand Riemann Sum of f(x) from a to b.

$\displaystyle \sum_{i = 0}^{n - 1}\left\{h * f \left(a + ih\right)\right\}, where\ h = \dfrac{b - a}{n}.$

If n is small that is all you need.

$f(x) = x^2 - x - 2\ and\ n = 4\ and\ a = -2\ and\ b = +2 \implies h = \dfrac{2 - (-2)}{4} = 1 \implies\displaystyle \sum_{i = 0}^{n - 1}\left\{h * f \left(a + ih\right)\right\} = \sum_{i = 0}^{4 - 1}\left\{1 * f \left(-2 + i * 1\right)\right\} =$

$\displaystyle \sum_{i = 0}^3f \left(-2 + i\right) = f(-2 + 0) + f(-2 + 1) + f(- 2 + 2) + f(-2 + 3) = f(-2) + f(-1) + f(0) + f(1) =$

$\{(-2)^2 - (-2) - 2\} + \{(-1)^2 - (-1) - 2\} + (0^2 - 0 - 2) + (1^2 - 1 - 2) = (4 + 2 - 2) + (1 + 1 - 2) - 2 + (1 - 1 - 2) =$

$4 + 0 - 2 - 2 = 0 \ne 60.$

If n is large, however, things are not quite so simple. More generally,

$f(x) = x^2 - x - 2\ and\ a = -2\ and\ b = +2 \implies h = \dfrac{2 - (-2)}{n} = \dfrac{4}{n} \implies$

$\displaystyle \sum_{i = 0}^{n - 1}\left\{h * f\left(a + ih\right)\right\} = \sum_{i = 0}^{n - 1}\left\{\dfrac{4}{n} * f \left(-2 + \dfrac{4i}{n}\right)\right\} = \sum_{i = 0}^{n - 1}\left\{\dfrac{4}{n} * f \left(\dfrac{-2n + 4i}{n}\right)\right\} =$

$\displaystyle \sum_{i = 0}^{n - 1}\dfrac{4}{n}\left\{\left(\dfrac{-2n + 4i}{n}\right)^2 - \dfrac{-2n + 4i}{n} - 2\right\} = \sum_{i = 0}^{n - 1}\left(\dfrac{4(4n^2 - 16in + 16i^2)}{n^3} - \dfrac{4n(-2n + 4i)}{n^3} - \dfrac{4n^2 * 2}{n^3}\right) =$

$\displaystyle \sum_{i = 0}^{n - 1}\left(\dfrac{16n^2 - 64in + 64i^2 + 8n^2 - 16in - 8n^2}{n^3}\right) = \sum_{i = 0}^{n - 1}\left(\dfrac{16n^2 - 80in + 64i^2}{n^3}\right) =$

$\left\{\dfrac{16}{n} * \displaystyle \sum_{i = 0}^{n - 1}1\right\} - \left\{\dfrac{80}{n^2} * \displaystyle \sum_{i = 0}^{n - 1}i\right\} + \left\{\dfrac{64}{n^3} * \displaystyle \sum_{i = 0}^{n - 1}i^2\right\} = \left(\dfrac{16}{n} * n\right) - \left(\dfrac{80}{n^2} * \dfrac{(n - 1)n}{2}\right) + \left(\dfrac{64}{n^3} * \dfrac{(n - 1)(n)(2n - 1)}{6}\right) =$

$16 - \dfrac{40n^2 - 40n}{2n^2} + \dfrac{64(2n^3 - 3n^2 + n)}{6n^3} = 16 - 40 + \dfrac{40n}{n^2} + \dfrac{128n^3 - 192n^2 + 64n}{6n^3} =$

$\displaystyle -24 + \dfrac{240n^2}{6n^3} + \dfrac{128n^3 - 192n^2 + 64n}{6n^3} = -24 + \dfrac{128}{6} + \dfrac{48n^2 + 64n}{6n^3} = \dfrac{-8}{3} + \dfrac{24n + 32}{3n^2}.$

Now that is some VERY ugly algebra. Disgusting in fact. We had better test it.

$n = 4 \implies \dfrac{-8}{3} + \dfrac{24n + 32}{3n^2} = \dfrac{-8}{3} + \dfrac{24 * 4 + 32}{3 * 4^2} = \dfrac{-128}{48} + \dfrac{128}{48} = 0.$

Well we know that is correct so maybe for once I did my algebra correctly.

Now let's take the limit

$\displaystyle \lim_{n \rightarrow \infty}\left(\dfrac{-8}{3} + \dfrac{24n + 32}{3n^2}\right) = \lim_{n \rightarrow \infty}\dfrac{-8}{3} + \lim_{n \rightarrow \infty}\dfrac{8}{n} + \lim_{n \rightarrow \infty}\dfrac{32}{3n^2} = \dfrac{-8}{3} + 0 + 0 = \dfrac{-8}{3}.$

And $\displaystyle \int_{-2}^2 (x^2 - x - 2)\ dx = \left(\dfrac{2^3}{3} - \dfrac{2^2}{2} - 2 * 2\right) -\left(\dfrac{(-2)^3}{3} - \dfrac{(-2)^2}{2} - 2 * (-2)\right) =$

$\dfrac{8}{3} - \dfrac{4}{2} - 4 - \dfrac{-8}{3}\ + \dfrac{4}{2} - 4 = -8 + \dfrac{2 * 8}{3} = \dfrac{-3 * 8}{3} + \dfrac{2 * 8}{3} = \dfrac{-8}{3}.$

$\therefore \displaystyle \lim_{n \rightarrow \infty}\left(\dfrac{-8}{3} + \dfrac{24n + 32}{3n^2}\right) = \dfrac{-8}{3} = \int_{-2}^2 (x^2 - x - 2)\ dx.$

6. ## Re: Find the Riemann sum

Oh my god.. now i see my stupid and banal mistake.. Right the result is 0 , i wrote down the formula for SUM[k^2] from k=1 to n wrong , [(n+1)(2n+1)]/2 instead of [(n+1)(2n+1)]/6..
Im so sorry for bothering you and wasted your time..

[SOLVED]

7. ## Re: Find the Riemann sum

Not a waste of time: it is what we are here for.

However, Riemann Sums frequently do involve ugly algebra. I recommend always testing any general formula you get for the sum by working out the result with a small number for n, generally n = 3 or n = 4. That is, we could test the general formula above by working out the values for f(-2), f(-1), f(0), and f(1). That won't tell you where any error is in your algebra, but it does give you a very good indicator whether or not there is an error. Actually, I made an error in my first go round; it took me quite a while to find it.

Thanks for the thanks.