Calculate definite integrals
Home ]

How to calculate definite integrals of a function.

This topic is part of the TCS FREE high school mathematics 'How-to Library', and will help you to calculate definite integrals of a function.
(See the index page for a list of all available topics in the library.) To make best use of this topic, you need to download the Maths Helper Plus software. Click here for instructions.

Theory:

Consider the problem of finding the area A between a curved line: y = f(x) and the x axis,  between x = a and x = b:

We can approximate the area by slicing it into rectangles and adding up the areas of the rectangles. In the diagram below, there are three rectangles of equal width. The height of each rectangle equals the height of the function graph at its midpoint, and the width of each rectangle = (b-a)/3:

The total area under the curve from x = a to x = b can be approximated by: A = A1 + A2 + A3.

 Notice that the area A1 is an overestimate of the area under the curve, A2 is about right, and A3 is too small.  Thus this method may be accurate for some types of curves, but not for others. It depends on their shape.

 One way to improve the accuracy for any shaped curve is to increase the number of rectangles. If there are n rectangles, then as n increases, the width of each rectangle decreases.

 For very thin rectangles, areas at the top that dont fit the curve become insignificant, then the sum of the rectangles becomes very close to the area under the curved graph line.

Let  be the area under the graph: y = f(x) from x = a to x = b.  We can calculate the area by summing up the areas of the rectangular slices. If there are n slices, then the total area is approximated by:

The true area is called the 'definite integral' of the function, and can be written as the limit of this sum as n approaches infinity, like this:

The 'Method' section below shows you how to use Maths Helper Plus to calculate the definite integral of a function by adding rectangles under its graph. This can be very accurate because the computer can add many thousands of tiny rectangles in a fraction of a second.

Download the free support file... We have created a Maths Helper Plus document containing the completed example from this topic. You can use this to practice the steps described below, and as a starting point for solving your own problems.

File name:  'Definite integral.mhp'   File size: 3kb
Click here to download the file.

If you choose 'Open this file from its current location', then Maths Helper Plus should open the document immediately. If not, try the other option: 'Save this file to disk', then run Maths Helper Plus and choose the 'Open' command from the 'File' menu. Locate the saved file and open it. If you do not yet have Maths Helper Plus installed on your computer, click here for instructions.

Method:

To explain how to use Maths Helper Plus to calculate a definite integral, we will use the function:

 

y = 0.02x + 0.05x - 0.3x + 2

We will calculate the definite integral from x = -3 to x = 4.

Step 1  Start with an empty Maths Helper Plus document

If you have just launched the software then you already have an empty document, otherwise hold down Ctrl while you briefly press the N key.

Step 2  Graph your function

1. Press the F3 key to activate the 'input box' for typing (see below):

 

2. Type the function into the input box:

3. Press ENTER to complete the entry

For more help on entering functions, see the 'Easy Start' tutorial in the Maths Helper Plus 'help'. To access the tutorial, click 'Help' on the Maths Helper Plus menu bar, then select: 'Tutorial...'

If the graph of the function does not appear, you need to adjust the graph scale. 
First reduce the graph scale. Press the F10 key enough times until the main parts of the graph are visible.
To enlarge the graph, hold down 'Ctrl' while you press F10.

For more help on setting graph scales, click 'Help' on the Maths Helper Plus menu bar, then select 'Index'. Click the button at the top left corner of the help screen. Click 'Training', then 'Essential skills', then 'Graph scale magic'. 

Step 3  Display the options dialog box and set options

Carefully point to the plotted function graph line with the mouse and double click the mouse. This will display the function options dialog box. Click to select the 'Integrals' tab at the top of the dialog box:

1. Click on the 'Limits of integration' edit box and type the lower and upper boundaries for the integral in square brackets like this: [a,b]

 

For the example, we type: [-3,4]

2. Click on the 'Number of intervals' edit box, and type these values of 'n':

 

2,4,10,50,100,200,300,500

The area under the graph between 'a' and 'b' will be divided up into 'n' slices to calculate the total area. Each number in this list will be used for 'n'. Higher values of 'n' will usually give a more accurate result, so by comparing results for increasing value of 'n', we can decide how accurate our answer is.

 

3. Select 'Shade areas on graph' to shade the area being calculated.

 

4. There are several different methods of calculating area under a curve. These can be selected by clicking the required options under 'Methods of Integration'. The method described in 'Theory' above is Rectangular (mid-point). the 'Trapezoidal rule' reduces errors by joining points on the graph with straight lines, while 'Simpson's rule' fits parabolas between points on the graph. You should select several methods for comparison.

 

5. Make sure 'Calculation mode' is set to 'definite integral', unless you are calculating the true area between the graph and the 'x' axis. The true area is the same as the definite integral, unless part of the area lies under the 'x' axis. For definite integrals, areas below the 'x' axis are negative, and subtract from the total answer.

 

Click OK to finish.

Step 4  Read the integral value from the table

The text view displays the table of calculated integrals. This is how the table looks for the example integral:

Definite integral from x = -3 to x = 4

n     Simpson   Trapezoidal   Midpoint

2     15.3417   16.485        14.77

4     15.3417   15.6275       15.1988

10    15.3417   15.3874       15.3188

20    15.3417   15.3531       15.3359

50    15.3417   15.3435       15.3408

100   15.3417   15.3421       15.3414

200   15.3417   15.3418       15.3416

300   15.3417   15.3417       15.3416

500   15.3417   15.3417       15.3417

 

Simpson's rule was fastest to achieve four decimal place accuracy.

 

For the trapezoidal rule, four decimal place accuracy is achieved at n=300. This is proved because the last digit (7) does not change for n = 500.

 

For the midpoint method, n = 500 is required to achieve four decimal place accuracy. 

 

NOTE: We could add another higher 'n' value to the list, say n = 700, to check out the accuracy of the last digit for the midpoint method, but since we already know this answer is correct from the other two columns, we don't need to do so.

 

Still don't understand or have further questions about this topic ?
Then ask us! Click here now!