Monte Carlo methods are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. They operate on the principle that, given a sufficiently large number of samples, the distribution of those samples will approximate the true probability distribution of the underlying random variable.
A particular application is that the time average approximate the space average. For example, the area of the square \([-1,-1]\times [-1,-1]\) is \(4\), in which the area of the unit disk \( D= \{x^2 +y^2 \le 1\}\) is \(\pi\). Therefore, the space average of the area of the unit disk \(D\) is \(\pi/4\).
Consider a squence of uniformly distributed random variable \(X_n=(x_n,y_n)\) on \([-1,-1]\times [-1,-1]\). Then the time average \(\frac{1}{N}\{1\le n \le N: X_n \in D\} \to \frac{\pi}{4}\) in probability \(1\).
This gives us a method to approximate the number \(\pi\) using the frequency of our samples satisfying \(X_n \in D\).
If the principle fails, then the Monte Carlo method fails, too.
