## Monte Carlo Procedure and Areas

It is sometimes desirable to estimate quantities whose exact values are difficult or impossible to calculate exactly. In some of these cases, a procedure involving chance, called a Monte Carlo procedure, can be used to provide such an estimate.

Example 2.2 In this example we show how simulation can be used to estimate areas of plane figures. Suppose that we program our computer to provide a pair (x,y) or numbers, each chosen independently at random from the interval [0,1]. Then we can interpret this pair (x, y) as the coordinates of a point chosen at random from the unit square. Events are subsets of the unit square. Our experience with Example 2.1 suggests that the point is equally likely to fall in subsets of equal area. Since the total area of the square is 1, the probability of the point falling in a specific subset E of the unit square should be equal to its area. Thus, we can estimate the area of any subset of the unit square by estimating the probability that a point chosen at random from this square falls in the subset.

We can use this method to estimate the area of the region E under the curve y = x2 in the unit square (see Figure 2.2). We choose a large number of points (x, y) at random and record what fraction of them fall in the region E = { (x, y) : y < x2 }.

The program MonteCarlo will carry out this experiment for us. Running this program for 10,000 experiments gives an estimate of .325 (see Figure 2.3).

From these experiments we would estimate the area to be about 1/3. Of course,

for this simple region we can find the exact area by calculus. In fact, r1 i

We have remarked in Chapter 1 that, when we simulate an experiment of this type n times to estimate a probability, we can expect the answer to be in error by at most l/yn at least 95 percent of the time. For 10,000 experiments we can expect an accuracy of 0.01, and our simulation did achieve this accuracy.

This same argument works for any region E of the unit square. For example, suppose E is the circle with center (1/2,1/2) and radius 1/2. Then the probability that our random point (x, y) lies inside the circle is equal to the area of the circle, that is,

If we did not know the value of n, we could estimate the value by performing this experiment a large number of times! □

The above example is not the only way of estimating the value of n by a chance experiment. Here is another way, discovered by Buffon.1

1 G. L. Buffon, in "Essai d'Arithmétique Morale," Oeuvres Complètes de Buffon avec Supplements, tome iv, éd. Duménil (Paris, 1836).

Figure 2.3: Computing the area by simulation.
0 0