Monte Carlo methods are computational algorithms that use random sampling to approximate numerical results.Monte Carlo methods are a class of computational algorithms based on repeated random sampling. They allow numerical estimation of high-dimensional integrals, solving differential equations, and optimization problems. The key idea: instead of analytical calculation, one resorts to a statistical experiment. Convergence is slow (error decreases as 1/√N) but independent of dimensionality, making the methods indispensable in multidimensional space. In finance, for example, they estimate the value of complex derivative instruments, in biology they model population evolution, and in computer graphics they create realistic scene lighting (ray tracing).
The idea goes back to Buffon's needle experiment in the 18th century, but as a computational tool it took shape in the 1940s. Stanislaw Ulam, recovering from an illness, thought about solitaire games and realized that instead of complex combinatorial calculations, one could simply replay a random game many times and estimate the probability of winning. He discussed this with John von Neumann, and they applied the approach to neutron diffusion calculations. In 1953, the seminal paper by N. Metropolis et al. on the sampling algorithm appeared.
To estimate the integral I = ∫ f(x) dx, one introduces a probability density p(x) and generates N points xi ~ p(x). The approximation: I ≈ (1/N) Σ f(xi)/p(xi). In MCMC, a Markov chain is constructed with a transition kernel that ensures ergodicity and stationarity on the target distribution. For complex distributions, ensemble sampling and Hamiltonian Monte Carlo are used, which utilizes gradients of the log-density.
Engineers use them to verify the reliability of bridges, financiers forecast stock prices, and physicists model nuclear reactions.
The most famous example is computing π: by throwing points into a square with an inscribed circle and counting the ratio of those that fall inside the circle to the total, one gets an approximation 4×(inside/total).













