Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
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
up vote 6 down vote accepted

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


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.}]
share|improve this answer
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.