Skip to content
Omnikalc

Buffon’s needle calculator

Enter the needle length, the line spacing, the number of throws and the observed crossings to get the probability that a needle crosses a line, the expected number of crossings, its spread and the estimate of pi.

Updated on
Your inputs
cm

Value out of range

cm

Value out of range

Value out of range

Value out of range

Results

Probability of crossing a line

0.47746

Expected crossings

477.5

Standard deviation of the crossings
15.80
Observed minus expected, in standard deviations
0.03
Estimate of pi (needle not longer than the spacing)
3.1381
Error of the estimate of pi
-0.11 %
Throws for a 1 % standard error on pi
10,944

The Buffon’s needle calculator gives the probability that a needle dropped on parallel lines crosses a line, the expected number of crossings, the standard deviation and the estimate of pi from the observed crossings, for a needle shorter or longer than the line spacing.

How the calculation works

  • Enter the needle length and the spacing between the lines.
  • Enter the number of throws and the crossings observed.
  • Read the probability, the expected crossings and the estimate of pi.

Example

A needle of 3 cm on lines 4 cm apart crosses a line with a probability of 0.47746. In 1000 throws, 477.5 crossings are expected, with a standard deviation of 15.80. The 478 observed crossings are 0.03 standard deviations from the expected value and give pi ≈ 3.1381, an error of -0.11 %.

Why it matters

The calculator helps probability students and teachers who run the experiment in class with a needle or a stick, programmers who write Monte Carlo simulations, and curious people who want to see why a random experiment gives a value of pi and how many throws it takes for a good estimate.

Good to know

The estimate of pi only works when the needle is not longer than the spacing, otherwise the output is zero. The needle and lines must be in the same unit, and the needle must land with a random position and angle. The estimate improves slowly, since the error shrinks with the square root of the number of throws. A result very close to pi after few throws is luck, not skill. The expected crossings are an average, and a given experiment can differ by a few standard deviations.

The probability calculator handles basic chances, the coin flip calculator treats repeated trials, the circle calculator gives the value of pi in context and the Stirling approximation calculator estimates factorials in large counts.

Frequently asked questions

What is Buffon’s needle problem?

In 1777 Buffon asked for the probability that a needle dropped at random on a floor of parallel lines crosses one of them. For a needle of length L not longer than the spacing d, the answer is 2L / (πd). With L = 3 and d = 4, the probability is about 0.4775, so about 477 of every 1000 throws cross a line.

How can the needle give an estimate of pi?

Since P = 2L / (πd), pi equals 2L × N / (d × H), where N is the number of throws and H the number of crossings. With 1000 throws and 478 crossings with L = 3 and d = 4, the estimate is about 3.138. It is one of the earliest Monte Carlo methods, though it converges slowly.

What if the needle is longer than the spacing?

The needle can then cross several lines, and the probability of crossing at least one line is (2/π) × [arccos(d/L) + (L/d) × (1 − sqrt(1 − (d/L)²))]. For L = 2 and d = 1, the probability is about 0.8372. The simple estimate of pi no longer applies in this case.

How many throws are needed?

The estimate of pi has a relative standard error of about sqrt((1 − p) / (N × p)). For a 1 % error with the example needle, about 11 000 throws are needed, and for 0.1 %, about 1.1 million. A famous result of 3.1415929 with 3408 throws, reported by Lazzarini, is not credible, because it was obtained by stopping at a lucky moment to get the ratio 355/113.

Was this calculator helpful?

Thanks for your feedback!

Results are estimates provided for information purposes. They do not replace professional advice.