# Riemann Integral

 $\frac{d}{dx} \sin x=?\,$ This article/section deals with mathematical concepts appropriate for a student in late high school or early university.

The Riemann integral is the mathematical definition of the integral of a function, that is, a measure of the area enclosed by its graph in calculus. The term, along with Riemann sum, is also a useful method for approximating that area.

How the Riemann integral works. The blue region shows the lower estimate of the strip areas, blue+yellow is the actual function area, and blue+yellow+pink is the upper estimate. Yellow+pink is the difference between the low and high estimates.

## Theoretical Introduction

The Riemann integral is the correct term for the theoretical definition, given by Bernhard Riemann around 1853, for the integral of a function.

The integral of a function is generally conceptualized as measuring the area under the graph of that function.

Specifically, the area between two specific points, x = a and x = b, is called the definite integral, written
$\int_a^b f(x)\,dx$

The "obvious" way to evaluate such an integral is to divide the domain of the function into many small intervals (this division is called a mesh) and to visualize the area under the function as being the sum of the areas of the rectangular strips created by the mesh. The height of each strip is hard to measure accurately, because the function value is typically not constant across the interval. What is done is to choose some value that approximately represents the the function value on the interval, multiply by the interval width (strip width) and take that as the area of the strip. The representation of the function value is generally taken as

• The function value at the left edge of the interval.
• The function value at the right edge of the interval.
• The function value at the center of the interval.
• The maximum function value across the interval.
• The minimum function value across the interval.
• Some other trick, such as the use of Simpson's rule; see below.

The use of the minimum and maximum values are particularly interesting, both practically and theoretically. If the minimum value is used, one knows that the resultant sum of the strip areas must be less than or equal to the true area. Conversely, the maximum value will give a resultant sum greater than or equal to the true area. Hence one can make guarantees of accuracy—if the strip widths are narrow enough that the two values obtained are within one millionth of each other, one knows that this is within one millionth of the true result.

The breaking down of the function graph into rectangular strips, and approximating the area under the graph in terms of rectangles, is a very well-known technique, and is what is commonly called the "Riemann integral", or, more properly, the "Riemann sum". Most of the rest of this article is about it. However, Bernhard Riemann's contribution to this, and the reason we name it after him, is his theoretical achievement. (Reimann was a brilliant theoretical mathematician. He essentially invented the field of differential geometry, as well as making major contributions to number theory and other areas.)

What Riemann did was to show that, if one takes the minimum and maximum values (as described above), and makes the strips narrower and narrower, (the mesh finer and finer), the two approximations will converge to each other. That is, they will approach the same value as a limit. Mathematicians take that limit as the definition of the (Riemann) integral. So Riemann's achievement was to take the common computational task of adding up the strip areas, and make a proper (or, as mathematicians say, rigorous) definition out of it. In so doing, he put the definite integral, and hence integral calculus, on a firm theoretical basis.

Riemann's proof is beyond the scope of this article. It applies to any function which is either continuous or has a finite number of discontinuities. (At a more advanced level, it applies to any function for which the set of discontinuities has measure zero.)

To define the limit, he had to modify the usual "epsilon/delta" formulation. The definition is this (see the "limit" article):

For every epsilon greater than zero, there is a mesh such that, for that mesh and all finer meshes (put in additional subdivision points), the difference between the upper sum (using the maximum function value) and the lower sum (using the minimum value) is less than epsilon.

## Introduction to the Applied Method

As a geometric interpretation of the area under a curve (also called the definite integral), the Riemann integral consists of dividing the area under the curve of the function into fixed width subintervals. The area of each subinterval is added together to get the approximation. The greater the number of subintervals that is used, the closer the approximation is to the true value of the integral, where the "true value" is defined as that value obtained in the limit as the width of the subintervals approaches zero. Only if the limit exists does the integral exist.

Most of the time, rectangles are used when evaluating the area. Sometimes more complex shapes, such as parabolas in Simpson's rule, are used in approximations.

## Evaluating a Riemann Integral

The domain of the function is partitioned into segments. These segments are called subintervals of the partition. If each subinterval is of equal width, then width can be represented by[1]

$\frac{b-a}{N}$.

To find the area under the curve, the areas of all subintervals are added together. With each shape of subintervals, there are different equations used to evaluate the area. If the subintervals are rectangles, we can use the properties of rectangles to find the area. The area of a rectangle is height times width. To get the height of the rectangles, we evaluate the function at the subinterval.

The equation for the area of each rectangle is

$A = f(x_k)\left ( \frac{b-a}{N} \right )$.

For simplification, we can say that

$\Delta x = \frac{b-a}{N}$
$A = f\left (x \right ) \Delta x$.

There are three methods of evaluating the area of each rectangle. The function could be evaluated at the left, right, or midpoint of each subinterval.

The three equations are as follows:

Left Endpoint:

$\sum_{k=0}^{N-1} f\left (a+k\Delta x \right ) \Delta x$

Right Endpoint:

$\sum_{k=1}^N f\left (a+k\Delta x \right ) \Delta x$

Midpoint:

$\sum_{k=0}^{N-1} f\left (a+(k+.5)\Delta x \right ) \Delta x$

If we increase the number of partitions, N the summation is a closer approximation of the true area under the curve. This can be written as

$\lim_{n \to \infty}\sum_{k=1}^N f\left (a+k\Delta x \right ) \Delta x = \int\limits_a^b f(x)dx$

