Estimate Pi Empirically with Minimal Tools to Six Decimal Places
Statistics & ExperimentsModel answerLast updated
Design a die-and-cardboard Monte Carlo experiment that estimates π, then derive how many trials five to six correct decimal places demand and how to realistically get there.
Setup
You have exactly two items: a square piece of cardboard and a fair six-sided die (faces 1–6, each equally likely). You may also use a pen and a ruler to mark the cardboard.
Design a repeatable experiment that produces an empirical estimate of π. Then analyze what it would take to make that estimate accurate to five or six decimal places.
Part 1 — Design the experiment
Describe your procedure in enough detail that someone else could run it without asking you any questions. Your answer should cover:
- What you draw on the cardboard and what geometric relationship connects the drawing to π
- How a sequence of die rolls encodes one random point, and what it means for a trial to be a "success"
- The formula that turns your tally of successes into an estimate of π
- Why the expected value of that estimator equals π (or how close it is, if there is an irreducible bias)
- Any sources of bias in the procedure — coarse number resolution, non-uniform throws, edge effects — and how you handle them
Part 2 — Reaching five to six decimal places
Work through the numbers:
- Define your error tolerance and confidence level (the problem leaves these open — state what you choose and why)
- Derive the variance of your estimator and translate the precision target into a required trial count
- Comment on whether that count is physically feasible with a real die
- Describe at least two concrete techniques that would reduce the required trial count
- Explain why systematic errors set a hard floor that no number of additional trials can overcome, and name at least two sources of such error in your design
What a complete answer looks like
A strong response links π to a geometric probability, builds an unbiased (or near-unbiased) estimator, works out the $1/\sqrt{N}$ convergence rate, converts the decimal-place target into a specific $N$ with the arithmetic shown, and then honestly confronts the gap between that $N$ and what a human with a die can produce. The best answers pivot to variance reduction rather than just asking for more rolls.
Hints
Hint 1
Start by asking: what ratio of areas connects a circle to the square that contains it? That ratio involves π and it is directly estimable by counting.
Hint 2
A single die roll gives you one of six values. To generate a coordinate in [0,1] with finer resolution you can combine multiple rolls — think of them as digits in base 6. Work out how many rolls per coordinate you need to keep discretization error below your target.
Hint 3
Five correct decimal places means an absolute error below roughly 5×10⁻⁶. The standard error of a Monte Carlo proportion estimator is σ/√N. Compute σ for the circle-in-square estimator and solve for N — then react to that number rather than just stating it.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Part 1 — Experiment Design
Geometric foundation
Inscribe a circle of radius $r$ inside a square of side $2r$. The area of the circle is $\pi r^2$ and the area of the square is $4r^2$, so the probability that a uniformly random point inside the square falls inside the circle is
$$p = \frac{\pi r^2}{4r^2} = \frac{\pi}{4}$$
An unbiased estimate of $p$ multiplied by 4 gives an unbiased estimate of $\pi$.
Procedure
- Prepare the cardboard. Draw a square that fills most of the surface. Inscribe a circle tangent to all four sides. Mark the center and label the axes so you can measure coordinates.
- Generate one random point. A single die face gives a digit in ${1,2,3,4,5,6}$. Treat two consecutive rolls as a two-digit base-6 number, giving 36 equally spaced values. Map them to $[0,1)$ by dividing by 36. Roll twice for the $x$-coordinate, twice more for $y$. One trial costs four die rolls.
- Record the outcome. A point $(x, y)$ scaled to $[-1, 1]^2$ is a success if $x^2 + y^2 \leq 1$.
- Estimate π. After $N$ trials with $k$ successes: $\hat{\pi} = 4k/N$.
Why it converges to π
The mapping from die rolls to coordinates is uniform over a $6\times6$ grid in each axis, so over $36^2 = 1296$ grid cells per unit square. The probability that a grid cell falls inside the circle is exactly the fraction of cell centers satisfying $x^2+y^2\leq 1$. For large $N$ and fine grids, $\mathbb{E}[\hat\pi] \to \pi$. The discretization bias (cells that straddle the boundary are counted all-in or all-out) is of order $1/36$ per axis, giving a boundary-area bias on the order of $2\pi r \cdot (1/36) / (4r^2) \approx 0.044$. That is too large for six decimal places. To control it, increase resolution to three rolls per coordinate (216 values per axis), which shrinks the per-axis step to $\approx 0.005$ and the boundary bias to around $4\times10^{-5}$ — still not enough without further refinement, which is addressed below.
Common design mistakes
- Throwing the die onto the cardboard and using its landing position as the random point. Landing position depends on throwing mechanics and the surface, introducing physical bias that is very hard to quantify.
- Using a single die roll per coordinate. That gives only 6 grid points per axis; almost 5% of trials land on boundary-ambiguous cells.
Part 2 — Reaching Five to Six Decimal Places
Error tolerance and confidence level
Target: absolute error $|\hat\pi - \pi| < 5\times10^{-6}$ (five correct decimal places) at 99% confidence. For six places, tighten to $5\times10^{-7}$.
Variance and trial count
For the circle-in-square estimator, each trial is a Bernoulli($p$) with $p=\pi/4\approx0.785$. The variance of the proportion is $p(1-p)\approx0.168$, so
$$\text{Var}(\hat\pi) = 16\cdot\frac{p(1-p)}{N} \approx \frac{2.69}{N}$$
The standard deviation of $\hat\pi$ is $\sigma_{\hat\pi}\approx 1.64/\sqrt{N}$.
For 99% confidence the half-width of the interval is $2.576,\sigma_{\hat\pi}$. Setting that equal to $5\times10^{-6}$:
$$N = \left(\frac{2.576\times1.64}{5\times10^{-6}}\right)^2 \approx \left(\frac{4.22}{5\times10^{-6}}\right)^2 \approx 7.1\times10^{11}$$
That is 710 billion trials, each costing 6 die rolls: roughly 4.3 trillion rolls. By hand, at 1 roll per second, that is over 130,000 years. Clearly infeasible physically; the real tool is a computer with a high-quality PRNG.
For six decimal places ($h=5\times10^{-7}$), multiply $N$ by 100: about $7\times10^{13}$ trials — still tractable on modern hardware in minutes, but not by hand.
Variance reduction techniques
Antithetic variates. For each sampled point $(x,y)$, also evaluate its reflection $(-x,-y)$. The two outcomes are negatively correlated, reducing variance roughly 30% for this geometry, so about 30% fewer trials needed for the same precision.
Stratified (quasi-random) sampling. Replace pseudo-random points with a low-discrepancy sequence such as Halton or Sobol. These fill the unit square far more evenly, reducing the effective error from $O(N^{-1/2})$ to $O((\log N)^d / N)$. In practice this cuts the required $N$ by several orders of magnitude and is the standard production approach.
Control variates. Use a known analytic area (e.g., a triangle inside the square) as a correlated correction term to absorb some estimation noise.
Systematic error floor
No amount of additional trials eliminates systematic errors:
- Discretization bias. The grid approximation of the circle boundary introduces a fixed bias proportional to $1/(\text{grid resolution})$. With three rolls per axis (216 steps) the bias is around $10^{-5}$, which dominates at five decimal places. You need at least five rolls per axis (7776 steps) to push discretization below $10^{-6}$.
- PRNG periodicity. A poor random number generator has correlations that bias the point density in structured ways. Use a cryptographically strong or well-tested generator (e.g., Mersenne Twister or PCG) with a period far exceeding $N$.
- Floating-point rounding. The boundary test $x^2+y^2\leq1$ can misclassify points within machine epsilon of the circle. For most precisions this is negligible, but worth noting at six decimal places.
Reporting the result
Always report a confidence interval, not just a point estimate:
$$\hat\pi \pm z_{0.995},\sqrt{\frac{\hat\pi(4-\hat\pi)}{4N}}$$
A single number without an interval is an incomplete answer to a precision question.