Trouble finding the expected value of a random variable

102 Views Asked by At

Suppose that we have a procedure A that we run once and it returns as a result either success or failure. Our goal is to run A as many times as needed in order to receive success. Given that the probability of a success is $\geq \frac{1}{2}$ we would like to find what is the expected number of times that we will have to run the procedure before getting a success result.

We have

$Pr[A = success] \geq \frac{1}{2} \Rightarrow Pr[A = failure] \leq \frac{1}{2}$

Now the question can be transformed to, what is the expected number of failures that we will get before getting a success?

$Pr[\texttt{get i failures}] \leq \frac{1}{2^{i}}$

By applying the expectation as defined on wikipedia we get:

$E[\#failures] \leq \sum_{i=1}^{\inf} i\frac{1}{2^{i}} = 2$

however I can not understand why my professor during the lecture ignored the $i$ term in that summation, so he says that the answer should be $\sum_{i=1}^{\inf} \frac{1}{2^{i}} = 1$

What am I doing wrong?

1

There are 1 best solutions below

0
On BEST ANSWER

Let $X$ be the number of failures before the first success. Then $X$ takes on only non-negative integer values. For such a random variable $X$, we have $$E[X]=\sum_{i=1}^\infty \Pr(X\ge i).$$ For a proof, please see Wikipedia.

If the probability of failure is $q$, then $\Pr(X\ge i)=q^i$. In our case $q\le 1/2$, so $$E[X]=\frac{q}{1-q}\le 1.$$

One can also get to the expected value of the number of failures before the first success by using your calculation. The expected number of failures before the first success is one less than the number of trials until the first success. So to estimate the mean number of failures, subtract $1$ from the mean number of trials. Your sum $\sum_{i=1}^\infty \frac{i}{2^i}$ calculated an upper bound on the expected number of trials.