Solution (source code)

= Solution

A <transition matrix> $P$ defines an <irreducible Markov chain> if every state is accessible from every other state:
$$
\boxed{\text{for every }i,j\in S,\ \text{there is }n\geq0\text{ with }(P^n)_{ij}>0.}
$$
Equivalently, all states belong to one <communicating class>. When $i\ne j$, a positive number of steps is necessarily used.