Solution (source code)

= Solution

Condition on the state after $m$ steps and use the <Markov property> and <time-homogeneous Markov property>:
$$
p_{ij}^{(m+n)}=\sum_{k\in S}\mathbb P(X_{m+n}=j\mid X_m=k,X_0=i)
\mathbb P(X_m=k\mid X_0=i)=\boxed{\sum_kp_{ik}^{(m)}p_{kj}^{(n)}}.
$$
This is the <Chapman-Kolmogorov equation>, or $P^{m+n}=P^mP^n$. A <stationary distribution> is a <probability> row vector with nonnegative entries summing to one and $\boxed{\pi P=\pi}$. Inductively $\pi P^n=\pi$, so a chain started with that distribution retains it at every time.

For the given <matrix>, its first stationary equation is $\pi_1=\pi_1/2+(\pi_2+\pi_3)/3$. Normalization gives $\pi_1=2/5$. The third equation gives $\pi_3=2\pi_2/3+\pi_3/3$, hence $\pi_3=\pi_2$. Therefore
$$
\boxed{\pi=(2/5,3/10,3/10).}
$$
Direct multiplication verifies the second equation as well. The finite chain is irreducible, so this stationary <probability> distribution is unique.