Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For computing derivative of a function, we can use the definition of a derivative, i.e. $$\lim\limits_{h \to 0}\frac{f(x+h)-f(x)}{h}.$$ Is there some for computing integrals too?

share|cite|improve this question
See this and this. – Tunk-Fey Apr 17 '14 at 12:33

Yes, we can use Riemann sums which says that: $$\int_a^bf(x)\,\mathrm dx=\lim\limits_{n\to\infty}\sum_{i=1}^{n}f(x_i^*)\Delta x$$ where: $$\Delta x=\dfrac{b-a}{n}$$ and: $$x_i^*=a+(\Delta x)i$$

So for example, let's compute the following integral using Riemann sums: $$\int_{1}^{3}(x^2-x+1)\,\mathrm dx$$ To find it, we first need to know some useful sums: $$\sum_{i=1}^n k=kn\quad\color{grey}{\text{and}}\quad\sum_{i=1}^n i=\dfrac{n(n+1)}{2}\quad\color{grey}{\text{and}}\quad\sum_{i=1}^n i^2=\dfrac{n(n+1)(2n+1)}{6}.\tag{$\star$}$$ So in our particular case: $\Delta x=\dfrac{3-1}{n}=\dfrac2n$ and so: $x_i^*=1+\dfrac{2i}n$. Since in our example we integrate the function $f(x)=x^2-x+1$, then: $$\begin{align}\require{cancel} f(x_i^*)&=\left(1+\dfrac{2i}{n}\right)^2-\left(1+\dfrac{2i}{n}\right)+1\\ &=1+\dfrac{4i}{n}+\dfrac{4i^2}{n^2}\cancel{-1}-\dfrac{2i}{n}\cancel{+1}\\ &=1+\dfrac{2i}{n}+\dfrac{4i^2}{n^2}. \end{align}$$ Now, by the Riemann sums definition: $$\begin{align} \int_1^3(x^2-x+1)\,\mathrm dx&=\lim_{n\to\infty}\sum_{i=1}^n f(x_i^*)\Delta x\\ &=\lim_{n\to\infty}\sum_{i=1}^n \left[1+\dfrac{2i}{n}+\dfrac{4i^2}{n^2}\right]\dfrac2n\\ &=\lim_{n\to\infty} \left[\sum_{i=1}^n1+\sum_{i=1}^n\dfrac{2i}{n}+\sum_{i=1}^n\dfrac{4i^2}{n^2}\right]\dfrac2n\\ &=\lim_{n\to\infty} \left[\color{darkmagenta}{\sum_{i=1}^n1}+\dfrac{2}{n}\color{blue}{\sum_{i=1}^ni}+\dfrac{4}{n^2}\color{green}{\sum_{i=1}^ni^2}\right]\dfrac2n\\ &\overset{\displaystyle(\star)}=\lim_{n\to\infty} \left[\color{darkmagenta}n+\dfrac{2}{n}\color{blue}{\dfrac{n(n+1)}{2}}+\dfrac{4}{n^2}\color{green}{\dfrac{n(n+1)(2n+1)}{6}}\right]\dfrac2n\\ &=\lim_{n\to\infty} \left[2+\dfrac{4}{n^2}\dfrac{n(n+1)}{2}+\dfrac{8}{n^3}\dfrac{n(n+1)(2n+1)}{6}\right]\\ &=\lim_{n\to\infty} \left[2+2\dfrac{n^2+n}{n^2}+\dfrac{4}{3}\dfrac{2n^3+\mathcal O(n)}{n^3}\right]\\ &=2+2+\dfrac43\cdot2\\ &=4+\dfrac83=\dfrac{20}3. \end{align}$$ To be sure, let's check the actual value of that integral using the fundamental theorem of calculus: $$\int_1^3(x^2-x+1)\,\mathrm dx=\left(\dfrac{x^3}3-\dfrac{x^2}2+x\right)\left|\right._{x=1}^{x=3}=\left(\dfrac{3^3}3-\dfrac{3^2}2+3\right)-\left(\dfrac{1^3}3-\dfrac{1^2}2+1\right)=\dfrac{20}3\,\color{green}\checkmark$$

The general idea of Riemann sums comes from the geometrical interpretation of the integral. If you have the integral of a function $f(x)$ from $a$ to $b$, then its value is exactly equal to the area beneath the curve of the graph of $f(x)$. See the diagram below:

$\phantom{X}$diagram made by your humble correspondent Hakim ;-)

