If you wished to solve the time dependent case of the Collisionless Boltzmann Equation using finite difference methods, an impractically large grid would be required. As a result, an N-Body simulation uses Monte Carlo methods to solve this equation. By increasing the value of N, greater levels of accuracy may be obtained.
As an example, consider the following example (Barnes, 1996) : we wish to obtain an estimate for the value of . Draw a square of area A with a circle of area inscribed within it, where . Randomly scatter n points within the boundary of the square and count the number which fall within the area of the circle. Since the points were scattered randomly, it follows that the number of points found within a particular area is proportional to the area itself. Thus by taking the ratio and noting that this is the ratio, we can estimate with a fractional uncertainty of .
Although the Monte Carlo method isn't a particularly efficient method for calculating , it does outperform other methods when evaluating multidimensional integrals. This is because the error depends only on the number of points and not on the number of dimensions.