# Riemann Sum

Definite integrals are an important part of calculus. They are used to calculate the areas, volumes, etc of arbitrary shapes for which formulas are not defined. Analytically they are just indefinite integrals with limits on top of them, but graphically they represent the area under the curve. The limits denote the boundaries between which the area should be calculated. These concepts hold a lot of importance in the field of electrical engineering, robotics, etc. For defining integrals, Riemann sums are used in which we calculate the area under any curve using infinitesimally small rectangles. Let’s look at this interpretation of definite integrals in detail.

### Riemann Approximation

Riemann’s sums are a method for approximating the area under the curve. The intuition behind it is, if we divide the area into very small rectangles, we can calculate the area of each rectangle and then add them to find the area of the total region. This is the same intuition as the intuition behind the definite integrals. So, these sums can be also be used to approximate and define the definite integrals. Definite integrals are nothing but integrals with limits, they are used to find the areas, volumes, etc under arbitrary curve shapes. Consider the figure below, the goal is to calculate the area enclosed by this curve between x = a and x = b and the x-axis.

Now let’s start with dividing the given area into a number of rectangles, assuming the area is divided into ‘n’ rectangles of equal width. Notice that these rectangles do not cover the full area, so it is an approximation of the area. But as the number of rectangles increases, the approximation comes closer and closer to the actual area.

In the definite integral notation, this area will be represented as,

This area can be approximated by divided the area under the curve into n equally sized rectangles. So, the interval [a, b] is divided into n-subintervals defined by the points.

a = x_{0} < x_{1 }< x_{2 }< …. x_{n-2}< x_{n-1} < x_{n }= b

Then, the n intervals are,

[x_{0}, x_{1}], [x_{1}, x_{2}], …. [x_{n-1}, x_{n}]

So, for the i^{th} rectangle, the width will be, [x_{i-1}, x_{i}].

The area for i^{th} rectangle A_{i} = f(x_{i})(x_{i —} x_{i-1})

So, the total area will be

This sum is called the **Riemann sum**. Since the height of the rectangle is determined by the right limit of the interval, this is called the **right-**Riemann** sum**. The figure below shows the **left-**Riemann** sum**.

**Summation Notation**

The steps given below should be followed to find the summation notation of the riemann integral.

Step 1:Find out the width of each interval. Let’s denote the width of interval with

Step 2:Let x_{i}denote the right-endpoint of the rectangle x_{i }= a + .i

Step 3:Define the area of each rectangle.

Step 4:Sum the areas

Let’s say the goal is to calculate the area under the graph of the function f(x) = x^{3}, the area will be calculated between the limits x = 0 to x = 4.

Divide the interval into four equal parts, the intervals will be [0, 1], [1, 2], [2, 3] and [3, 4].

The riemann sum then, can be written as follows,

A(1) + A(2) + A(3) + A(4) =

Let’s calculate the **right sum Riemann sum**. Assume x_{i }denotes the right endpoint of the i^{th} rectangle.

So, the formula for x_{i }= i. Now, the value of the function at these points becomes,

f(x_{i}) = (i)^{3}

So, A(i) = (height)(width)

= (i)^{3}

The Riemann sum becomes,

A(1) + A(2) + A(3) + A(4) =

⇒ A(1) + A(2) + A(3) + A(4) =

So, this way almost all the Riemann sums can be represented in a sigma notation.

Let’s work out some problems with these concepts.

### Sample Problems

**Question 1: Choose which type of the Riemann integral is shown below in the figure. **

**Left-Riemann Sum****Right-Riemann Sum****Mid-point Riemann Sum**

**Solution: **

Since the values of the intervals are decided according to the left-end point of the interval. This is a left-Riemann Sum

Answer-(1).

**Question 2: Calculate the Left-Riemann Sum for the function given in the figure above. **

**Solution: **

Dividing the interval into four equal parts that is n = 4. The width of each interval will be,

x

_{0}= 0, x_{1}= 1, x_{2}= 2, x_{3}= 0 and x_{4}= 0The value of the function in each interval will be the value of the function at the right-end of the interval.

⇒A =

⇒A =

