2

Consider the numbers 1, 2, ..., 12 written around a ring as they usually are on a clock. Consider a Markov chain that at any point jumps with equal probability to the two adjacent numbers. (a) What is the expected number of steps that $X_n$ will take to return to its starting position? (b) What is the probability $X_n$ will visit all the other states before returning to its starting position?

I can see that we simply have a doubly stochastic 12x12 matrix, with $P_x(x, x+1) = P_x(x, x-1) = 1/2$ (here assuming 12 + 1 = 1). Thus, the stationary distribution $\pi[i] = 1/12$ for all $i \in [1:12]$. Then, the expected number of steps from any $i$ to $i$ is simply $1 / \pi[i] = 12$, right?

(b) is a little trickier - we know that all states here are null recurrent. However, I'm not sure how to think about this probability. Any tips?

mizichael
  • 360
  • I think the first one will be $s^T (\sum_{k=1}^\infty k P^k)s$, where s is the vector indicating the starting position with a 1 and 0 everywhere else. The matrix will be circulant so it will have eigenvectors which are the complex exponentials and the eigenvalues will be the fft coefficients of the fft of the first row. – mathreadler Oct 09 '17 at 19:45
  • @mathreadler are you getting 12 as your answer with this method? Unfortunately we don't use eigenvalues in this stochastic processes class so I'm not sure I should use that method. – mizichael Oct 09 '17 at 19:54
  • Wait we must modify it so that the matrix we take the power of leaks out probability once we come back to the first state otherwise we will count some several times over. – mathreadler Oct 09 '17 at 19:57
  • 2
    @mizichael : Your steady state argument $1/\pi_i = 12$ in part (a) looks good (and this shows the states are recurrent, not null recurrent). For part (b), it is similar to finding the probability we reach state 12 before state 0 in a random walk on the integers (starting at 1), except you first have to condition on moving either right or left on the first hop. – Michael Oct 09 '17 at 21:57

3 Answers3

4

For part (b), assume (without loss of generality) that from state 1 we went to state 2 and not state 12 (it does not matter, because the ring is symmetric).

Then we want to know the probability, starting at state 2, that we reach state 12 before getting to state 1.

Let $p_k$ be the probability, starting at state $k$, that we reach state 12 before getting to state 1. Then $p_1 = 0$, $p_{12} = 1$, and $p_k = \frac{p_{k+1} + p_{k-1}}{2}$ for $2 \le k \le 11$.

We can just solve this system of equations directly, getting $p_k = \frac{k-1}{11}$ for all $k$, or we can use some trickery.

Here's one "trickery" way to do it. Imagine a betting game in which you start with 2 dollars, and every time you bet you either win or lose a dollar with equal probability. If you keep playing until you get to 12 dollars or have 1 dollar left what is the expected amount of money you have at the end?

  1. Because the game is fair, it must still be 2 dollars.
  2. The game is clearly isomorphic to the random walk we're taking here. Starting with 2 dollars, we end with 12 dollars with probability $p_2$ and 1 dollars otherwise, so the expected amount of money at the end is $12p_2 + 1(1-p_2)$.

Setting these equal, we get $12p_2 + (1-p_2) = 2$, or $p_2 =\frac1{11}$.

Misha Lavrov
  • 159,700
  • 1
    Minor edit perhaps needed: There is no state 0, so perhaps we can start in state 1 and assume we go from 1 to 2 on the first hop. Then, starting in 2, we want to know the probability of getting to 12 before going back to 1. – Michael Oct 10 '17 at 00:28
  • 1
    Whoops! Okay, now we have the right number of states. – Misha Lavrov Oct 10 '17 at 00:32
  • That is an extremely interesting way of thinking about this and I hadn't even considered that...really helpful, thank you so much! +1 – mizichael Oct 10 '17 at 15:26
1

You already have an answer by Misha, but maybe someone would like a more concrete description of how to calculate it with matrices.

For b) we start at $2$ and use the idea in Misha's answer above : We want to find the probability to get to 1 through 12 instead of from 2. Now we can put the leak in state 2's transfer to state 1, just null that transfer probability, as well as the hop from 1 to 12 and from 1 to 2. Then we let state $1$ become a trapping state, keeping 100% of whatever ends up there. The modified P matrix cropped down to a 6 state clock would be:

