# Evaluate integral $\int_{-2}^0 x^2+x\ dx$ using Riemann Sum

Consider the integral $$\int_{-2}^0 x^2+x\ dx.$$

The question says to use Riemann Sum theorem which is $$\sum_{i=1}^nf(x_i)\delta x$$ I know that $$\delta x= \frac{-2}{n}$$ and that $$x_i=-2+(\frac{2}{n}i)$$

After i plug everything in I get $$\sum_{i=1}^n\frac{2}{n}\left(-2-\frac{2}{n}i\right)^2+\left(-2-\frac{2}{n}i\right)$$

After completing the square I have $$\frac{2}{n}\sum_{i=1}\left(4-\frac{8}{n}i\right)+\left(\frac{4}{n^2}i^2\right)+\left(-2-\frac{2}{n}i\right)$$

I know that $$i=\left(\frac{(n+1)}{2}\right)$$ and $$i^2=\left(\frac{(n+1)(2n+1)}{6}\right)$$ but how do I manipulate the equation so that I can use them?

• $x_i = -2 + \left(\frac{2}{n} i\right) \;\Rightarrow.$ – user2661923 Dec 9 '18 at 21:48
• $x_i = -2 + \left(\frac{2}{n} i\right) \;\Rightarrow\; (x_i)^2 \;=\; 4 \;-\; \left(\frac{8}{n} i\right) \;+\; \left(\frac{4}{n^2} i^2\right).$ – user2661923 Dec 9 '18 at 21:54
• shouldn't $(xi)^2$ =4+ $(\frac{8}{n}i)+(\frac{4}{n^2}i^2)$ – Eric Brown Dec 9 '18 at 22:08
• good question. No, your formula for $x_i$ is wrong. – user2661923 Dec 9 '18 at 22:11
• where does the $\frac{8}{n}i$ come from? wait I got it cause of the $2ab$ in $a^2+2ab+b^2$ right? – Eric Brown Dec 9 '18 at 22:27

I know that $$\delta x= \frac{-2}{n}$$
The $$\delta x$$ should be positive. You should think of it as the length of the corresponding rectangle. In this case it is simplest to take $$x_i=-\frac{2i}{n}$$. So you have,
\begin{align*} &\int_{-2}^0 x^2+x\ dx\\ =&\lim_{n\rightarrow+\infty} \sum_{i=1}^n \left(\left(-\frac{2i}{n}\right)^2+\left(-\frac{2i}{n}\right)\right)\frac{2}{n}\\ =&\lim_{n\rightarrow+\infty} \sum_{i=1}^n \left(\frac{8i^2}{n^3}-\frac{4i}{n^2}\right)\\ =&\lim_{n\rightarrow+\infty} \frac{8}{n^3}\left(\sum_{i=1}^n i^2\right) -\frac{4}{n^2}\left(\sum_{i=1}^n i\right)\\ =&\lim_{n\rightarrow+\infty} \frac{8}{n^3}\left( \frac{n^3}{3}+\frac{n^2}{2}+\frac{n}{6}\right) -\frac{4}{n^2}\left(\frac{1+n}{2}\right)\\ =&\lim_{n\rightarrow+\infty} \left( \frac{8}{3}+\frac{8}{2n}+\frac{n}{6n^2}\right) -\left(\frac{2}{n}+2\right)\\ =& \frac{8}{3}-2 \end{align*}
• Didn't know you could write $i^2$ like that, it will be useful on my final. Thanks for you help> – Eric Brown Dec 9 '18 at 22:42