Approximating commuting matrices by commuting diagonalizable matrices Suppose the matrices $A$ and $B$ commute. Do there exists sequences $A_n$ and $B_n$ of matrices such that


*

*$A_n \rightarrow A$, $B_n \rightarrow B$. 

*Each $A_n$ is diagonalizable  and the same for each $B_n$. 

*For every $n$, $A_n$ commutes with $B_n$. 
Moreover, it would be nice if the following property was additionally satisfied: if $A,B$ are real, then $A_n,B_n$ can be chosen to be real as well. 
 A: To get this off the Unanswered list:
The question was subsequently posted to MathOverflow, where it was answered in the affirmative. Some useful references from Mark Wildon’s answer:

I'm fairly sure M. Gerstenhaber was the first to prove that the irreducibility result. His paper is: On dominance and varieties of commuting matrices, Annals Math. 73 (1961), 324-348. However the result asked for in the question was already known from Theorem 5 in T. S. Motzkin, Olga Taussky, Pairs of matrices with property L II, Trans. Amer. Math. Soc. 80 (1955), 387-401. There is a short account of this work after Remark 3.4 in the paper by Meara and Vinsonhaler mentioned in SJ's answer. 

The last reference appears to be to K. C. O'Meara and C. I. Vinsonhaler, On approximately simultaneously diagonalizable matrices, Linear Algebra Appl., 412 (2006), 39 - 74.
A: Part $1:$ I know that if $M$ is the algebra generated by $A,~ B,~ AB = BA,$ then the dimension of $M$ as a subspace of all commuting matrices, whose dimension is of course $~n^2$, is at most $n$.
I read a note somewhere which suggests that if the number of commuting matrices is $~k > 2$, that it is not known that $\dim(M)$ is less than or equal to $~n~$.
The same note put a bound on it less than $~n^2~$, but did not do any better.  In particular, the note I read says that even for $~k = 3~$, $~A,~ B,~ C~$ commute, that it has not known that $~\dim(M)~$ is bounded by $~n~$.
Part $2:$  Why is this question of interest?  There may be many reasons why it is of interest, but it was presented to me as an abstract problem in Algebra.
Thanks in advance for any useful additions to this thread.
