Pi
Monte Carlo methods

Monte Carlo methods, which evaluate the results of multiple random trials, can be used to create approximations of π. Buffon's needle is one such technique: If a needle of length ℓ is dropped n times on a surface on which parallel lines are drawn t units apart, and if x of those times it comes to rest crossing a line (x > 0), then one may approximate π based on the counts: π ≈ 2 n ℓ x t. {\displaystyle \pi \approx {\frac {2n\ell }{xt}}.}

Another Monte Carlo method for computing π is to draw a circle inscribed in a square, and randomly place dots in the square. The ratio of dots inside the circle to the total number of dots will approximately equal π/4.

Another way to calculate π using probability is to start with a random walk, generated by a sequence of (fair) coin tosses: independent random variables X such that X ∈ {−1,1} with equal probabilities. The associated random walk is W n = ∑ k = 1 n X k {\displaystyle W_{n}=\sum _{k=1}^{n}X_{k}} so that, for each n, W is drawn from a shifted and scaled binomial distribution. As n varies, W defines a (discrete) stochastic process. Then π can be calculated by π = lim n → ∞ 2 n E 2. {\displaystyle \pi =\lim _{n\to \infty }{\frac {2n}{E^{2}}}.}

This Monte Carlo method is independent of any relation to circles, and is a consequence of the central limit theorem, discussed below.

These Monte Carlo methods for approximating π are very slow compared to other methods, and do not provide any information on the exact number of digits that are obtained. Thus they are never used to approximate π when speed or accuracy is desired.
punctuation:no_comma, detectable_format:number_highlighted_sections[6]