---
title: Unbiased Coin-Flipping Estimators
url: https://www.emergentmind.com/topics/unbiased-coin-flipping-estimators
type: topic
---

# Unbiased Coin-Flipping Estimators

Unbiased coin-flipping estimators are algorithmic constructs in which random coin flips—often of biased coins—are used to construct unbiased statistical estimators for quantities of analytic, geometric, or probabilistic significance. Recent advances exploit first-passage properties in biased random walks to yield highly efficient, coin-only estimators for transcendental constants such as π, leveraging explicit probabilistic and combinatorial analysis of the stopping times and win frequencies of such walks. This approach offers dramatic improvements in variance and sample complexity compared to classical methods, and admits exact closed-form integral and finite-sum solutions for both the expectation and variance of the underlying estimators [2512.21254].

## 1. Probabilistic Model: First-Passage Time in Biased Simple Random Walks

Let $\{X_n : n \geq 1\}$ be i.i.d. random variables with $P[X_n=+1]=p$, $P[X_n=-1]=q=1-p$, with $p \in[1/2,1)$. The simple random walk $S_n$ is given by
$$
S_0 = 0,\quad S_n = \sum_{k=1}^n X_k,\quad n \geq 1.
$$
For an integer $d \geq 1$, the first-passage time to $d$ is
$$
N_d = \inf\{n \geq 0 : S_n = d\}.
$$
At stopping, the number of $+1$ steps (“wins”) is $R_{N_d} = \#\{1 \leq i \leq N_d : X_i=+1\}$, and the normalized win rate is $R_{N_d}/N_d$.

## 2. Exact Integral Formulas for Expectation and Variance

The core relation
$$
S_{N_d} = d = 2R_{N_d} - N_d \implies \frac{R_{N_d}}{N_d} = \frac{1}{2} + \frac{d}{2N_d}
$$
yields that
$$
E\left[\frac{R_{N_d}}{N_d}\right] = \frac{1}{2} + \frac{d}{2} E[N_d^{-1}], \qquad
\mathrm{Var}\left(\frac{R_{N_d}}{N_d}\right) = \frac{d^2}{4}\Big(E[N_d^{-2}] - E[N_d^{-1}]^2\Big).
$$
Closed-form integral representations are available via the identity $1/n = \int_0^1 t^{n-1}dt$ and leveraging the generating function for the first-passage time. For $h_p(u) = \frac{p-qu^2}{p+qu^2}$ and $\ell_p(u) = \log\left(\frac{p+q\,u^2}{u}\right)$,
$$
E[N_d^{-1}] = \int_0^1 u^{d-1} h_p(u) du,
$$
$$
E[N_d^{-2}] = \int_0^1 u^{d-1} h_p(u) \ell_p(u) du.
$$
Thus,
$$
E\left[\frac{R_{N_d}}{N_d}\right] = \frac{1}{2} + \frac{d}{2} \int_0^1 u^{d-1} h_p(u) du,
$$
$$
\mathrm{Var}\left(\frac{R_{N_d}}{N_d}\right) = \frac{d^2}{4} \left\{ \int_0^1 u^{d-1} h_p(u) \ell_p(u) du - \left(\int_0^1 u^{d-1} h_p(u) du\right)^2 \right\}.
$$
These formulas (Theorem 1) are valid for all $d \geq 1$ and $p \in [1/2,1)$ [2512.21254].

## 3. Construction of Unbiased Estimators for $\pi$

For $p=q=1/2$ (fair coin), the expectation reduces to
$$
E\left[\frac{R_{N_d}}{N_d}\right] = \frac{1}{2} + \frac{d}{2} \int_0^1 u^{d-1} \frac{1-u^2}{1+u^2} du,
$$
with
- $d=1$: $\int_0^1 \frac{1-u^2}{1+u^2} du = \frac{\pi}{4}$
- $d=2$: $\int_0^1 u \frac{1-u^2}{1+u^2} du = \log 2$
- $d=3$: $3(1 - \frac{\pi}{4})$, etc.
For all odd $d$, closed forms employing arctangent are available:
$$
E\left[\frac{R_{N_d}}{N_d}\right] = 1 - d \sum_{k=0}^{\frac{d-1}{2}} \frac{(-1)^k}{d-2k} + (-1)^{(d-1)/2} d\, \arctan(1).
$$
Setting $\arctan(1) = \pi/4$ and rearranging yields an *unbiased estimator of $\pi$*:
$$
\widehat{\pi}_d := (-1)^{(d-1)/2} \frac{4}{d}\left\{\frac{R_{N_d}}{N_d} - \left[ 1 - d \sum_{k=0}^{(d-1)/2} \frac{(-1)^k}{d-2k}\right] \right\}
$$
with $E[\widehat{\pi}_d] = \pi$.

