<s>[INST] Finding a pair of commutative stochastic $3 \times 3$ matrices Could you please give me an example of a pair $\left(A,B\right)$ of commutative stochastic $3 \times 3$ matrices with real entries given $A \neq B$ and excluding the identity matrix, symmetric matrices and doubly stochastic matrices?
 [/INST] What it we take $B$ a convex combination of powers of $A$?  In generic cases, if two matrices commute $A$, $B$ commute one $B$ will be a polynomial in the other $A$ ( if the eigenvalues of $A$ are distinct).
$\bf{Added:}$ Here is a stochastic matrix $A$ with eigenvalues $1$, $\frac{1}{6}$, $\frac{1}{6}$
$$A=\left( \begin{matrix} \frac{11}{18} & \frac{1}{3} & \frac{1}{18} \\ \frac{4}{9} & \frac{1}{2} & \frac{1}{18} \\ \frac{4}{9} & \frac{1}{3} & \frac{2}{9} \end{matrix} \right)$$
$\bf{Added:}$ Some calculations show that the $3\times 3$ stochastic matrices with eigenvalues $1$, $\lambda$, $\lambda$ are of the form
$$A=\left( \begin{matrix} a & b & 1-a-b \\ p & q & 1-p-q \\ u & v & w=1-v-w\end{matrix} \right)$$
where $$u = p+ \frac{(t-1)^2}{4} (a+b-p-q)\\
v = b-\frac{(t+1)^2}{4}(a+b-p-q)\\
w = (1-b-p) + t\,(a+b-p-q)$$
Positivity of entrier is also required. To check the result, see WA. This follows from the factorization of the discriminant of the characteristic polynomial of a stochastic $3\times 3$ matrix
$$\Delta= (1 - a - b p - q + a q + u + b u - q u + v - a v + p v)^2\\ \cdot (a^2 + 4 b p - 2 a q + q^2 - 2 a u - 4 b u + 2 q u + u^2 + 2 a v - 4 p v - 2 q v + 2 u v + v^2)$$
The first factor in the square is $\ge 0$ for stochastic matrices ( it being $0$ is  the condition that the matrix has two eigenvalues $1$).
The second factor equals:
$$(a-q-u+v)^2 + (b+p-u-v)^2 - (b-p+u-v)^2$$
It is the solutions to this expression being $0$ tnat are parametrized by the above (we may be missing some solutions corresponding to $t=\infty$).
</s>