How to calculate a definite integral

In the tutorial Integration by parts – indefinite integrals we have seen how to solve an integral symbolically. In this tutorial we are going to learn how to solve an integral numerically and what is the meaning of a simple integral.

Mathematical definition of the definite integral

In mathematics, the definition of a definite integral is something like: for a given continuous function f(x), of a real variable x, defined on an interval [a, b], the definite integral is:

\[\bbox[#FFFF9D]{\int_{a}^{b} f(x) dx =  \left [ F(x) \right ]_a^b= F(b)-F(a)}\]

where F(x) is the antiderivative (the function we get after solving an integral).

\[F(x)=\int f(x) dx\]

Numerically, an integration is an accumulation / summation. When we say that we are integrating a function, we are adding up the value of the function in several discrete intervals.

Graphical representation of the definite integral

Let’s imagine that the plot a general function f(x), on the interval [a, b] is something as depicted in the image below.

Graphical representation of a definite integral

Image: Graphical representation of a definite integral

The value of the integral of the function f(x), on the interval [a, b] is the area between the plot of the function and the horizontal axis. The area can be positive or negative depending on the sign of y = f(x). The final result will be the sum between all positive and negative areas.

Properties of the definite integral

The value of a definite integral over intervals of length zero, a = b, is zero. If a is a real number then:

\[\int_{a}^{a} f(x) dx = 0\]

The value of a definite integral changes sign if the integration limits are reversed. If a > b we get:

\[\int_{a}^{b} f(x) dx = – \int_{b}^{a} f(x) dx\]

If a point c ∈ [a, b], the following relationship is true:

\[\int_{a}^{b} f(x) dx = \int_{a}^{c} f(x) dx + \int_{c}^{b} f(x) dx\]

How to calculate a definite integral

Step 1. Calculate the antiderivative F(x)

Step 2. Calculate the values of F(b) and F(a)

Step 3. Calculate F(b) – F(a).

Example 1. Let’s calculate the definite integral of the function f(x) = x – 1, on the interval [1, 10].

Step 1.

\[F(x) = \int (x-1) dx = \frac{x^2}{2} – x\]

Step 2.

\[ \begin{split}
F(10) &= \frac{10^2}{2} – 10 = 40\\
F(1) &= \frac{1^2}{2} – 1 = -0.5
\end{split} \]

Step 3.

\[F(10)-F(1)=40-(-0.5)=40.5\]

In order to demonstrate that the value of the definite integral is the area delimited by the plot of the function and the horizontal axis, we are going to use the following Scilab script:

deff('y=f(x)','y=x-1');
x=1:10;
plot(x,f(x),'LineWidth',6);
xgrid();
ha=gca();
ha.data_bounds=[0,f(x(1));x($),f(x($))];
xp = [x(1) x($) x($)];
yp = [f(x(1)) f(x(1)) f(x($))];
xfpoly(xp,yp,12);
xlabel('x','FontSize',3);
ylabel('f(x) = x-1','FontSize',3);
title('x-engineer.org','FontSize',2,'Color','blue')

Running the script gives the following graphical window:

Graphical representation of f(x) = x - 1

Image: Graphical representation of f(x) = x – 1

As you can see, the area between the plot of the function and the horizontal axis, for the interval [1, 10], is a right triangle. The base of the triangle has the length 9. The height of the triangle is also 9. Therefore, the area of the triangle is:

\[S = \frac{9 \cdot 9}{2} = \frac{81}{2} = 40.5\]

As you can see, the area of the triangle is the same with the value of the definite integral.

Example 2. Let’s calculate the definite integral of the function f(x) = sin(x), on the interval [0, 2π].

Step 1.

\[F(x) = \int sin(x) dx = cos(x)\]

Step 2.

\[ \begin{split}
F(2 \pi) &= cos(2 \pi) = 0\\
F(0) &= cos(0) = 0
\end{split} \]

Step 3.

\[F(2 \pi)-F(0)=0 – 0=0\]

In order to demonstrate that the value of the definite integral is the area delimited by the plot of the function and the horizontal axis, we are going to use the following Scilab script:

deff('y=f(x)','y=sin(x)');
x=0:0.01:2*%pi;
plot(x,f(x),'LineWidth',2);
plot([0 2*%pi],[0 0],'r--','LineWidth',2)
xgrid();
xlabel('x','FontSize',3);
ylabel('f(x) = sin(x)','FontSize',3);
title('x-engineer.org','FontSize',2,'Color','blue')

Running the script gives the following graphical window:

Graphical representation of f(x) = sin(x)

Image: Graphical representation of f(x) = sin(x)

The total area between the plot of the function and the horizontal axis is zero. The area from π to is equal but opposite sign with the area from 0 to π. Therefore the sum of these two areas is zero.

For any questions, observations and queries regarding this article, use the comment form below.

Don’t forget to Like, Share and Subscribe!

Leave a Reply

Ad Blocker Detected

Dear user, Our website provides free and high quality content by displaying ads to our visitors. Please support us by disabling your Ad blocker for our site. Thank you!

Refresh