Solution (source code)

= Solution

Partition $M$ into the same five-by-five blocks as $R$. The equation for block $(i,j)$ is $M_{ij}R_j(g)=R_i(g)M_{ij}$, so each block is an <intertwiner>. By <Schur's lemma>, blocks between the two inequivalent <irreducible representations> vanish, whereas blocks between identical copies are arbitrary scalar multiples of the relevant identity <matrix>. Thus the <commutant of a semisimple representation> is
$$
\boxed{
M=\begin{pmatrix}
a_{11}I_{n_1}&a_{12}I_{n_1}&a_{13}I_{n_1}&0&0\\
a_{21}I_{n_1}&a_{22}I_{n_1}&a_{23}I_{n_1}&0&0\\
a_{31}I_{n_1}&a_{32}I_{n_1}&a_{33}I_{n_1}&0&0\\
0&0&0&b_{11}I_{n_2}&b_{12}I_{n_2}\\
0&0&0&b_{21}I_{n_2}&b_{22}I_{n_2}
\end{pmatrix},\quad a_{ij},b_{ij}\in\mathbb C.}
$$
Equivalently, $M=(A\otimes I_{n_1})\oplus(B\otimes I_{n_2})$, where $A\in M_3(\mathbb C)$ and $B\in M_2(\mathbb C)$. Substitution proves every such <matrix> commutes with every $R(g)$. There is no invertibility requirement on $M$, and its solution space has complex dimension $3^2+2^2=13$, even if $n_1=n_2$.