Now we can approximate this area by making small rectangles below the graph and summing them all up. And what the Riemann sum do is that as the number of those rectangles goes to infinity (and the rectangles get narrow enough) then if we sum them all up we will get the exact value of our integral.

$\phantom{X}$diagram made by your humble correspondent Hakim ;-)

The following theorem states that precisely:

Suppose that $f$ is integrable on $[a,b]$. Then for every $\epsilon>0$ there is some $\delta>0$ such that, if $\mathbf P=\{t_0,\ldots,t_n\}$ is any partition of $[a,b]$ with all lengths $t_i-t_{i-1}<\delta$, then $$\left|\,\sum_{i=1}^n f(x_i)(t_i-t_{i-1})-\int_a^bf(x)\,\mathrm dx\,\right|<\epsilon,$$ for any Riemann sum formed by choosing $x_i$ in $[t_{i-1},t_i]$.

NB: We can also use trapezoids instead of rectangles.

To learn more:

share|cite|improve this answer
Can u give an example please? – user34304 Apr 17 '14 at 12:27
@user34304 Okay, just wait I will edit my answer. – Hakim Apr 17 '14 at 12:28
When you write "Suppose that $f$ is integrable on $[a,b]$. Then", shouldn't you write "We say that a function $f$ is integrable on $[a,b]$ if", as what you stated is the definition of Riemann integrability on $[a,b]$? And then it's a bit clunky since the $\int_a^b f(x)\,\mathrm{d}x$ that appears is also part of the definition. – gniourf_gniourf Apr 17 '14 at 14:14
@gjdanis It's not me that created them, it's one of my friends, I've just made some edits on them. Btw he uses the modest Powerpoint to make such diagrams. – Hakim Apr 17 '14 at 14:27
@حكيمالفيلسوفالضائع: Thanks! Very nice! – rookie Apr 17 '14 at 14:28

Let $f$ be a function whose domain includes the interval $[a,b]$ and which is bounded on $[a,b]$. For each partition $\{a_0,a_1,a_2,\ldots,a_n\}$ of $[a,b]$ with

$$a=a_0<a_1<a_2<\cdots<a_n=b$$let $l$ and $m$ be given by $$l=\sum_{r\,=\,1}^n (a_r-a_{r-1})\times\inf\{f(x):a_{r-1}\le x\le a_r\}$$

$$m=\sum_{r\,=\,1}^n (a_r-a_{r-1})\times\sup\{f(x):a_{r-1}\le x\le a_r\}$$ Then let $L$ be the set of numbers $l$ arising in that way from all the partitions of $[a,b]$ and similarly let $M$ be the set of all numbers $m$ arising in that way. If there are some partitions which lead to both

$$\underbrace{l_1,l_2,l_3,\ldots}_{\in\,L}\quad\text{and}\quad\displaystyle \underbrace{m_1,m_2,m_3,\ldots}_{\in\,M}$$

such that the two sequences have the same limit $\alpha$ then $f$ is said to be integrable over $[a,b]$ and $\alpha$ is called its integral. We write


share|cite|improve this answer
This is an interesting way to define it. To those who did not understand it on the first read-through, he defines it as the value to which those two sums converge, only existing if they converge to the same value for some partitioning scheme. – AJMansfield Apr 18 '14 at 2:21

In order to compute the value of the given integral, you often use the fundamental theorem of calculus, which states: Let $f$ be a bounded function on a finite interval $[a,b]$ (that is riemann integrable) if there exist a differentiable function $F$ on $[a,b]$ such that $F'= f$ then $$\int_{a}^{b} f(x)dx = F(b)-F(a)$$

share|cite|improve this answer

More generally, a Riemann Sum can be defined as follows $$\int_a^bf(x)\,\mathrm dx=\lim\limits_{\|P\|\to0}\sum_{i=1}^{n}f(x_i^*)(\Delta x)_i$$ where: $$(\Delta x)_i=x_i-x_{i-1}$$ $$x_{i-1}\le x_i^*\le x_i$$ $P=\{a=x_0\lt x_1\lt x_2\lt ...\lt x_n=b\}$ is called a partition on [a,b] $$\|P\|=\max((\Delta x)_1,(\Delta x)_2,(\Delta x)_3,...,(\Delta x)_n)$$ Setting $(\Delta x)_i=(\Delta x)_j=\frac{b-a}{n}$ is one way of partitioning the interval [a,b], but it's not the only way.

Consider $$\int_a^b\sqrt{x}\,\mathrm dx$$ It may make more sense to partition [a,b] such that $\sqrt{x_i}-\sqrt{x_{i-1}}$ is a constant.

share|cite|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.