$${\bf P} = \frac 1 2 \left[\begin{array}{cccccc}\bf 2&\bf 0&0&0&0&1\\\bf 0&0&1&0&0&0\\0&1&0&1&0&0\\0&0&1&0&1&0\\0&0&0&1&0&1\\ \bf 0&0&0&0&1&0\end{array}\right]$$

All the modifications done to the matrix are in bold.

Now what we want to calculate is $$\lim_{n\to \infty}\left\{[1,0,0,\cdots]({\bf P})^n[0,1,0,\cdots,0]^T\right\}$$

For $n=256$ we get 0.83301 which is rather close to $1/12 \approx 0.83333$


Hmm, I see now that I slightly misinterpreted the question. The question was not to return to the first from the last state, but just to reach the last state before reaching the first one for the second time. That explains why we got $1/12$ instead of $1/11$. The fix would be to change so that the last state becomes the trapping state instead of the first one. The necessary matrix modifications could be a good exercise for the eager student.

mathreadler
  • 26,534
0

My attempt at the a) would be to build the matrix, call it $\bf P$, then build a diagonal matrix, call it $\bf D$, where $${\bf D}_{ii}= \begin{cases}0, & i = \text{initial state}\\1,& i \neq \text{initial state}\end{cases}$$ And an initial state column vector $\bf s$ : $${\bf s}_{i}= \begin{cases}1, & i = \text{initial state}\\0,& i \neq \text{initial state}\end{cases}$$


EDIT, to explain D matrix : We see that the $\bf D$, if multiplying from the left will zero the same row as the initial state encoded in $\bf s$. If we do not do it, then when counting the contribution to the expected value after hop $k$, the probability that we have just counted that has reached back to the initial state will flow back out of the initial state and get counted once again. We don't want that, because then we would include second and third and fourth et.c. returns to the initial state as well.


Then the expected value should be: $$E={\bf s}^T\left(\sum_{k=1}^{\infty}k({\bf PD})^k\right){\bf Ps}$$

This gives me $E=11.000$ if I run for $>8000$ hops. But it might be that I have an index off in my calculation so that it would be $12$ because I miss count the first one or something like that.


To show you that it actually works here is a plot :

enter image description here

mathreadler
  • 26,534
  • The purpose of $\bf D$ is to let the probability which has flowed back to the goal state "leak out" of the system once we have counted it. If we do not do that, we will be counting it over and over again as it hops out and back into the initial state again. – mathreadler Oct 09 '17 at 22:12
  • What do you mean? It just 0es every piece of probability that flows into the initial state every new iteration of the chain. You see there is a $\bf P$ matrix first to the right outside of the sum parenthesis? So you could interpret it as $\bf D$ working from the left on the $\bf P$ matrices, zeroing a row and not a column. That means, we let the probability in the initial state flow out of the system once we have counted it each new iteration. – mathreadler Oct 09 '17 at 22:16
  • I can try to edit the answer to make it clearer. – mathreadler Oct 09 '17 at 22:21
  • The summation is the same kind of summation as when you count expected values for any discrete random variable. $k$ (or actually it should be $k+1$) is the value of the random variable after $k$ hops and the probability to be back for the first time is $s^T(PD)^kPs$, just an ordinary expected-value summation. – mathreadler Oct 09 '17 at 22:38
  • Yes we could make it with a trapping state instead if we want to. Right now I can't think of a better explanation than that we need to make sure we don't risk to overcount visits. Also I should probably practice my australian accent more... – mathreadler Oct 09 '17 at 22:41
  • No it doesn't. It is $\bf D$ that wipes out the stuff that was moved to state $i$ in the previous hop. The first $\bf P$ is outside of the sum, remember? Which is the reason the scalar $k$ we multiply with should in fact be $k+1$ instead. – mathreadler Oct 09 '17 at 23:05
  • So can you explain to me why it works then? Because it does. It does not clean out anything except the probability that hits the state of interest at each previous $k$. I can replace the matrix to one with $N$ states instead and I still get expected value $N$ for lots of different matrix sizes $N$. – mathreadler Oct 10 '17 at 06:19
  • The reason why the $k$ should be $k+1$ is because the first $\bf P$ that is not in the parentheses with $\bf D$ should also be counted as a hop. $\bf D$ is just there to clean up the mess after each hop. – mathreadler Oct 10 '17 at 18:18
  • Sigh... What are you even trying to do, Michael? The matrices are symmetric. Your expression is the transpose of mine and I did explain the $k$ vs $k+1$ a long time ago. – mathreadler Oct 10 '17 at 19:34