# 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?

-

2
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

## 1 Answer

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
lang-mma
{"extraction_info": {"found_math": true, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 6, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0}, "config": {"markdown_headings": true, "markdown_code": true, "boilerplate_config": {"ratio_threshold": 0.18, "absolute_threshold": 10, "end_threshold": 15, "enable": true}, "remove_buttons": true, "remove_image_figures": true, "remove_link_clusters": true, "table_config": {"min_rows": 2, "min_cols": 3, "format": "github"}, "remove_chinese": true, "remove_edit_buttons": true, "extract_latex": true}, "english_confidence": 0.8766573667526245, "perplexity_flag": "middle"}