# Is my Riemann Sum correct?

For the integral: $$\int_{-1}^{5} \left( x^{2} -4 \right) dx$$

My calculations:

\begin{align*}\Delta x &= \frac6n\\\\ x_i &= -1 + \frac{6i}n\\\\ f(x_i) &= 1 + \frac{36i^2}{n^2} -4\\\\ A&=72 \end{align*}

I'm unsure if this is correct as it is my first attempt at doing this type of problem.

-
Please check my transcription of your algebraic expressions; I wasn't sure where the $-4$ in the $f(x_i)$ expression was supposed to go. – Brian M. Scott May 7 '12 at 0:03
@BrianM.Scott Thank you for fixing that for me. You fixed it correctly (-4 is in the correct spot) – justcheckingin May 7 '12 at 0:05
The $-4$ does not seem right. If you expanded $\bigl(-1+{6i\over n} \bigr)^2$, you should have obtained $1+{36i^2\over n^2}-{12i\over n}$. – David Mitra May 7 '12 at 0:12
@DavidMitra Thank you for pointing that out, it seems I accidentally removed it when editing the latex. Added the -4 back to the function – justcheckingin May 7 '12 at 0:31

If your integrand is $x^2-4$, then $\displaystyle f(x_i) = x_i^2 - 4 = \left( - 1 + \frac{6i}{n} \right)^2 - 4 = -3 -\frac{12i}{n} + \frac{36 i^2}{n^2}$,

where your $\displaystyle \Delta x = \frac6n$. Your integral then becomes : \begin{align} \int_{-1}^{5} \left(x^2 -4 \right) dx = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \Delta x \right) = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) \end{align} Hence, all we need is to evaluate $\displaystyle \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right)$ and take the limit as $n \rightarrow \infty$.

\begin{align} \displaystyle \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) & = 6 \times \displaystyle \sum_{i=0}^{n-1} \left( \frac{-3}n - \frac{12i}{n^2} + \frac{36i^2}{n^3} \right)\\ & = 6 \times \left(-3 - \frac{12 n(n-1)/2}{n^2} + \frac{36 n(n-1)(2n-1)/6}{n^3} \right)\\ & = 6 \times \left( -3 - 6 \frac{n-1}{n} + 12 \frac{(n-1)(n-1/2)}{n^2} \right) \end{align} where we made use of the following summations. $$\sum_{i=0}^{n-1} 1 = n$$ $$\sum_{i=0}^{n-1} i = \frac{n(n-1)}{2}$$ and $$\sum_{i=0}^{n-1} i^2 = \frac{n(n-1)(2n-1)}{6}$$

Now taking the limit as $n \rightarrow \infty$, we get \begin{align} \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) & = \lim_{n \rightarrow \infty} 6 \times \left( -3 - 6 \frac{n-1}{n} + 12 \frac{(n-1)(n-1/2)}{n^2} \right) \\ & = 6 \times \left( -3 - 6 + 12 \right) = 6 \times 3 = 18 \end{align} Hence, \begin{align} \int_{-1}^{5} x^2 dx = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) = 18 \end{align}

EDIT:

Note that if $f(x) = x^2$ and $\displaystyle x_i = - 1 + \frac{6i}{n}$, then $\displaystyle f(x_i) = x_i^2 = \left( - 1 + \frac{6i}{n} \right)^2 = 1 -\frac{12i}{n} + \frac{36 i^2}{n^2}$ where your $\displaystyle \Delta x = \frac6n$. Your integral then becomes : \begin{align} \int_{-1}^{5} x^2 dx = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \Delta x \right) = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) \end{align} Hence, all we need is to evaluate $\displaystyle \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right)$ and take the limit as $n \rightarrow \infty$.

\begin{align} \displaystyle \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) & = 6 \times \displaystyle \sum_{i=0}^{n-1} \left( \frac1n - \frac{12i}{n^2} + \frac{36i^2}{n^3} \right)\\ & = 6 \times \left(1 - \frac{12 n(n-1)/2}{n^2} + \frac{36 n(n-1)(2n-1)/6}{n^3} \right)\\ & = 6 \times \left( 1 - 6 \frac{n-1}{n} + 12 \frac{(n-1)(n-1/2)}{n^2} \right) \end{align} where we made use of the following summations. $$\sum_{i=0}^{n-1} 1 = n$$ $$\sum_{i=0}^{n-1} i = \frac{n(n-1)}{2}$$ and $$\sum_{i=0}^{n-1} i^2 = \frac{n(n-1)(2n-1)}{6}$$

Now taking the limit as $n \rightarrow \infty$, we get \begin{align} \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) & = \lim_{n \rightarrow \infty} 6 \times \left( 1 - 6 \frac{n-1}{n} + 12 \frac{(n-1)(n-1/2)}{n^2} \right) \\ & = 6 \times \left( 1 - 6 + 12 \right) = 6 \times 7 = 42 \end{align} Hence, \begin{align} \int_{-1}^{5} x^2 dx = \lim_{n \rightarrow \infty} \sum_{i=0}^{n-1} \left(f(x_i) \times \frac{6}{n} \right) = 42 \end{align}

-
I apologize, when the latex was fixed, the function was changed. The -4 was removed. I added it back. I think this may change the answer, as its where I got the -4 from – justcheckingin May 7 '12 at 0:30
Thank you for the reply. It put me back on the right track and you showed me the formula. – justcheckingin May 7 '12 at 0:53
When you put the final answer, should it also include the -4? Also, are there shorter methods to getting these answers rather than using Riemanns Sum? – justcheckingin May 7 '12 at 0:55

Your $\Delta x$ and $x_i$ are fine, but you've gone astray after that: $$f(x_i)=x_i^2=\left(-1+\frac{6i}n\right)^2=1-\frac{12i}n+\frac{36i^2}{n^2}\;.$$ Your Riemann sum is then

\begin{align*} \sum_{i=1}^n\left(1-\frac{12i}n+\frac{36i^2}{n^2}\right)\frac6n&=\frac6n\sum_{i=1}^n\left(1-\frac{12i}n+\frac{36i^2}{n^2}\right)\\ &=\frac6n\left(\sum_{i=1}^n1-\frac{12}n\sum_{i=1}^ni+\frac{36}{n^2}\sum_{i=1}^ni^2\right)\\ &=\frac6n\left(n-\frac{12}n\cdot\frac{n(n+1)}2+\frac{36}{n^2}\cdot\frac{n(n+1)(2n+1}6\right)\\ &=\frac6n\left(n-6(n+1)+\frac{6(n+1)(2n+1)}n\right)\\ &=\frac6n\cdot\frac{-5n^2-6n+12n^2+18n+6}n\\ &=6\left(7+\frac{12}n+\frac6{n^2}\right)\;, \end{align*}

which converges to $42$ as $n\to\infty$.

-
I apologize, when I edited the latex, it removed -4 from the function. I added it back. – justcheckingin May 7 '12 at 0:32
Thank you for the reply and the explanation. It was easy to follow and made it easy to understand. (I did it the same way you did, however I just didn't square my value correctly) – justcheckingin May 7 '12 at 0:51