TITLE: Average number of times it takes for something to happen given a chance
QUESTION [12 upvotes]: Given a chance between 0% and 100% of getting something to happen, how would you determine the average amount of tries it will take for that something to happen?
I was thinking that $\int_0^\infty \! (1-p)^x \, \mathrm{d} x$ where $p$ is the chance would give the answer, but doesn't that also put in non-integer tries?

REPLY [2 votes]: Here's an easy way to see this, on the assumption that the average actually exists (it might otherwise be a divergent sum, for instance).  Let $m$ be the average number of trials before the event occurs.
There is a $p$ chance that it occurs on the first try.  On the other hand, there is a $1-p$ chance that it doesn't happen, in which case we have just spent one try, and on average it will take $m$ further tries.
Therefore $m = (p)(1) + (1-p)(1+m) = 1 + (1-p)m$, which is easily rearranged to obtain $m = 1/p$.