⇒A = f(1)(2) + f(2)(2)+ f(3)(2) + f(4)(2)

⇒A = (f(1) + f(2) + f(3)+ f(4))(2)

⇒A = (1 + 2 + 3+ 4)(2)

⇒A = (10)(2)

⇒A = 20

**Question 3: Consider a function f(x) = 5 – 2x, its area is calculated from riemann sum from x = 0 to x = 4, the whole area is divided into 4 rectangles. Find the riemann sum in sigma notation**

**Answer: **

Step (i):Calculate the widthThe whole length is divided into 4 equal parts,

x

_{i }= 0 and x_{l}= 4,Width of an interval is given by =

Where x

_{i }= initial point, and x_{l}– last point and n= number of partsn = 4

Step(ii):a = 0,

x

_{i}= 0 + i⇒ x

_{i}= i

Step (iii):A

_{i}= Height x Width= f(x

_{i})= (5 – 2i)(1)

= 5 – 2i

Total Area = A(1) + A(2) + A(3) + A(4) + A(5)

=

**Question 4: Consider a function f(x) = x ^{2}, its area is calculated from riemann sum from x = 0 to x = 3, the whole area is divided into 3 rectangles. Find the riemann sum in sigma notation**

**Answer: **

Step (i):Calculate the widthThe whole length is divided into 3 equal parts,

x

_{i }= 0 and x_{l}= 3,Width of an interval is given by =

Where x

_{i }= initial point, and x_{l}– last point and n= number of partsn = 3

Step(ii):a = 0,

x

_{i}= 0 + i⇒ x

_{i}= i

Step (iii)A

_{i}= Height x Width= f(x

_{i})= (i

^{2})Total Area = A(1) + A(2) + A(3) + A(4) + A(5)

=

**Question 5: Consider a function f(x) = √x, its area is calculated from riemann sum from x = 0 to x = 4, the whole area is divided into 4 rectangles. Find the riemann sum in sigma notation**

**Answer: **

Step (i):Calculate the widthThe whole length is divided into 4 equal parts,

x

_{i }= 0 and x_{l}= 4,Width of an interval is given by =

Where x

_{i }= initial point, and x_{l}– last point and n= number of partsn = 4

Step(ii):a = 0,

x

_{i}= 0 + i⇒ x

_{i}= i

Step (iii)A

_{i}= Height x Width= f(x

_{i})= (√i)(1)

= √i

Total Area = A(1) + A(2) + A(3) + A(4)

=

**Question 6: Consider a function f(x) = x ^{2}, its area is calculated from riemann sum from x = 0 to x = 2, the whole area is divided into 2 rectangles. Find the riemann sum in sigma notation**

**Answer: **

Step (i):Calculate the widthThe whole length is divided into 2 equal parts,

x

_{i }= 0 and x_{l}= 2,Width of an interval is given by =

Where x

_{i }= initial point, and x_{l}– last point and n= number of partsn = 2

Step(ii):a = 0,

x

_{i}= 0 + i⇒ x

_{i}= i

Step (iii):A

_{i}= Height x Width= f(x

_{i})= (i

^{2})(1)= i

^{2}Total Area = A(1) + A(2) + A(3) + A(4)

=

**Question 7: Consider a function f(x) = 3(x + 3), its area is calculated from riemann sum from x = 0 to x = 6, the whole area is divided into 6 rectangles. Find the riemann sum in sigma notation**

**Answer: **

Step (i):Calculate the widthThe whole length is divided into 4 equal parts,

x

_{i }= 0 and x_{l}= 6,Width of an interval is given by =

Where x

_{i }= initial point, and x_{l}– last point and n= number of partsn = 6

Step(ii):a = 0,

x

_{i}= 0 + i⇒ x

_{i}= i

Step (iii):A

_{i}= Height x Width= f(x

_{i})= (3(i + 3))(1)

= 3(i + 3)

Total Area = A(1) + A(2) + A(3) + A(4)

=

Attention reader! Don’t stop learning now. Join the **First-Step-to-DSA Course for Class 9 to 12 students ****, **specifically designed to introduce data structures and algorithms to the class 9 to 12 students