$A$ and $B$ are two square matrices such that $AB = 2A + 3B$. Show that $\operatorname{rank}A =\operatorname{rank}B$.
I managed to prove that the matrices $A-3I$ and $B-2I$ are invertible and that $AB=BA$.
Also if $A$ is invertible then $B$ is invertible because otherwise determinat of $2A$ would be $0$ which is false.
I don't know what to do when $A$ is not invertible.
Let $x \in \ker(B)$. Then $0=ABx=2Ax+3Bx=2Ax$, hence $x \in \ker(A).$
Thus $\ker(B) \subset \ker(A).$
Similar arguments give: $\ker(A) \subset \ker(B).$
Conclusion: $\ker(B)=\ker(A).$
The rank - nullity theorem gives now the result.