The length of a flipping sequence over four cards 
There are 4 cards on the table, initially all facing downwards. Each time one of the cards is randomly chosen and flipped, until all cards are facing upwards. Let $n$ denote the total number of flips. Find the probability that $n$ is a multiple of 4.

Well, the only thing I have found so far is that $n$ might be, based on the probability that $n=4,8,12,\dots$:
$$\frac3{32}+\frac{87}{1024}+\frac{2235}{32768}+\cdots$$
I would appreciate if anyone can help.
 A: The first thing to notice is that the number of flips will always be even due to parity considerations. Therefore we only need to consider three states – all down (0), two up/two down (2) and all up (4) – and the transition probabilities when one transition encompasses two flips:


*

*From 0 there is a $\frac14$ chance of staying at 0 and a $\frac34$ chance of going to 2.

*From 2 there is a $\frac18$ chance each of going to 0 or 4 and a $\frac34$ chance of staying at 2.


Now consider the probabilities of reaching 4 in a doubly even number of flips, or an even number of transitions. We start with the shortest such sequence 0 24, which has a $\frac3{32}$ chance of occurring (as you have calculated). All valid trajectories begin with 0 and end with 24, but we can add pairs of states at the end of the space in between to keep the total number of transitions even, and the probabilities will be multiplied accordingly depending on whether the third-last state is 0 or 2:
024 -> 00024 1/16
    -> 02024 3/32; 024 -> 024 = 5/32
    -> 00224 3/16
    -> 02224 9/16; 024 -> 224 = 3/4
224 -> 20024 1/32
    -> 22024 3/32; 224 -> 024 = 1/8
    -> 20224 3/32
    -> 22224 9/16; 224 -> 224 = 21/32

Therefore we may write the probabilities of a trajectory with $m+2$ transitions whose third-last state is 0 or 2 in matrix form:
$$\begin{bmatrix}P_{m+2,0}\\P_{m+2,2}\end{bmatrix}=\mathbf Q^m\mathbf u=\begin{bmatrix}\frac5{32}&\frac18\\\frac34&\frac{21}{32}\end{bmatrix}^m\begin{bmatrix}\frac3{32}\\0\end{bmatrix}$$
The following expression will then give the probabilities of all valid trajectories whose third-last state is 0 or 2:
$$\mathbf{Nu}=\sum_{m=0}^\infty\mathbf Q^m\mathbf u=\left(\sum_{m=0}^\infty\mathbf Q^m\right)\mathbf u$$
$$=(\mathbf I-\mathbf Q)^{-1}\mathbf u=\begin{bmatrix}\frac{11}{67}\\\frac{24}{67}\end{bmatrix}$$
The sum of entries in this column vector gives the final answer, the probability that the number of flips is divisible by 4:
$$\frac{11}{67}+\frac{24}{67}=\frac{35}{67}$$
