Posted on June 19, 2026
A calculator is suspected to be "tanked": instead of generating numbers uniformly on \([0,1]\), it only generates numbers uniformly on \([0,a]\) for some unknown \(0 < a < 1\). The value of \(a\) is equally likely to be anything in \([0,1]\) - a uniform prior.
The calculator produces a single number: exactly \(0.5\). Based on this result, what is the expected value of \(a\)?
This is a Bayesian update. Write the prior as \(f(a) = 1\) for \(a \in [0,1]\). Given a tanked calculator with parameter \(a\), each number is drawn uniformly on \([0,a]\), so the likelihood of observing \(x = 0.5\) is
\[ f(x = 0.5 \mid a) = \begin{cases} \dfrac{1}{a} & a \ge 0.5, \\ 0 & a < 0.5. \end{cases} \]
Numbers below \(a\) are impossible, so the observation immediately rules out \(a < 0.5\). By Bayes' theorem, the posterior is
\[ f(a \mid x = 0.5) \propto \frac{1}{a} \cdot 1 = \frac{1}{a}, \qquad a \in [0.5, 1]. \]
Normalizing:
\[ \int_{0.5}^{1} \frac{1}{a}\,da = \ln(1) - \ln(0.5) = \ln 2. \]
So the posterior density is \(f(a \mid x = 0.5) = \dfrac{1}{a \ln 2}\) on \([0.5, 1]\). The posterior mean is
\[ \mathbb{E}[a \mid x = 0.5] = \int_{0.5}^{1} a \cdot \frac{1}{a \ln 2}\,da = \frac{1}{\ln 2} \int_{0.5}^{1} 1\,da = \frac{0.5}{\ln 2} = \frac{1}{2\ln 2}. \]
The key intuition is that the posterior density \(1/a\) over-weights small values of \(a\), since a smaller \(a\) makes the observation \(x = 0.5\) more surprising (less likely) — wait, actually the opposite: a smaller \(a\) just above \(0.5\) makes \(0.5\) more probable per unit length. But the averaging over \(a\) cancels perfectly, giving a flat integrand and a mean exactly halfway through \([0.5, 1]\).
Answer: \(\displaystyle\boxed{\frac{1}{2\ln 2}}\), approximately \(0.7213\).
This is the continuous, single-observation analogue of the German tank problem, which estimates the upper bound of a uniform distribution from observed samples. The bounded prior on \(a\) is essential: with an unbounded prior the posterior mean would diverge for a single observation.
A second calculator is also suspected to be tanked, again with \(a\) uniform on \([0,1]\). A friend generates one number but won't reveal it exactly — only that it lies somewhere between \(0\) and \(0.5\). On average, what is \(a\) for this second calculator?
Now the observation is the event \(E = \{x \in (0, 0.5)\}\) rather than a specific value. The likelihood of this event given \(a\) is
\[ P(E \mid a) = \begin{cases} 1 & a \le 0.5, \\ \dfrac{0.5}{a} & a > 0.5. \end{cases} \]
If the tanked range \([0,a]\) fits entirely inside \([0, 0.5]\), then every draw lands in \((0, 0.5)\) with certainty. If \(a > 0.5\), the draw is uniform on \([0,a]\) and falls in \((0, 0.5)\) with probability \(0.5/a\).
The posterior is proportional to \(P(E \mid a)\) times the flat prior:
\[ f(a \mid E) \propto \begin{cases} 1 & a \in (0, 0.5], \\ \dfrac{0.5}{a} & a \in (0.5, 1]. \end{cases} \]
Normalizing constant:
\[ C = \int_0^{0.5} 1\,da + \int_{0.5}^{1} \frac{0.5}{a}\,da = 0.5 + 0.5\bigl[\ln(1) - \ln(0.5)\bigr] = 0.5 + 0.5\ln 2 = \frac{1 + \ln 2}{2}. \]
The posterior mean is
\[ \mathbb{E}[a \mid E] = \frac{1}{C}\left[\int_0^{0.5} a\,da + \int_{0.5}^{1} a \cdot \frac{0.5}{a}\,da\right] = \frac{1}{C}\left[\frac{a^2}{2}\bigg|_0^{0.5} + 0.5 \cdot 0.5\right] = \frac{1}{C}\left[0.125 + 0.25\right] = \frac{0.375}{C}. \]
Substituting \(C = (1 + \ln 2)/2\):
\[ \mathbb{E}[a \mid E] = \frac{0.375}{\tfrac{1+\ln 2}{2}} = \frac{0.75}{1 + \ln 2} = \frac{3}{4(1 + \ln 2)}. \]
Comparing to the main answer \(1/(2\ln 2) \approx 0.721\): here the expected \(a\) is pulled below \(0.5\) because the friend's observation is consistent with \(a \le 0.5\) (where it would hold with certainty), so the posterior puts significant mass on small values of \(a\).
Extra credit answer: \(\displaystyle\boxed{\frac{3}{4(1+\ln 2)}}\), approximately \(0.4430\).
Set a true value of a and number of draws, generate samples from [0, a], and see the posterior for a update.
Set true a, a threshold L, and number of draws. The simulator generates k draws from [0, a] but only reveals how many fell below L - generalising the extra credit to adjustable thresholds and multiple observations.