The classic example of the use of the Monte Carlo method is the determination of the value of π by throwing darts at a dart board consisting of a circle contained in a square.
If r = 1, then the area of the square is 4, and the area of the circle should be π r 2 = π . The fraction of darts landing inside the circle (as thrown by a blindfolded player) should therefore be π /4, and from this the value of π can be approximated. Notice that the solution is not exact, but gains precision as more darts are thrown.
The flexibility of the Monte Carlo method can be demonstrated by the fact that the solution above is not the only one for determining the value of π . The interested reader is invited to investigate Buffon's Needle to see another solution.
The application of the Monte Carlo method can be generalized to accommodate any function; this is the approach used to numerically determine the values of integrals.