Variance follows as
$$
\mathrm{Var}(\widehat{\pi}_d) = \frac{16}{d^2} \mathrm{Var}\left(\frac{R_{N_d}}{N_d}\right).
$$
For $p \neq 1/2$, similar formulas apply. A key optimization is to use a bias $p = 3/4$ (i.e. $q/p=1/3$), so that
$$
\arctan(\sqrt{q/p}) = \frac{\pi}{6},\quad \pi = 6\,\arctan(\sqrt{1/3}),
$$
leading to a corresponding family of estimators (Theorem 3 of [2512.21254])
$$
\widetilde\pi_d := (-1)^{(d-1)/2} \frac{6}{3^{d/2} d}\left\{ \frac{R_{N_d}}{N_d} - \left[1 - d \sum_{k=0}^{(d-1)/2} \frac{(-3)^k}{d-2k} \right] \right\}
$$
with $E[\widetilde\pi_d]=\pi$.

## 4. Monotonicity, Parameter Regimes, and Variance-Cost Trade-off

Expectation $E[R_{N_d}/N_d]$ is strictly decreasing in $d$ for fixed $p$, and strictly increasing in $p$ for fixed $d$; as $d\to\infty$, $E[R_{N_d}/N_d] \rightarrow p$ and variance $\rightarrow 0$. Higher $d$ yields smaller variance at the cost of increased sample complexity.

For $p=3/4$, the expected number of coin flips is
$$
E[N_d] = \frac{d}{2p-1} = 2d,
$$
significantly less than for $p=1/2$, for which $E[N_d]=\infty$ due to heavy tails. The variance of $\widetilde\pi_d$ decays exponentially in $d$, implying the sample size for achieving MSE $\epsilon^2$ grows as $\log(1/\epsilon)$, in contrast to the $\epsilon^{-2}$ requirement for i.i.d. averaging [2512.21254].

To minimize computational cost for a selected variance, $p$ should be as close to $1$ as possible, subject to $\arctan(\sqrt{q/p})$ rationally related to $\pi$ to maintain an exact inversion for unbiasedness.

## 5. Comparison to Classical Coin-Based Estimation

Classical unbiased estimators of $\pi$, such as Buffon's needle and mechanical devices, require real-valued function evaluations and do not exploit the strong algebraic structure of random walk first-passage times, resulting in much slower convergence. The coin-only estimators derived from first-passage win rates achieve exponentially accelerated convergence and reduced mean sample complexity, offering a significant improvement in purely combinatorial and coin-flip-based estimation of transcendental numbers [2512.21254].

## 6. Multi-Party Unbiased Coin-Flipping Protocols

In cryptographic and distributed computing contexts, fair multi-party coin-flipping protocols aim to output unbiased bits even under adversarial conditions. The protocol family constructed in [2104.08820] achieves an $O(t^4 2^t \sqrt{\log m}/m^{1/2+1/(2^{t-1}-2)})$ bias for $t$ parties and $m$ rounds, generalizing previous two- and three-party fair coin-flipping results. Protocols use secret sharing, defense shares, and resilient "defense-quality" functions to amplify fairness under adversarial aborts and deviations, exploiting online binomial game reductions and linear programming duality to tightly bound the achievable bias.

A plausible implication is that the algorithmic techniques for multi-party coin-flipping bias analysis, especially those using binomial processes and robust handling of adaptive adversarial leakage, bear methodological similarities to the probabilistic analysis of first-passage estimators—although the direct construction of analytic estimators for transcendental constants is a distinct problem area. Both domains illustrate advanced exploitation of underlying coin-flip process structure for statistical efficiency or cryptographic fairness [2104.08820].

## 7. Summary Table: Key Estimator Features

| Estimator               | Coin Bias  $p$      | Expectation Formula                                | Variance Rate             | Mean Flips     |
|-------------------------|---------------------|----------------------------------------------------|---------------------------|----------------|
| $\widehat{\pi}_d$       | $1/2$               | $\pi/4$ for $d=1$, general closed form for odd $d$ | $\exp(-\Theta(d))$        | $\infty$       |
| $\widetilde{\pi}_d$     | $3/4$               | Explicit sum and arctan $(\pi/6)$                  | $\exp(-\Theta(d))$        | $2d$           |

The key advantages of unbiased coin-flipping estimators derived from first-passage random walk statistics are exact analytical tractability, dramatic variance minimization through bias selection, and highly efficient convergence to $\pi$ or related constants, setting a new standard for combinatorial random estimation [2512.21254].

Source: https://www.emergentmind.com/topics/unbiased-coin-flipping-estimators