I understand why the expected number of trials until there is a success is given by

$$ \sum_{i=0}^{\infty} i p q^{i-1} \ = \ E[\text{number of trials until} \ X=1] = \frac{1}{p} $$

where $p$ is the probability of success and $X=1$ denotes the first success. However, I have different problem. In my setting, after the $n$th trial there will be success with probability 1. The probability of a success happening at the $i$th period [before n periods] is $p(1-p)^{i-1}$. I suspect that the expected amount of trials until success is given by

$$ p + 2p(1-p) + 3p(1-p)^2 + ...+ np(1-p)^{n-1} $$

I am not sure if the correct answer is either

$$ \frac{1-(1-p)^n}{p} $$


$$ \frac{1-(1-p)^n}{p} -n(1-p)^n $$

I have tried using a few partial sum tricks and forcing the addition of probabilities equal to one in the following way:

$$ \sum_{i=0}^{n} p (1-p)^{i-1} + (1-p)^{n-1} \ = 1 $$

But I am not sure if this is the right way to even approach the question. How can I calculate the expected value of trials until the first success when I know that at a some $n$th period there will be success with probability 1?

  • $\begingroup$ You say "after the nth trial" probability is 1". But if success definitely occurs at exactly trial number n, it would seem the sample space would be the integers from 1 to n (a finite sample space). If so the presence of a 1 at trial n would force the previous trial probabilities to be each 0 in order that the sum of probabilities over the sample space be 1. $\endgroup$
    – coffeemath
    Jan 3 '16 at 4:23
  • $\begingroup$ Maybe it should be framed as a conditional probability given that success occurs on or before trial n, and then use expected value for that conditional distribution. $\endgroup$
    – coffeemath
    Jan 3 '16 at 4:25
  • $\begingroup$ How could I express it as a conditional expectation? I suspect I have to divide by something so as to correct the support of the distribution, but what would that be. Also, what would even be the pdf of such a distribution? Also, I made a few edits above. $\endgroup$
    – Sophie
    Jan 3 '16 at 4:34
  • 1
    $\begingroup$ So if there has been no success before the $n$-th trial, there is success for sure on the $n$-th? If so the last term should be $n(1-p)^{n-1}$. Apart from this term, you have a finite arithmetico-geometric series, and there is a clsed form for the sum. $\endgroup$ Jan 3 '16 at 4:46
  • $\begingroup$ Andre, do you mean that last term should go into my last expression, that one I equalized to 1? Or the one above [that one has in its first term a finite geometric series]? $\endgroup$
    – Sophie
    Jan 3 '16 at 5:16

Define the random variable $X = \sum_{i \leqslant n}i{\bf 1}_{\{\text{1st success on trial }i\}}$ , so that the expectation is computed as follows: $$\mathbb E[X] = \mathbb E[\sum_{i \leqslant n}i{\bf 1}_{\{\text{1st success on trial }i\}}] = \sum_{i \leqslant n}\mathbb E[i{\bf 1}_{\{\text{1st success on trial }i\}}] = \sum_{i \leqslant n}i{\bf P}[{\text{1st success on trial }i}] \\ = \sum_{i < n}i(1-p)^{i-1}p + n(1-p)^{n-1} = \frac{1-(1-p)^{n-1}(1+(n-1)p)}{p} + n(1-p)^{n-1}.$$

That is,

$$ \mathbb E[X] = \frac{1-(1-p)^{n-1}(1+(n-1)p)}{p} + n(1-p)^{n-1} $$

The form of $\mathbb E[X]$ can be simplified further, since $$\mathbb E[X] = \frac{1-(1-p)^{n-1}(1+(n-1)p)}{p} + n(1-p)^{n-1} = \frac{1-(1-p)^{n-1}(1+(n-1)p - np))}{p} = \frac{1-(1-p)^n}{p}$$ Therefore,

$$ \mathbb E[X] = \frac{1-(1-p)^n}{p} $$

  • $\begingroup$ Just to make sure, shouldn't the last term on the right hand side be divided by p? Also, Shouldn't the first term be $\frac{1-(1-p)^{n-1}(1+n(p-1))}{p}$? $\endgroup$
    – Sophie
    Jan 3 '16 at 5:54
  • $\begingroup$ @Sophie No, the last term does not need to be divided by $p$. If, however, one wishes to have a $p$ in the denominator, one may write it as $np\frac{(1-p)^{n-1}}{p}$. And no, the first term should not be as you suggested; your suggestion gives an incorrect answer when $n=1$. $\endgroup$
    – ki3i
    Jan 3 '16 at 13:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.