The Riemann Sum is commonly used to approximate the intergral of $f(x)$ over the interval $[a, b]$. The basic idea is to divide the interval $[a, b]$ into multiple subintervals and approximate the area under the curve using the sum of the areas of these rectangles.

Formally, let the interval $[a, b]$ be divided into $n$ subintervals:

$$ a = x_0 < x_1 < x_2 < \cdots < x_n = b. $$

In each subinterval $[x_{i-1}, x_i]$, select a sample point $\xi_i \in [x_{i-1}, x_i]$. Then the Riemann sum is defined as:

$$ S_n = \sum_{i=1}^{n}f(\xi_i)\Delta x_i, $$

where $\Delta x_i = x_i - x_{i-1}$ represents the length of each subinterval.

When the maximum subinterval length approaches zero, i.e., $\max \Delta x_i \rightarrow 0$. If the limit of the Riemann sum exists, the integral is defined as:

$$ \int_{a}^bf(x)dx = \lim_{n\rightarrow \infty} S_{n} $$
  • Left Rule: The height of each small rectangle is determined by the function value at the left endpoint of the subinterval.

  • Right Rule: The height of each small reactangle is determined by the function value at the right endpoint of the subinterval.

  • Midpoint Rule: The height of each small reactangle is determined by the function value at the midpoint of the subinterval.

  • Trapezoidal Rule: The area under the curve is approximated by the sum of the areas of these trapezoids.

Reference

https://en.wikipedia.org/wiki/Riemann_sum