# Understanding of expected value with summation

I got a problem with a question.

The question is as follows:

There is a person that needs to open 3 locks. In total got he got 11 keys, but he forgot what key belongs to what lock, so he is going to try all the keys, but the problem is everytime he tries a key he forget that he used that key. So it could be possible that the first locks he opens with 100 tries, the second lock with 4 keys and the third with only 1 key.

I need to answer the following question:

Show that X is the total times keys he tries. What is P(X=k) in k∈N? What is the expected value?

My problem with this question is that I’m sure how to do this, because I can’t calculate the answer, because I do not now how many time he is going to try. For now I got the following answer:

But I’m not sure if that’s correct. Could anybody tell me if this is correct? If you need to know of how I got to this answer, please ask.

• Your answer looks peculiar. You are supposed to find $P(X=k)$ and not $P(3X=k)$. Maybe it was inspired by $X=X_1+X_2+X_3$ hence $P(X=k)=\sum_{p+q+r}P(X_1=p)P(X_2=q)P(X_3=r)$? Anyhow, the second equation is not correct. – drhab May 6 '15 at 12:58
• Danique, please check out this handy reference for formatting your mathematics: meta.math.stackexchange.com/questions/5020/… The first two paragraphs or so are probably enough to fix your typesetting here. – TravisJ May 6 '15 at 13:39
• Thank you for the reference for formatting my math. Next I will use it. Thanks:) – Danique May 7 '15 at 8:49

I preassume that opening a lock does not change the situation so that by every try there is a probability of $\frac1{11}$ that a lock is unlocked.
For $k\geq3$ observe that $X=k$ iff there are $k$ tries of wich the last is succesful and exactly $2$ of the preceding $k-1$ tries have been succesful. The tries are independent and all have a probability of $\frac1{11}$ to be succesful. There are $\binom{k-1}2$ possible orderings and we come to a probability of $$P(X=k)=\binom{k-1}2\left(\frac1{11}\right)^3\left(\frac{10}{11}\right)^{k-3}$$
Based on this you find the expectation, but there is a shortcut for that. We can write $X=X_1+X_2+X_3$ where $X_1$ is the number of tries needed to unlock the first lock, $X_2$ the number of tries after that needed to unlock the second and $X_3$ for the number of tries needed to unlock the third. Then $\mathbb EX=\mathbb EX_1+\mathbb EX_2+\mathbb EX_3=3\mathbb EX_1$. The first equality on base of the linearity of expectation and the second on symmetry.
Now it remains to calculate $\mathbb EX_1$. Let $S$ denote the event that the first try is a succes and let $F$ denote the event that the first try is a failure. Then $$\mathbb EX_1=\mathbb E(X_1\mid S)P(S)+\mathbb E(X_1\mid F)P(F)=1.\frac1{11}+(1+\mathbb EX_1).\frac{10}{11}$$ This leads to $\mathbb EX_1=11$ and $\mathbb EX=33$.