This is essentially a much harder version of this problem ( The expected value of days a miner will be stuck)

I understand the answers to that one but not sure how I would incorporate more than 1 step of find variance.

So the problem is:

A miner is stranded and there are two paths he can take.

Path A loops back to itself and takes him 5 days to walk it.

Path B brings him to a junction in 0 time. The junction at the end of Path B has 2 paths, say Path BA and Path BB.

Path BA brings him back to his original starting point and takes him 2 days to walk. Path BB brings him to safety and takes him 1 day to walk.

Each path has an equal probability of being chosen and once a wrong path is chosen, he gets disorientated and cannot remember which path it was and the probabilities remain the same.

What is the expected value of the amount of days he will spend before he exits the mine? What is the variance of the amount of days he will spend before he exits the mine.

I created this question based on the one already posted 2 years ago in order to understand the concept of conditioning better. Any solutions or help with this are greatly appreciated.


Miner can take route BB and escape in 1 day (2 correct decisions each with $\frac 12$ probability. $P(BB) = \frac 14$.

or he can take route BA and escape be back to his starting point in 2 days. $P(BA) = \frac 14$ or he can take route A and escape be back to his starting point in 5 days. $P(A) = \frac 12$

$P(A) + P(BB)+ P(BA) = 1$ which is good, we have covered all of the probabilities.

Finding $E[X]$ If he takes path $A$ Then his he wasted 5 days, and afterward his expected time to escape is still $E[X]$

$E[X] = \frac 12 (5 + E[X]) + \frac 14 (2 + E[X]) + \frac 14(1)$

And $E[X]= 13$


Suppose our minor chooses a wrong path. We exclude the good path, and he wastes $\frac 23\cdot 5 + \frac 13\cdot 2 = 4$ days

$E[X] = 1 + 4\cdot \frac 14\sum_\limits{n=1}^\infty n(\frac 34)^n = 1 + 4\frac {\frac 34}{(1-\frac 34)^2} = 13$

Variance $E[X^2] - E[X]^2 = E[(X-1)^2] + E[(X-1)]$

This adjustment takes off the one day to that it will definitely take to get out of the cave simplifies what follows

$E[(X-1)^2] = 4^2\cdot \frac 14\sum_\limits{n=1}^\infty n^2(\frac 34)^n\\ \sum_\limits{n=1}^\infty n^2 x^n = x\frac {1+x}{(1-x)^3}\\ E[(X-1)^2] = 16(\frac 14)(\frac {1+\frac 34}{(1 -\frac 34)^3}(\frac 34) = 336\\ E[(X-1)^2] - E[(X-1)]^2 = 336-144 = 192$

  • $\begingroup$ SO I completely understand your first solution for the expectation and this is how I did it but I get lost on the alternative solution because of which I can't understand the variance. Do you think you could expand on this a little? Or is there another way to find the variance similar to how you calculated the expectation originally? $\endgroup$ – doddy Oct 3 '17 at 18:27
  • $\begingroup$ There is some algebra for the summation of infinite series that I have employed. If you don;t know it, then it might take some explaining. Is that where I am losing you? Or do you follow the algebra but not the rationale? $\endgroup$ – Doug M Oct 3 '17 at 19:28
  • $\begingroup$ I follow the algebra, not the rationale. I was hoping to find a solution using the law of total variances because that is what prompted this problem but I'd be happy to understand your solution as well. $\endgroup$ – doddy Oct 3 '17 at 19:32

Here's a sketch: Suppose the walker chooses the wrong path at $B$ a total of $n_B$ times. Then he gets from $A$ to $B$ a total of $n_B + 1$ times; for each $j$, let $n_{A,j}$ be the number of times he takes the wrong path at $A$. Then $n_B$ and all of the $n_{A,j}$ are mutually independent geometric random variables with parameter $1/2$ and the total walking time is $$X = \sum_{i = 1}^{n_B + 1} 5 n_{A,i} + 2 n_B + 1.$$

From here, use conditional expectation and the law of total variance to get the mean and variance of this quantity.


For finding mean This question has an answer that has a similar format to finding the expected value of coin flips until we get however-many heads or tails in a row (I would suggest doing some research on that if you are unfamiliar.)

For this problem, the format could look something like this (assuming equally likely chances for paths $A$ and $B$ to be chosen as well as paths $BA$ and $BB$):

Let $E(x)$ be the expected value for the number of days the miner will be in the cave. This is equal to:

$$E(x) = 0.5\left(5 + E(x)\right) + 0.5(0.5)\left(2+E(x)\right) +0.5(0.5)(1)$$

All that is left is to solve for $E(x)$ which I will leave up to you :)


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.