I have formulated a problem as a finite-state continuous time Markov chain. I have the infinitesimal generator matrix, which I'll call $\mathbf{A}$, of the form
$ \mathbf{A} = \begin{bmatrix} q_{11} & \dots & q_{1N} \\ \vdots & \ddots & \vdots \\ q_{N1} & \dots & q_{NN} \\ \end{bmatrix} $
Where the $q_{ii}$ terms along the diagonal represent the parameters of the exponential distribution describing the sojourn time in the $i^{th}$ state (equal to the negative sum of the other rates in the row). The formula in my textbook for the limiting distribution, $\mathbf{\pi}$, of a Markov chain of this form is
$\mathbf{\pi} \mathbf{A} = 0$
where $\pi_i$ is the equilibrium proportion of time spent in the $i^{th}$ state. I am implementing this model in MATLAB, and would like to use this equation to verify. To do so I have
b = zeros(1,N);
pi = A'\b';
This doesn't work as MATLAB complains that the matrix is singular. I then tried every trick in the book for working with matrices that are close to singular, to no avail. I then asked my professor, and his answer was simply that the generator matrix should be singular, as it has one dominant eigenvalue of zero, and that I should just solve the system.
How do I solve this system if the matrix is singular?
Figured this out. The equation
$\mathbf{\pi}\mathbf{A} =\mathbf{0}$
is just a left eigenvector equation for eigenvalue 0. In MATLAB can be found with
where W is the left eigenvectors.