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}$ |