11 | INTRODUCTION TO INTEGRATION

This chapter of Single Variable Calculus by Dr JH Klopper is licensed under an Attribution-NonCommercial-NoDerivatives 4.0 International Licence available at http://creativecommons.org/licenses/by-nc-nd/4.0/?ref=chooser-v1 .

11.1 Introduction

Whereas the derivative explained the rate of change, we now move on the understanding the area under a curve of a function. In this chapter we introduced the second topic in calculus, which is integration.
We start by considering the idea of the area of rectangles to build our intuition for the definite integral.
Building this intuition for integration will help us in the next chapter where we have a proper introduction to integration using the anti-derivative and the indefinite integral.

11.2 The area under a curve

Consider the curve of the function
f(x)
2
x
and, more specifically, the area between the curve and the
x
axis from
x2
to
x3
, shown as the light blue area in Figure 11.2.1,which is termed the area under the curve.
In[]:=
Show[Plot[
2
x
,{x,-1,4},PlotRange->{{-1,4},{-1,16}},PlotLabel->"Figure 11.2.1",AxesLabel->{"x","y"},GridLines->Automatic,ImageSize->Large],Plot[
2
x
,{x,2,3},PlotRange->{{2,3},{-1,10}},Filling->Axis]]
Out[]=
We know the formulae for the areas of squares, rectangles, triangles, circles, and many more shapes. The area under the curve in Figure 11.2.1 does not have a defined formula, though. Instead we develop the idea of integration to calculate this area under the curve.
To develop and understanding of integration, we start to explore the method of Riemann sums.

11.3 Riemann sums method of numerical integration

The Riemann sum method to approximate the integral is the sum of the areas of rectangles formed between the curve and the
x
axis.
The area
A
of a rectangle is given in (1), where
x
is the base and
y
is the height.
A=xy
(
1
)
We can calculate the height of a rectangle by considering the value of a function at a point
(x,f(x))
, shown in Figure 11.3.1.
In[]:=
Show[ListPlot[{{2,
2
2
}},PlotRange->{{-1,4},{-1,16}},PlotLabel->"Figure 11.3.1",AxesLabel->{"x","y"},GridLines->Automatic,ImageSize->Large],Graphics[{Orange,Thick,Line[{{2,
2
2
},{3,
2
2
}}],Line[{{3,0},{3,
2
2
}}],Line[{{2,0},{2,
2
2
}}],Line[{{2,0},{3,0}}]}],Plot[
2
x
,{x,-1,4}]]
Out[]=
Figure 11.3.1 denotes a left-rectangle as the height of the rectangle
yf(x)
is determined at the left-most value of
x
. Figure 11.3.2 shows four such left Riemann rectangles. Note that we can approximate the area under the curve from
x
start

3
2
to
x
finish

7
2
by adding all the areas of the rectangles. This is a left Riemann sum.
In[]:=
ShowListPlot
3
2
,
2
3
2
,{2,
2
2
},
5
2
,
2
5
2
,{3,
2
3
},
7
2
,
2
7
2
,PlotRange->{{-1,4},{-1,16}},PlotLabel->"Figure 11.3.2",AxesLabel->{"x","y"},GridLines->Automatic,ImageSize->Large,GraphicsOrange,Thick,Line{3,
2
(3)
},
7
2
,
2
(3)
,Line
5
2
,
2
5
2
,3,
2
5
2
,Line{2,
2
(2)
},
5
2
,
2
(2)
,Line
3
2
,
2
3
2
,2,
2
3
2
,Line
3
2
,0,
3
2
,
2
3
2
,Line[{{3,0},{3,
2
3
}}],Line[{{2,0},{2,
2
2
}}],Line
5
2
,0,
5
2
,
2
5
2
,Line
7
2
,0,
7
2
,
2
(3)
,Line
3
2
,0,
7
2
,0,Plot[
2
x
,{x,-1,4}]
Out[]=
For a step size of
h
a starting value of
x
start
and an end value of
x
finish
, defining an interval of integration, we calculate
n
sub-intervals, as shown in (2).
n=
x
finish
-
x
start
h
(
2
)
In Figure 11.3.2 we start at
x
start

3
2
and end at
x
finish

7
2
. For a step size of
h
1
2
, we calculate
n
in (3).
n=
7
2
-
3
2
1
2
=
4
2
1
2
=
2
1
2
=4
(
3
)
There are indeed
n4
rectangles in Figure 11.3.2. The values of
x
that we require for calculating the height of each rectangle are
3
2
,2,
5
2
, and
3
. This would be
x
start
+0(h),
x
start
+1(h),
x
start
+2(h)
, and
x
start
+3(h)
. For a left Riemann sum we end at
(n-1)h
added to
x
start
.
We can sum over all the left Riemann rectangles using (4). Note that we end the summation at
x
finish
-h
, which can also be written as
x
start
+(n-1)h
, as is clear from Figure 11.3.2.
h
n-1
∑
i=0
f(x+ih)
(
4
)
A user-defined function named area can be created from (4), where the parameters x1 is
x
start
, x2 is
x
finish
, and h is the step size
h
.
In[]:=
area[x1_,x2_,h_]:=Modulen=
x2-x1
h
,h
n-1
∑
i=0
f[x1+ih]
We consider the function
f(x)
2
x
and create a user-defined function f to hold our function
f
.
In[]:=
f[x_]:=
2
x
We can now use the function area for the interval
x
start
1
,
x
finish
5
, and a step size
h0.0001
.
In[]:=
area[1,5,0.0001]
Out[]=
41.3321
It should be clear that in the case of Figure 11.3.2 that we under-estimate the area under the curve as the sum of the areas of the rectangles are smaller that the actual area under the curve.
Left Riemann sums are not the only way to approximate the area under a curve. We can also use right Riemann sums or even mid-point sums. We can even have different step sizes for each rectangle. The trapezoidal method is another such method that we explore in section 11.5. First, though, we use the idea of a Riemann sum to develop an understanding of the definite integral.

11.4 The definite integral

We start with a very simple definition of a definite integral.
Definition 11.4.1 A definite integral is the area under the curve of a function
f(x)
on and interval
xa
to
xb
, where
b>a
.
We can use the idea of a Riemann sum and limits to develop the understanding the definite integral.
Our step size was set as a constant in section 11.3. Using the Riemann sum we used values of
x
and
yf(x)
to determine the area of each rectangle. In essence, we can write (5), where our step size is
hΔx
and we sum over all the sub-intervals
X
. Note that we are approximating the area.
area≈
∑
X
f(x)Δx
(
5
)
If there are
n
sub intervals then the area is approximated in (6).
area≈
n
∑
i=1
f(x)Δx
(
6
)
We can make our step size infinitely small and have the number of sub intervals
n
approach infinity. In the limit we write (7).
area=
lim
n->∞
n
∑
i=1
f(x)Δx
(
7
)
From Definition 11.4.1 we name
a
and
b
the bounds of integration. For these bounds, we write the definite integral in (8), which follows from the limit in (7), where we use the integral symbol
∫
to replace the infinite summation
Σ
, and where we have an infinitely small step size
x
.
In the next section we develop the trapezoidal method of numerical integration which can be more accurate than using the sum of rectangles.

11.5 Trapezoidal method of numerical integration

The Wolfram Language is used in the code cell below to show the integral.