0

Disclaimer: I want solution verification unless a technique very similar to mine has been posted elsewhere, please do NOT mark this as a duplicate. This problem has been solved before on this website, however, I felt the need to craft my own solution, but have encountered a little roadblock.

The Problem

What is the expected amount of numbers -- such that each number is randomly selected from a uniform distribution over $(0, 1)$ -- to first exceed a sum of 1 when added together?

My approach

Let $X$ be a random variable that counts the number of numbers until we achieve a sum $\geq 1$. We know that $$ P(X = x) =\ P(sum\ of\ first\ x - 1\ items< 1)\cdot P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) \\$$ $$\ P(sum\ of\ first\ x - 1\ items< 1) = 1 - P(sum\ of\ first\ x - 1\ items\geq 1) \\$$ $$P(sum\ of\ first\ x - 1\ items\geq 1) = 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} $$ Note that $P(sum\ of\ first\ x - 1\ items\geq 1) \neq P(X = x- 1)$ because the sum may exceed 1 because of any number in the set $\{n_1, n_2, ..., n_{x-1}\}$.

Also, $\biggl (1-\frac{1}{x-1} \biggr)$ represents the chance that the $i^{th}$ item is larger than or equal to the average of the sum $[letting\ \overline n = average\ of\ any\ x-1\ numbers\ that\ sum\ upto\ exactly\ 1]$:

$$\\ (n_1\ +\ n_2\ +\ ...\ +\ n_{x-1} < 1)\ \leftrightarrow\ \lnot(n_1\geq\overline n\ \land\ ...\ \land\ n_{x-1} \geq\overline n) \\ $$

$$P(n_i \geq\overline n) = \ 1-\overline n ,\ as\ n_i\ comes\ from\ U(0, 1)\ ;1\leq i \leq x-1 \\$$

$$\overline n,\ by\ our\ definition,\ = \frac{1}{total\ number\ of\ numbers} = \frac{1}{x-1} \\$$

Repeatedly iterating this probability for all $i$ (for all items in the set that we have been counting, except the last one), we get $\biggl (1-\frac{1}{x-1} \biggr)^{x-1}$. Taking then complement gives us the expression for $P(sum\ of\ first\ x - 1\ items< 1)$. $$ \\ $$

A similar method follows for $P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1)$, as the $x^{th}$ item or $n_x$ must be greater than $\overline n$ to exceed a sum of 1 (as we previously derived), yields:

$$ P(x^{th}\ number\ pushes\ the\ sum\ to\ \geq 1) = 1 - \frac{1}{x-1} \\$$

Overall, we get: $$\\ P(X = x) = \Biggl( 1-\biggl (1-\frac{1}{x-1} \biggr)^{x-1} \Biggr) \cdot \biggl( 1 - \frac{1}{x-1} \biggr) \\ $$

$$E[X] = \sum_{x} xP(X=x)\ \ \ for\ \ \ x>1\\$$

The issue

Upon computing $E[X]$ using a calculator, $E[X]$ diverges. This does not make sense as there is a trivially small chance of getting a huge sequence of small numbers in the range $(0, 1)$ and NOT getting a single number high enough to exceed a sum of 1. Not sure where I am wrong; would appreciate any help.

  • 1
    I'd check your calculator work. We expect half the selected numbers to be greater than $\frac 12$ so $E[X]$ ought be $<4$ (as it happens, it is $e$). – lulu Aug 25 '20 at 17:52
  • here is another duplicate. – lulu Aug 25 '20 at 17:53
  • 1
    The poster stated in the first line it is a duplicated but wanted a proof verification, if I understood correctly. I would vote not to close this post. – cr001 Aug 25 '20 at 18:01
  • @lulu I double (even triple)-checked the calculator work on $E[X]$, it does seem to diverge. The other post you mentioned had a similar set-up, but had a different approach. As cr001 said, I'd like to find where the error in MY approach is. – Fragondruit Aug 25 '20 at 19:06
  • 1
    I have reopened the question. I don't have time to look at your method right now, but will try to later. – lulu Aug 25 '20 at 21:27
  • 1
    Quick review: I don't understand your formula for $P(\text {sum of first $x-1$ terms}≥1)$.

    Say $x=2$ Your formula yields $1-\left(1-\frac 1{2-1}\right)^{2-1}=1$, yes? But this is clearly false.

    – lulu Aug 25 '20 at 21:34
  • In any case, if you had that probability it would be easy to compute the probability that the desired threshold is $x$...just take the difference between successive terms of your function. I think the solution provided by Robert Israel here has the strong advantage of actually computing the probability that the last term is the $n^{th}$. – lulu Aug 25 '20 at 21:43
  • 1
    And just to add one point: taking $x\to \infty$ we'd get $1-\frac 1e\approx .632$ which makes no sense...of course that limit has got to be $1$ since, inevitably, the sum will cross $1$. – lulu Aug 25 '20 at 22:31
  • @lulu I figured out the error. The claim $\ (n_1\ +\ n_2\ +\ ...\ +\ n_{x-1} < 1)\ \leftrightarrow\ \lnot(n_1\geq\overline n\ \land\ ...\ \land\ n_{x-1} \geq\overline n) \$ does NOT hold true. In fact, it's more like $LHS \leftarrow RHS$, with a one-way implication. Thanks for the hints. – Fragondruit Aug 27 '20 at 02:07

0 Answers0