Calculating discrete probability distribution function for potentially infinite trials I throw a die until the difference in value between successive trials is 1 (e.g 3 and 4 or 6 and 5). How do I calculate the pdf for the random variable n (number of trials?)  I can easily calculate for n equal to 2 or 3 but then the number of possibilities starts to get messy.
 A: The problem has symmetry $(1,2,3)\leftrightarrow(6,5,4)$. To exploit it, let us denote by $A_1$ the event that a roll is $1$ or $6$, $A_2$ the event that a roll is $2$ or $5$, $A_3$ the event that a roll is $3$ or $4$. After the first roll
\begin{align}
p_1^{(1)}=p_{A_1}^{(1)}=1/3\\
p_2^{(1)}=p_{A_2}^{(1)}=1/3\\
p_3^{(1)}=p_{A_3}^{(1)}=1/3
\end{align}
which we denote as column vector $P^{(1)}$.
Now we can think in terms of Markov chain with 4 states: the $A_1,A_2$ and $A_3$ state and absorbing state $A$. The transition matrix for the non-absorbing states is
\begin{equation}
T=\begin{pmatrix}
1/3&1/6&1/3\\
1/6&1/3&1/6\\
1/3&1/6&1/6
\end{pmatrix}
\end{equation}
The probabilities of non-absorbing states after $n+1$ rolls is a vector
$$P^{(n+1)}=T^nP^{(1)}$$
Finally the probability of absorption after $n+1$ rolls (which is CDF of the distribution we are looking for) is
\begin{align}
P(X\leq n+1)
&=1-p_1^{(n+1)}-p_2^{(n+1)}-p_3^{(n+1)}\\
&=1-\sum_{i=1}^3\sum_{j=1}^3(T^n)_{i,j}P_j^{(1)}
\end{align}
