I am sitting in a class for Markov chains/processes, having no real background in probability but high school knowledge. Now I gotta go through it and I found it better understandable than I had expected. But now we got a MATLAB snippet from our teacher, and while applying that code:
P =[...] v = null(transpose(P-eye(length(P)))); pi = v.*(ones(length(P),1)*(1./sum(v)))
I found two questions:
- For what is the nullspace needed?
- What is the mathematical background for the second line (" pi = ...")
Having a transition matrix P and a stationary distribution vector $\vec\pi$ I can set up the system as $\pi P = \pi $ and rewrite is as $\pi(P-I)=0$ if I do want to solve it in MATLAB.
Thank you for any help!