Learning calculus at school, we soon find out that while differentiation is relatively easy, at least for simple functions, integration is hard. So hard indeed that, in many cases, it is impossible to find a nice function that is the integral (or anti-derivative) of a given one. Thus, given we can usually find , whereas we may not be able to find .

Stan Ulam was a remarkable genius. Originally from Poland, he spent his working life in America. He played a key role in the development of the atomic and hydrogen bombs at Los Alamos. He developed a method of evaluating integrals that proved very powerful and useful. Although the integral of a function may be defined in a precise, deterministic way, the method of evaluating it is based on probability, and yields an answer that is “very likely” to be correct.

**Integrating by Probability **

In many problems we need to find the area under a closed curve. In Fig. 1 (left) we show the function with the grey area showing the integral from 1 to 7.5. If we are unaware of the log-function, we cannot integrate analytically (to prove that the area is ). Suppose we consider a rectangle around the curve, as in Fig. 1 (right). The sum of the red and blue areas is obviously the breadth by height, or 6.5. But we want the size of the red area.

Ulam’s idea was this: suppose we pick a point at random within the rectangle. The probability that it falls within the red area is

where the total area is the the sum of the red and blue areas. If we do the experiment once, it tells us little. But, instead of choosing just one point at random, we choose a large number of them. Then, the proportion of these points falling below the curve should be approximately equal to the probability of a single randomly chosen point falling below the curve:

If we do the experiment many times, we will get a value for . Then, since we know the area of the rectangle, we can solve the equation for the red area:

How could we do this experiment in practice? Well, one way might be to make a kind of rectangular dart-board with the function drawn on it. We might then throw darts repeatedly at the board, and count the fraction of them that land on points below the function.

In reality, we do not play darts; we have a mathematical description of the function and the rectangle. We generate a pair of random numbers and check if it falls below or above . We do this many times, and keep a note of how many times the point falls below . Then the proportion of these to the total number gives us an approximate value for the area integral .

** Why Monte-Carlo? **

The method was dubbed the Monte-Carlo Method by Nicholas Metropolis, a colleague of Ulam, because of its association with chance and gambling. There are many simpler ways to evaluate an integral like . However, in many problems in physics, multi-dimensional integrals must be computed, sometimes in more than 100 dimensions, and the Monte-Carlo method is very valuable in producing an accurate result. The random points are generated rapidly using a PNRG, or Pseudo-Random Number Generator.

The Monte-Carlo Method is one of the most popular and widely-used methods of obtaining numerical answers to problems in physics, chemistry, engineering and other disciplines.

** As easy as Pi **

The use of a probabilistic method to compute a deterministic quantity goes back to Georges-Louis Leclerc, Comte de Buffon in 1733. He devised a method of calculating by dropping a stick or needle on a lined floor (see earlier post here). We will now look at another way to use the Monte-Carlo approach to estimate .

Suppose a unit circle is drawn within a square and points are chosen randomly within the square; think of a dart-board in a square frame, with darts thrown from a distance. The area of the square is 4 and the area of the circle is . So, a proportion of the darts will fall within the circle. Fig. 2 (top left)shows the set-up, Fig. 2 (top right) shows 250 random points within the square. Fig. 2 (bottom left) shows 2500 random points and Fig. 2 (bottom right) shows 25000 random points within the square.

We used **Mathematica** to generate random number pairs in the range and count the proportion with . This proportion should approach when the number of points is large.

For N=250 it was 3.1554/4, for N=2500 it was 3.1901/4 and for N=25000 it was 3.1422/4. We see that it is approching the value 3.1416/4 or .