Expected number of picked balls Suppose I have a bag of 4 balls, labeled A, B, C and D. I pick a ball randomly from the bag. If it’s A, B or C, I’ll stop. Otherwise I put the D ball back and pick again. What is the expected number of balls I’ll pick?
Somehow I know the answer is 4/3, but I can’t get to the answer.
I also know it’s the sum
$$1\times\frac{3}{4}+2\times\frac{1}{4}\times\frac{3}{4}+3\times\left(\frac{1}{4}\right)^2\times\frac{3}{4}+4\times\left(\frac{1}{4}\right)^3\times\frac{3}{4}+\cdots.$$
But I can’t evaluate it.
 A: You could use a recursive equation: $E[X] = \frac{3}{4}(1) + \frac{1}{4}(1 + E[X])$.
The left-hand side is obviously just the expected # of balls picked; the right-hand side however represents the same quantity, as the first term contains the expected value given that the first ball is A, B, or C and the second term contains the expected value given that the first ball is D, each multiplied by its respective probability.
Simplify & solve and you get $E[X] = \frac{4}{3}$.
You can observe the parallels between such a solution and solving the geometric series: both rely on the memorylessness of the process.
A: I read this answer from this website. The expectation is
$$E(X)=\frac34\sum_{k>0}k\left(\frac14\right)^{k-1}.$$
The sum on the right hand side is of the form:
$$\sum_{k>0}k(1-x)^{k-1},\tag{1}$$
where $x=3/4$. Integrating the expression, we get
$$C-\sum_{k>0}(1-x)^k,$$
of which the sum is a geometric series. So the value of the expression is
$$C-\frac{1-x}{1-(1-x)}=C+\frac{x-1}{x}=C+1-\frac1x.$$
Differentiate this back and get $1/x^2=16/9$ as the value of the original sum (1). Substitute it back and obtain the expectation as
$$E(X)=\frac34\cdot\frac{16}9=\frac43.$$
A: Here's an easier way to do it.
If we let $X$ be a variable representing the number of balls that were picked, then it is clear that $X$ is a geometric random variable with a $3/4$ probability of "success". In this case, success indicates picking one of the three balls: A, B, or C. One property of geometric distributions is that the expected value for the number of trials needed to obtain the first success, which is denoted as $E(X)$, is $1/p$, where $p$ is the probability of success. In this case, $p=3/4$, so $E(X)=1/(3/4)=4/3$.
