A Riemann sum is a certain type of approximations for an integral. The easiest and simplest method to use is a rectangle sum; where we sum the area of #n# rectangles with equal width to approximate the area under a curve; as #n# approaches infinity, the sum approaches the true value of the net area.
Here's a Riemann sum with #4# rectangles only:
This is just an example. Instead, consider #n# rectangles.
Let #f# be a function. Say, we wish to find the area under #f# from #a# to #b#. For the moment, let's only do the case #a=0# and #b=1#. We will generalise later.
Now; imagine #x_0, x_1, x_2, ... x_n# to be some "marks" on the x-axis such that the width of the i-th rectangle is #x_i - x_(i-1)# and #x_0 = 0#.
Let #Delta_i = x_i-x_(i-1)# be the width of the i-th rectangle. As we want #Delta_i# to be constant, we can more easily call it #color(red)(Delta)#.
Another property about our x-axis marks is that the lenght/non-width side of the i-th rectangle is going to be #f(x_i)#. Hence, the its area is going to be
#"Area"_i = "width" xx "lenght" = Deltaf(x_i)#
Since we want the area until #b=1#, we must have #x_n=1#.
The areas of the rectangles approximate the areas under the graph of #f#. If there are #n# rectangles, then:
#int_0^1 f(x) "d"x ~~ sum_(i=1)^n (x_i-x_(i-1))f(x_i) = sum_(i=1)^n Deltaf(x_i)#
One way to make #Delta_i# constant is by defining #x_i = i/n#. Then,
#Delta_i = i/n - (i-1)/n = 1/n#, #forall i in NN#.
By this definition, #x_0 = 0# and #x_n = 1#, as desired.
#int_0^1f(x) "d"x ~~ sum_(i=1)^n 1/n f(i/n)#
The more rectangles we have, the better the sum approximates the integral. Thus, we can say that
#int_0^1 f(x) "d"x = lim_(n->oo) sum_(i=0)^n 1/n f(i/n)#
Generalisation: Since we want the area from #a# to #b#, the very first rectangle must have lenght #f(a)# and the last one #f(b)#; to do this, we can change the lower and upper bounds of the sum operator:
#color(blue)(int_a^b f(x) "d"x = lim_(n->oo) sum_(i=an)^(bn) 1/n f(i/n))#
This is one of the many Riemann Sum formulae for a function #f#.
In our case, #f(x) = x+x^2#:
#:. int_a^b f(x) "d"x ~~ sum_(i=an)^(bn) 1/n (i/n + i^2/n^2)#
#:. int_a^b f(x) "d"x ~~ 1/n^2sum_(i=an)^(bn)(i+i^2/n) #
if there are #n# rectangles, as stated already.