It is well known that the set $\mathcal{D}_n(\mathbb{C})$ of all complex, diagonalizable, $n \times n$ matrices is dense in $\mathcal{M}_n(\mathbb{C})$, the set of all complex $n \times n$ matrices. And that two diagonalizable matrices which commute are simultaneously diagonalizable.
The exercise, which I am having difficulty to solve, is the following.
Let $A,B \in \mathcal{M}_n(\mathbb{C})$. Suppose $AB = BA$ and let $\varepsilon >0$. Show that there exists two simultaneously diagonalizable complex, $n \times n $ matrices, $C$ and $D$ such that $\| A - C \| \leq \varepsilon $ and $\| B - D \| \leq \varepsilon$.
I have managed to find a solution when $A$ (or $B$) is diagonalizable... But I really cannot find the answer in the general case.
Anyone able to help me out ?
Hint:
Let $J_A$ be the Jordan Canonical Form matrix of $A$. $$ J_{A}=\pmatrix{\lambda_1 \hspace{5 mm}*\\\ddots \\& \lambda_{n-1} \hspace{5 mm}* \\& \hspace{10 mm}\lambda_n } $$ * is $0$ or $1$. $\lambda_i$ is eigenvalue of $A$ and may not be distinct.
Choose $C$ to be same as $J_A$ except the diagonal elements as: $$ C'=\pmatrix{\lambda_1 \hspace{5 mm}*\\\ddots \\& \lambda_{n-1}+\epsilon_{n-1} \hspace{5 mm}* \\& \hspace{10 mm}\lambda_n+\epsilon_{n} }=\pmatrix{\mu_1 \hspace{5 mm}*\\\ddots \\& \mu_{n-1} \hspace{5 mm}* \\& \hspace{10 mm}\mu_n } $$ where $\epsilon_i<\epsilon$ and $\mu_i$ is distinct. Since $C$ has distinct eigenvalues, it is diagonalizable. But $\|C'-J_A\|<\epsilon$. Then prove $\|C-A\|<\epsilon$, where $C$ is diagonalized matrix of $C'$.