Let $A,B \in M_n(R)$ being fixed matrices. Define $T\in \mathcal{L}(M_n)$ as
$$T(C)=AC-CB.$$
Prove that $T$ is invertible iff $gcd(m_A,m_B) \text{~}1$ where $m_X$ represents the minimal polynomial of $X$.
First, the condition is equivalent to $AC=CB \Leftrightarrow C=0$. I tried to use that $AC=CB \Rightarrow p(A)C=Cp(B)$ for every polynomial $p$ and use $m_A$ and $m_B$ but I couldn't make any further progress.
Taking $p=m_A$ gives $Cm_A(B)=0$. But also $Cm_B(B)=0$ as $m_B(B)=0$.
As $\gcd(m_A,m_B)=0$ there are polynomials $u$ and $v$ with $m_Au+m_Bv=1$. Then $$C=Cm_A(B)u(B)+Cm_B(B)v(B)=0.$$