# stationary distribution of a transition matrix

How can I solve the stationary distribution of a finite Markov Chain? In other words, how can I estimate the eigenvectors of a transition matrix?

• Welcome to Mathematica.SE, whynot! Please let us know what you tried. In addition, may I suggest: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Read the FAQs! 3) When you see good Q&A, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. ALSO, remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign – Verbeia Oct 4 '12 at 7:46

The Eigensystem[ ] command would be the way to go. Say you have a transition matrix:

trans = Transpose[{{1/6, 1/6, 4/6}, {0, 3/4, 1/4}, {1/10, 1/10, 8/10}}]


Then you would get the eigenvalues and eigenvectors as:

{eVals, eVecs} = Eigensystem[trans]


You can interpret these using

eVals // MatrixForm


and

eVecs // MatrixForm


In this case, for the transition matrix above, the eigenvector corresponding to the eigenvalue $1$ is the first row of the eVecs matrix, which is $\{ 0.12, 0.48, 1.\}$. You can check that this is true by evaluating

trans.{0.12, 0.48, 1.}


which indeed returns $\{ 0.12, 0.48, 1.\}$. To get the actual steady state distribution, you would need to normalize this, i.e., divide the vector by the sum of the elements

{0.12, 0.48, 1.}/Total[{0.12, 0.48, 1.}]

• nice answer! Another way to do the last step would be Normalize[{0.12, 0.48, 1.}, Total]. – Thies Heidecke Oct 4 '12 at 13:46
• yes, it works, thanks. why do you need to transpose? – whynot Oct 4 '12 at 19:58
• As commonly defined, a stochastic matrix has row sum equal to $1$, and has a left eigenvector corresponding to the unit eigenvalue. Mathematica computes right eigenvectors by default. So what the above does is to calculate the right eigenvector of $A'$, which is the desired left eigenvector of $A$. – bill s Oct 5 '12 at 5:59