There are a number of methods for approximating the integral of a function \(f\) over a closed interval \([a,b]\), when the actual integral cannot be calculated. Riemann sums are one method of integral approximation. The general idea is to partition the interval into \(n\) smaller pieces. For each subinterval \([x_i, x_{i+1}]\), a representative point \(x^*\) is chosen. Adding the area of the rectangles with width \(x_{i+1} - x_i\) and height \(f(x^*)\) yields an approximation of the integral:
\[ \int_a^b f(x)dx \approx \sum_{i=0}^{n-1} f(x^*)(x_{i+1} - x_i) \]
While the width of the subintervals is not required to be equal, many common formulations of the Riemann sum use a constant width. The representative point chosen from each subinterval can, in general, be any point in that subinterval. However, the Riemann sums considered in this app are defined by the points chosen:

The accuracy of each approximation is improved as the number of subintervals is increased.

- the left endpoint rule has \(x^* = x_i\) for each subinterval \([x_i, x_{i+1}]\).
- the ridght endpoint rule has \(x^* = x_{i+1}\) for each subinterval \([x_i, x_{i+1}]\).
- the midpoint rule has \(x^* = \frac{x_{i+1} - x_i}{2}\) for each subinterval \([x_i, x_{i+1}]\).

The accuracy of each approximation is improved as the number of subintervals is increased.

Sample functions are available in degree 1, 2, or 3 from the "Function Type" menu, along with the sine function. Use the sliders to adjust the interval you would \([a,b]\), as well as the number of subintervals \(n\). The applet will calculate the actual value of the integral, along with the value of each approximation and the absolute error. Check the box next to each approximation type to view the rectangles (or trapezoids) used in the approximation. More than one method may be checked simultaneously, so the methods can be visually compared.

This applet was created using JavaScript and the Raphael library. If you are unable to see the applet, make sure you have JavaScript enabled in your browser. This applet may not be supported by older browsers.