You are on page 1of 5

Introduction We can also find this area in an experimental

way with the Monte Carlo integration. Using the


The Monte Carlo method, a method of statistical applet “Integrating a Line,” which computes
trials, can be an interesting subject to teach the area by generating random points on the
because it implies the use of probability and graph, we can obtain a series of experimental
random numbers. Students are fascinated by results for the value of the designated area.
the possibility of obtaining a mathematical, or
“exact,” answer to a problem using a some- For the purposes of this discussion, we will use
what playful approach dealing with chance. the point P(1,1). The applet shows the perpendic-
ulars drawn from P to the x and y axis to obtain
When problems are too complex to solve in an a square of area 1. The area under the function
analytical way, Monte Carlo methods are used to y = x is a triangle, which is a subset of the points
obtain an approximate numerical solution. The of the square. This subset and its complement
use of these methods is often associated with the with respect to the square make a set partition
works of Von Neumann and Ulam in the 1940s. of the set of the points of the square. We use
Integrating a continuous function that uniformly distributed random numbers to define
fluctuates irregulary in a given domain can be the coordinates of a given number of points
time-consuming, difficult, or even impossible. — for example 100 — generated by the applet,
It is with these functions that Monte Carlo included in the interval (0,1). The applet plots
integration applies best. For explanatory these points on the graph and counts how many
purposes, however, we will begin with the points are below the diagonal, which are in the
integration of simpler functions whose integrals area we want to compute. This number of points
are easy to calculate analytically. below the diagonal divided by the total points
generated yields a fraction that, when multiplied
by the known area of the square, gives us the
Using A Line to Introduce area under the diagonal. For example, suppose
Monte Carlo Integration that 48 points out of 100 are under the diagonal.
The area under the given function will be:
The Monte Carlo method can be explained
to show a different way to compute an A = 1(48/100) = 48/100, which is approximately .
integral with respect to the traditional analyti- We can also say that the area is represented
cal integration. Consider the function: by the probability that a randomly generated
, point lies under the diagonal, that is, by look-
ing at the ratio 48/100 as the ratio between
of which we calculate the definite integral successful and possible cases. The points
between 0 and 1. generated (possible cases) are the statistical
trials. In the applet, the random points below
the diagonal are shown in red and the random
points above the diagonal are shown in blue.

This integral represents the area below the


diagonal of the unit square.
© 2004 National
Council of Teachers
of Mathematics
Exploring Monte Carlo
A = 1(78/100) = 78/100, which is approximately .
Integration with a Circle
Another advantage of considering the function
In the applet “Monte Carlo Integration of a y = x is that it is easy for students to develop a
Circle,” we consider the function , program that calculates the integral using the
which represents a quarter of the unit circle Monte Carlo method. The algorithm must gener-
centered at the origin, whose equation is ate, for example, 100 pairs of random coordinates
. We calculate analytically the x and y included in the interval (0,1), and for each
integral of the function between 0 and 1: pair must compare the value of y with the value
of x. If y is greater than x, the point is above the
diagonal and is not counted as meeting the crite-
Substituting x = sin and dx = cos d , we get ria of the function; if y is equal to or smaller than
x, the point is below the diagonal and is accepted.
d so A counter can keep track of the accepted points,
. and the area is calculated by dividing this number
by the number of total points generated (100).
For a detailed solution see the Add On.
Using the applet, we can generate a series of The program can be run for a greater number
experimental results for the value of the area. of points. The results of this computer experi-
ment (indeed a Monte Carlo simulation) might
As before, consider a point P(1,1) with perpen- be shown in a table such as in table 1.
diculars drawn from P to the x and y axis. Again,
we obtain a square whose area is 1, but this Indeed, given a random point , in
time the function is represented by the arc of the example of the integral of the circle’s arc, the
the unit circle that lies in the first quadrant. algorithm is similar, with the only difference being
that we must compare the second coordinate
As before, we use uniformly distributed random ( ) of each random point with to see if it
numbers to define the coordinates of a given is above or below the function. If the condition:
number of points, included in the interval
(0,1). The applet generates these points on is verified, the point is accepted.
the graph and counts how many points are
under the arc that represents the function.
Suppose that 78 points out of 100 are under
the curve. The designated area will be:

Total Points Accepted Points Area

Accepted Points/
Total Points

500 255 0.51000000


1000 535 0.53500000
1500 746 0.49733333
2000 1005 0.50250000
2500 1243 0.49720000
3000 1455 0.48500000
© 2004 National
Council of Teachers
Table 1
of Mathematics
The Monte Carlo Integration
of the Gaussian Function
As a final example, the applet “Gaussian
Function” shows the application of the
Monte Carlo integration to the Gaussian
function , which is integrated
between 0 and 1:

This function does not have antide-


rivative, but Monte Carlo integration
can compute the integral anyway.

Conclusions
As highlighted in the article that appeared in function. A point below means that the ratio
the second issue of ON-Math, “Mathematically between accepted points and total points
Appropriate uses of Technology” by Bethany equals 1 and this must be multiplied by the
Snyder Hudnutt and Robert M. Panoff, some area of the unit square yieding a resulting
of the best applications in mathematics area of 1. A point above equals the ratio
are in the areas of graphing functions and of 0/1 = 0 and the subsequent multiplica-
probability theory. Both these aspects are tion by the area of the unit square is 0.
involved in Monte Carlo integration.
By increasing the number of trials as much
Simple examples work best for an initial as possible (the program limits each computation
discussion of the Monte Carlo method. Once to a maximum of 150,000 points), the areas
students understand the Monte Carlo method above and below the diagonal appear uniformly
of integration, teachers can fully discuss the blue and red. Considering the thickness of
accuracy of the method. For a hands-on intro- the points, this effect occurs because of
duction, teachers may want to have students resolution on the computer screen and does
first draw an accurate graph of a given function not mean that all the available points of the
on a piece of tagboard and then drop a known square were used. The coordinates of each
number of grains of rice on to the diagram. point are, in fact, real numbers, and therefore
Once students understand the nature of the the square contains an infinite number of
simulation, they can use the applet to see the points (certainly more than 150,000 points).
results of using greater numbers of points.
These last considerations highlight the impor-
The possibility of experimenting by varying the tance of the role of the teacher in leading
number of trials and obtaining immediate feed- students to make observations and correct
back easily leads to reasoning about limit cases. interpretations of those observations.
For example, if the applet about the diagonal
(Integrating a Line) is asked to compute the area
for just one trial, the result will be 1 or 0 depend-
© 2004 National
Council of Teachers ing on whether the point falls below or above the
of Mathematics
references
Bronson, Richard, and Gary J. Bronson. Finite mathematcs: a Modeling
Approach. Minneapolis/St. Paul: West Publishing Company, 1996.
Martin, Francis F. Computer Modeling and Simulation.
New York: Wiley, 1968.
Neelamkavil, Francis. Computer Simulation and Modeling.
New York: Wiley, 1987.
Shreider, Y. A., Ed. The Monte Carlo Method.
Oxford: Pergamon Press, 1966.
mathworld.wolfram.com/MonteCarloIntegration.html. 2003.

© 2004 National
Council of Teachers
of Mathematics
add-ons
Analytical solution of the integral

Substituting, , we obtain

© 2004 National
Council of Teachers
of Mathematics

You might also like