![[riemann_sum.png|200]] > [!note] Definition > > Riemann sum is a method of approximation of the area under a curve by a finite [[Summation|summation]], calculated by partitioning the region into shapes that together form a region that is similar to the region being measured. > > $ > \begin{align*} > A &\approx \sum_{i = 1}^{n}{f(x^*_i)\Delta{x_i}}\\ > A &= \limv{n}\sum_{i = 1}^{n}{f(x^*_i)\Delta{x_i}} > \end{align*} > $ ### Formal Definition Let $f$ be a [[Function|function]] in a closed interval $[a, b]$ of real numbers. Let $P = \{[x_0, x_1], [x_1, x_2],...,[x_{n-1}, x_n]\}$ be a partition of the closed interval, where $a = x_0 < x_1 < x_2 < ... < x_n < b$. A Riemann sum $S$ of $f$ of the interval with partition P is defined as: $ \sum_{i = 1}^{n}{f(x^*_i)\Delta{x_i}} $ Where $\Delta{x^*_i} = x_i - x_{i - 1}$ (the difference between the x value of the partitions), and $x^*_i \in [x_{i-1}, x_i]$. At [[Limit|limit]], the Riemann sum of a curve over an interval is *equal* to the area under the curve. $ A = \limv{n}\sum_{i = 1}^{n}{f(x^*_i)\Delta{x_i}} $ ### Midpoint Rule $ \int_{a}^{b}f(x)dx \approx \sum_{i = 1}^{n}{f(\bar{x_i})\Delta{x_i}} = \Delta{x}[f(\bar{x_1}) + ... + f(\bar{x_n})] $ $ \Delta{x} = \frac{b - a}{n} \quad \text{and} \quad x_i = \frac{x_{i-1} + x_i}{2} $ For the best approximation of a [[Integral|definite integral]], it is typically fit to choose $x^*_i$ to be the *midpoint* of the interval, which can be denoted by $\bar{x_i}$.