A stationary distribution for a Markov chain is a probability vector p such that pM = p, where M is the transition matrix. An irreducible chain has a stationary distribution if and only if all the states are recurrent and have finite mean recurrence time. In this case, the stationary distribution is unique and pi = 1/mi, where mi is the mean recurrence time of the ith state.