# Random walking probabilities

This is a follow-up question to the one posted here:

Random walking and the expected value

I want to generalize the probability.... lets say walking to the neighbour in the clockwise direction is p ,and the counter clockwise is 1-p.

Any help would be greatly appreciated

Thanks

-

## 2 Answers

The answer is still 4, because (by the symmetry) the invariant distribution of the Markov chain is still uniform, and the mean time to return to the node is the reciprocal of the corresponding component of the invariant distribution vector, $\mathbb{E}(T_1) = \frac{1}{\pi_1} = 4$.

Alternatively, let $m_k$ denote the mean number of transitions until visiting node 1. Conditioning on the next step: $$m_2 = 1 + p m_3, \quad m_3 = 1 + (1-p) m_2 + p m_4, \quad m_4 = 1 + (1-p) m_3$$ Which gives: $$m_2 = 1 + \frac{2p}{1-2p(1-p)}, \quad m_3 = \frac{2}{1-2p(1-p)}, \quad m_4 = 1 + \frac{2(1-p)}{1-2p(1-p)}$$ The mean time to return to node 1 is: $$1 + (1-p) m_4 + p m_2 = 1 + 1 + \frac{2}{1-2p(1-p)}\left((1-p)^2 + p^2\right) = 4$$

-
I like the Markov chain method. – Hagen von Eitzen Sep 5 '12 at 21:09

Let $e$ be the desired expectation. Let $a_2$, $a_3$, $a_4$ be the expected time until one returns to vertex $1$, given that we are at $2$, $3$, $4$ respectively.

We have the following equations:

$e=1+ pa_2+(1-p)a_4$; This is because we take $1$ step, and enter State $2$ with probability $p$, and State $4$ with probability $1-p$.

$a_2=1+pa_3$; one step backwards and it's over, else we are in State $3$. This happens with probability $p$.

$a_3=1+pa_4+(1-p)a_2$;

$a_4=1+(1-p)a_3$.

Four linear equations in four unknowns: solve.

-