3

Looking to find the expected value/variance of the following geometric variable defined as having success rate p, where trials are taken until we have a success (which happens with probability p) or we have taken n trials. Successfully calculated the expected value, and ideas on variance? Not sure how to proceed.

For expected value, first tried to use the definition of expectation (and LOE), but got a pretty ugly expression: $\sum_{i=1}^{n-1}{i(p)(1-p)^{i-1}} + n(1-p)^{n-1}$. Is there any nice formula/trick for solving this question?

John Li
  • 157
  • That sum probably has a well known closed form. Maybe using $E(X) = \sum_{i = 0}^{\infty}P(X > i)$ is simpler. – Mason Dec 05 '22 at 17:16
  • @Mason Does this work when the total amount of trials is bounded at n? – John Li Dec 05 '22 at 17:19
  • This works for any nonnegative integer valued $X$. – Mason Dec 05 '22 at 17:20
  • Wouldn't the bounds of i change then? – John Li Dec 05 '22 at 17:24
  • @John The bounds do not need to change to make the equation true, however in this case $\mathbf{P}(X > i) = 0$ for $i \ge n$ so you can rewrite it with different bounds to remove the trailing zeroes from the sum. – Sera Gunn Dec 05 '22 at 19:58

1 Answers1

3

So the most straightforward way to proceed from what you have is to use the fact that

$$ \sum_{i = 0}^{n - 1} x^i = \frac{1 - x^{n}}{1 - x}$$

So if you differentiate with respect to $x$ you get

$$ \sum_{i = 0}^{n} i x^{i - 1} = \frac{-nx^{n - 1}(1 - x) + (1 - x^{n})}{(1 - x)^2}.$$

Then you want to substitute $x = 1 - p$ and also multiply both sides by $p$. Admittedly, it's not the prettiest expression but it's not too bad either.

Sera Gunn
  • 27,981