Moment generating function. A miner is trapped in a mine containing 3 doors.

565 Views Asked by At

A miner is trapped in a mine containing 3 doors. The first door leads to a tunnel that will take him to safety after 3 hours of travel. The second door leads to a tunnel that will return him to the mine after 5 hours of travel. The third door leads to a tunnel that will return him to the mine after 7 hours. If we assume that the miner is at all times equally likely to choose any one of doors, what is the expected length of time until he reaches safety?

I did it normally but I have been asked to solve through moment generating function. I don't know how to proceed

2

There are 2 best solutions below

0
On

If you have a random variable $T$ with moment generating function $M_T(s) = \mathbb{E}[e^{Ts}]$, then its moments can be recovered by $\mathbb{E}[T^k] = M_T^{(k)}(0)$ (where this is the $k$th derivative). So if you want to compute the expected length of time using the MGF, you can compute the MGF, take the first derivative, and sub in zero. (This is probably a bit more complicated than it needs to be given that you can compute the expected value quite easily, as you have done.)

0
On

Let $X$ be the random variable denoting the length of time to reach safety. Let's name the events corresponding to the visits to the doors as $D_3$ and $D_5$ and $D_7$, respectively, then any sequence leading to safety can be denoted by the regular expression "$(D_5|D_7)^*D_3$", i.e., any number of visits (including $0$) to doors 5 or 7, followed by the last visit to door 3.

The following figure shows a DFA which we can be used to conceptualize / visualize the state transitions for above problem (with intermediate / transient states $D_5$, $D_7$ and final / absorbing state $D_3$ corresponding to the safe exit, start state can be any one of the states):

![enter image description here

We have the following pmf of X (keeping in mind that at any point in time choosing the doors $D_3$, $D_5$ and $D_7$ are equally likely with probability $\frac{1}{3}$):

$P(X=3)=\frac{1}{3}$ (1-step exit probability, corresponding to $D_3$)

$P(X=5+3)=P(X=7+3)=\frac{1}{3^2}$ (2-step exit probability, $D_5D_3$ and $D_7D_3$)

$P(X=2.5+3)=P(X=2.7+3)=\frac{1}{3^3}$ (for $D_5D_5D_3$ and $D_7D_7D_3$) and $P(X=5+7+3)=\frac{2}{3^3}$ (for $D_5D_7D_3$ and $D_7D_5D_3$) (3-step exit probability)

$P(X=3.7+3)=P(X=3.5+3)=\frac{1}{3^4}$ and $P(X=5+2.7+3)=P(X=7+2.5+3)=\frac{3}{3^4}$ (4-step exit probability)

$P(X=4.7+3)=P(X=4.5+3)=\frac{1}{3^5}$, $P(X=5+3.7+3)=P(X=7+3.5+3)=\frac{4}{3^5}$ and $P(X=2.5+2.7+3)=\frac{6}{3^5}$ (5-step exit probability)

$\ldots$

Now, let's generalize the expression for the $k$-step exit probability.

Obviously, such a sequence will be of length $k$, consisting of total $k-1$ length-$5$ or length-$7$ paths, followed by a single length $3$ path.

(1) The number of possible length-$(k-1)$ sequences consisting of $5$s or $7$s is $2^{k-1}$ and total number of 5s (= total number of 7s, by symmetry) combining all such sequences is $\frac{k-1}{2}$, leading to the travel of sum total length $2^{k-1}.\frac{k-1}{2}.(5+7)=2^{k-1}(6k-6)$.

(2) Also, each of this $2^{k-1}$ sequences will end with a path of $3$ (the last door to be visited, leading to safety), so it will contribute $2^{k-1}.3$ to the sum.

Adding (1) and (2), the total length (in time, hrs) of travel corresponding to $k$-step exit is $2^{k-1}(6k-6)+2^{k-1}.3=2^{k-1}.(6k-3)$, with $k$ state transition probability as $\left(\frac{1}{3}\right)^k$. Hence, the total probability for a $k$-step exit $=\frac{2^{k-1}.(6k-3)}{3^k}$

Finally, the m.g.f = $m_X(t) = E[e^{tX}] = \sum_\limits x P(X=x).e^{tx}$

$=\frac{1}{3}e^{3t}+\frac{1}{3^2}(e^{8t}+e^{10t})+\frac{1}{3^3}(e^{13t}+e^{17t}+2.e^{15t}) +\frac{1}{3^4}(e^{18t}+e^{24t}+3.e^{20t}+3.e^{22t}) +\frac{1}{3^5}(e^{23t}+e^{31t}+3.e^{25t}+3.e^{29t}+6.e^{27t}) + \ldots$

E[X] will be the coefficient of t in the power series representation of $m_X(t)$, or equivalently, $m_X^{\prime}(0)$, which will be

$=\frac{3}{3}+\frac{8+10}{3^2}+\frac{13+17+2.15}{3^3}+\frac{18+24+3.20+3.22}{3^4}+\frac{23+31+4.25+4.29+6.27}{3^5} + \ldots $

$=\frac{3}{3}+\frac{18}{3^2}+\frac{60}{3^3}+\frac{168}{3^4}+\frac{432}{3^5}+\ldots$

$=\sum\limits_{k=1}^\infty\frac{2^{k-1}(6k-3)}{3^k}$ (as shown above)

$=\sum\limits_{k=1}^\infty\frac{2^{k-1}(2k-1)}{3^{k-1}}$

$=2\sum\limits_{k=1}^\infty k\left(\frac{2}{3}\right)^{k-1}-\sum\limits_{k=1}^\infty \left(\frac{2}{3}\right)^{k-1}$

$=\frac{2}{(1-2/3)^2}-\frac{1}{1-2/3}$

$=15$ hrs

With simulation in R (the result holds by LLN):

set.seed(111)
mean(replicate(100000,
                {
                    tot <- 0
                    cur <- sample(c(3,5,7),1)
                    while (cur == 5 | cur == 7) {
                        tot <- tot + cur
                        cur <- sample(c(3,5,7),1)
                    }
                    tot <- tot + cur
                    tot
                }))
#[1] 15.0603