### Example

#### Part A

How evaluating a Riemann Integral works.
Given:

$\int_0^1 x^2\,dx$

To begin, let's set:

N = 1

This means:

$\Delta x = {1 - 0 \over 1} = 1$

For this example, we'll go with the Left Endpoint approximation. This gives us:

$\sum_{k=0}^{N-1} f(a+k\Delta x)\Delta x$
$\sum_{k=0}^{1-1} f(a+k(1))(1) = f(a+0(1)) = f(a) = 0$

For an approximation, this result is horrible. The actual value is 1/3. To increase our accuracy, we must increase the number of subintervals, N. This time:

N = 2
$\Delta x = {1 - 0 \over 2} = {.5}$
$\sum_{i=0}^{2-1} f(a+k(.5))(.5) = [f(a+0(.5)) + f(a+1(.5))] \left( {1\over2} \right) = [f(0)+f(.5)]\left( {1\over2} \right)$
$=[0+.5^2]\left( {1\over2} \right) = (.25)\left( {1\over2} \right) = .125$

This result is closer, but nowhere near as accurate as we want it to be.

N = 10
$\Delta x = {1 - 0 \over 10} = {.1}$
$\sum_{k=0}^{10-1} f(a+k(.1))(.1)$
= [f(a + 0(.5)) + f(a + 1(.5))](.1)
= [f(0) + f(.1) + f(.2) + f(.3) + f(.4) + f(.5) + f(.6) + f(.7) + f(.8) + f(.9)](.1)
= [0 + .01 + .04 + .09 + .16 + .25 + .36 + .49 + .64 + .81](.1)
= (2.85)(.1) = .285

As we increase N, our approximation approaches the real value. To find the real value, we must use the limit function.

#### Part B

To get the exact value of the integral, we must find:

$\lim_{N\to\infty} {\sum_{k=0}^{N-1} f\left (0+k\Delta x \right ) \Delta x}$

We know that:

f(x) = x2

So we can say:

$f\left (0+k\Delta x \right ) = \left (i\Delta x \right )^2 = i^2 (\Delta x)^2$
$\lim_{N\to\infty}{\sum_{k=0}^{N-1} i^2 (\Delta x)^3 }$

Because Δx is not dependent on k, we can separate this into two summations and solve them separately.
The first part:

$\sum_{k=0}^{N-1} i^2$

We know from the sequence of Square pyramidal numbers that:

$\sum_{k=0}^{n} i^2 = {(n)(n+1)(2n+1)\over6}$

This says that the sum of n consecutive integers is equal to:[2]

${(n)(n+1)(2n+1)\over6}$

We can apply that to our problem, to get:

$\sum_{k=0}^{N-1} i^2 = {(N-1)(N-1+1)(2(N-1+1)\over6}$
$=\sum_{k=0}^{N-1} i^2 = {(N-1)(N)(2N-1)\over6}$

We can now simplify the second part.

$\Delta x = {b - a \over N}$
$\Delta x = {1 - 0 \over N} = {1\over N}$

This gives us:

$\lim_{N\to\infty} \left[{(N-1)(N-1+1)(2(N-1+1)\over6}\right]{1 \over N^3}$
$= \lim_{N\to\infty} \left( {(N-1)(N)(2N-1)\over6 N^3} \right)$
$= \lim_{N\to\infty} \left( {(2N^3 - 3N^2 + N)\over6 N^3} \right)$

We can now simplify this using L'Hôpital's Rule

$= \lim_{N\to\infty} \left( {(6N^2 - 6N + 1)\over18 N^2} \right)$
$= \lim_{N\to\infty} \left( {(12N - 6)\over36N} \right)$
$= \lim_{N\to\infty} \left( {(12)\over36} \right)$
$= \lim_{N\to\infty} \left( {1\over3} \right)$

N is gone from the limit, and we are left with a constant.

$= \lim_{N\to\infty} \left( {1\over3} \right) = {1\over3}$

Therefore:

$\int_0^1 x^2\,dx = { 1 \over 3 }$

#### Part C

Say that, instead of evaluating the integral from 0 to 1, we wanted to solve it from 0 to an undetermined upper limit, c:

$\int_0^c x^2\,dx$

This changes our Δx value:

$\Delta x = {c - 0 \over N} = {c \over N}$

This actually does not change any calculations until we replace Δx in the limit.

$\lim_{N\to\infty}{\sum_{k=0}^{N-1} i^2 (\Delta x)^3 } = \lim_{N\to\infty} \left[{(N-1)(N-1+1)(2(N-1+1)\over6}\right]{c^3 \over N^3}$
$= \lim_{N\to\infty} (c^3) \left( {(6N^2 - 6N + 1)\over18 N^2} \right)$

Because c3 is a constant, we can factor it out of the limit.

$= c^3 \lim_{N\to\infty} \left( {(2N^3 - 3N^2 + N)\over6 N^3} \right)$

We know from above how to simplify what is in the limit, so we are left with:

${1\over3}c^3$

Therefore:

$\int_0^c x^2\,dx = {1\over3}c^3$

We can rewrite this as:

$\int x^2\,dx = {1\over3}x^3 + a$

Where a is known as the constant of integration which is necessary here since we have performed an indefinite integration - that is integrated without specifying the limits of integration. This is done because any constant a will give you a function that has the desired derivative.