[Math] Rolling a dice until we have $5$ and an even number.

probability

We roll a dice, until we have both: a five and some even number.
Let X be the expected number of rolls.
Find expected value of X and Var(X).

So I don't know how to begin. I think there should be something like $X= X_1 + X_2$ And then I would use geometric distribution. But how to divide X into easier events?
I thought about situations like rolling dice until we have both even and odd number. It's easy, because probability of obtaing an odd number is the same as obtaining even number.
The same situation – if we roll until we get $5$ and, let me say, $3$. There is no problem since getting $5$ has the same probability as getting $3$.
But getting a $5$ and getting an even number have different proabilities, so it's not so easy… Can somebody help?

Best Answer

Here's a heavy-handed approach. After zero or more rolls, you are in one of four situations:

$\begin{align} \emptyset:&\qquad\textrm{No 5 or even rolled yet.}\\ E:&\qquad\textrm{Even was rolled, but no 5 yet.}\\ 5:&\qquad\textrm{A 5 was rolled, but no even yet.}\\ *:&\qquad\textrm{Both 5 and even have been rolled. Game over.}\\ \end{align}$

The transition matrix of probabilities between each pair of situations is easy to compute:

$\begin{array}{l|cccc} \nearrow&\emptyset&E&5&*\\ \hline \emptyset&\frac{1}{3}&\frac{1}{2}&\frac{1}{6}&0\\ E&0&\frac{5}{6}&0&\frac{1}{6}\\ 5&0&0&\frac{1}{2}&\frac{1}{2}\\ *&0&0&0&1\\ \end{array}$

So this is now modeled as a absorbing Markov chain with transition matrix

$\left({\begin{array}{cccc} \frac{1}{3}&\frac{1}{2}&\frac{1}{6}&0\\ 0&\frac{5}{6}&0&\frac{1}{6}\\ 0&0&\frac{1}{2}&\frac{1}{2}\\ 0&0&0&1\\ \end{array}}\right)$

The final state being listed last, the behavior is characterized by the $3\times3$ matrix in the upper left, which is the transition matrix for the non-final states.

$Q=\left({\begin{array}{ccc} \frac{1}{3}&\frac{1}{2}&\frac{1}{6}\\ 0&\frac{5}{6}&0\\ 0&0&\frac{1}{2}\\ \end{array}}\right)$

The so-called fundamental matrix $N$ for this chain is

$N=(I-Q)^{-1} =\left({\begin{array}{ccc} \frac{3}{2}&\frac{9}{2}&\frac{1}{2}\\ 0&6&0\\ 0&0&2\\ \end{array}}\right) $.

The expected number of steps from the $i$-th state to the final one is the sum of the entries of the $i$-th row of $N$, or equivalently the $i$-th entry of the matrix

${\bf t}=N\mathbb{1}=\left({\begin{array}{c} \frac{13}{2}\\ 6\\ 2\\ \end{array}}\right)$,

so for the starting state $\emptyset$, it's $\frac{13}{2}$ steps.

The variance of the number of steps from the $i$-th state is the $i$-th entry in the matrix

$(2N-I){\bf t-t_{\textrm sq}}$,

where $t_{\textrm sq}$ is the matrix $\bf t$ with each entry squared. If I didn't slip up with Mathematica,

$(2N-I){\bf t-t_{\textrm sq}}=\left({\begin{array}{c} \frac{107}{4}\\ 30\\ 2\\ \end{array}}\right)$,

and the variance you want is $\frac{107}{4}$