Luis R. Suazo
2015
Buffon's needle refers to a problem in geometric probability first posed by Georges-Louis Lecler, Comte de Buffon in the in the 1733:
The solution, presented in 1777 (the year Gauss was born!) by Buffon himself, was the first of its kind.
If the spacing between lines (of strips of wood on floor, or lines on a ruled paper, etc.) is \( d \), and the length of the needle is \( l \), then assuming \( \,l < d \) the probability of crossing turns out to be
\[ P(Crossing) = \frac{2l}{d\pi} \]
In the associated shiny application, located at:
I use \( \,d = 2l \) so \( \,P(Crossing) = 1/\pi \).
The \( x \) and \( y \) positions of the dropped needles are assumed to have a uniform distribution within the floor (or notebook). Similarly the angle is uniformly distributed between \( 0 \) and \( \pi \).
num <- 10000; angle <- runif(num,0,pi)
x.center <- runif(num,0,10)
y.center <- runif(num,0,10)
Using simple trigonometric calculations we can get the ratio of needles dropped to needles crossing lines.
num/sum(crossing)
[1] 3.133814
Plot of estimate of \( \pi \) for each number of needles dropped, compared to actual value of \( \pi \) in red.