Prove the matrix equation $AX-XB=0$ only has $X=0$ as solution [closed]
Let $A,B$ be $n\times{n}$ matrices. Let $f(x)$ and $g(x)$ be polynomials with $n\times{n}$ matrices as coefficients. $f(x)$ and $g(x)$ are relatively coprime, and $f(A)=g(B)=0.$
Prove the matrix equation $AX-XB=0$ only has $X=0$ as solution.
Inspired by Prove that the Sylvester equation has a unique solution when $A$ and $−B$ share no eigenvalues, in particular this answer.
Suppose $A X - X B = 0$, let $f$ and $g$ be coprime polynomials and suppose $f(A) = g(B) = 0$. The polynomials here play the same role as (though might be different from) the characteristic polynomials in the aforementioned answer. Since $A X = X B$, by induction we also have $$ f(A) X = X f(B). $$ By assumption $f(A) = 0$, so this really reads $0 = X f(B)$. If we can now show that $f(B)$ is invertible, this guarantees $X = 0$.
Indeed this is the case, since by the coprimality of $f$ and $g$ we have, for some polynomials $a$ and $b$, $$ a(x) f(x) + b(x) g(x) = 1. $$ Evaluating this at $B$, we get $$ a(B) f(B) = I $$ since by assumption $g(B) = 0$. Hence $f(B)$ is invertible, finishing the proof.