Buffon’s Needle Experiment (Estimate pi by randomly dropping sticks)

Kiran Prajapati
3 min readJun 3, 2021

--

In this article, we will look into Buffon’s Needle Experiment in detail and estimate the value of π.

Simulation of Buffon’s Needle Problem

Buffon’s Needle Problem

  1. A table is ruled with equidistant parallel lines a D distance apart.
  2. A needle of length L, where L≤D, is randomly thrown on a table.
  3. What is the probability that the needle will intersect one of the lines?
Buffon’s Needle Experiment Setup

Buffon’s Needle Solution

Buffon’s Needle Experiment Setup of single needle

Let us determine the position of the needle:
1. X= Distance from the middle point of the needle to the nearest parallel line
2. θ= Angle between the needle and the projected line of length X

Condition for the needle to intersect a line:
1. hypotenuse of the right angle triangle < half of the length of the needle

Hence,

X varies between 0 and D/2, θ varies between 0 and π/2

X and θ are uniformly distributed over the interval [0, D/2] and [0, π/2] respectively.

Let’s recap uniform distribution PDF,

Uniform Distribution

A random variable is said to be uniformly distributed over the interval (α,β) if its Probability Density Function is constant over range of x which can be mathematically written as,

Since, X is uniformly distributed over the interval 0 to D/2,

Similarly, θ is uniformly distributed over the interval 0 and π/2,

Since X and θ are independent,

Solving for equation (i),

Estimating the value of π

Buffon’s Needle Problem was once a common method of evaluating π using Monte Carlo Simulation. If you want to know more about Monte Carlo Simulation, here is a short blog about it Link.

Now let’s estimate π,

Number of needles dropped = N

Number of needles that cross the line = x

P(needle that crosses the line) is given as P,

Evaluate π using Buffon’s Needle Problem solution,

Flowchart explaining the experiment to estimate π

Here is a sample of Buffon needle simulation.

Simulation of Buffon’s Needle Problem
PLot of estimation of π at each drop of stick

--

--

Kiran Prajapati
Kiran Prajapati

Written by Kiran Prajapati

ML Engineer | Data Scientist | AI Researcher

No responses yet