Prove that $U$ is a vector subspace of space $V=M_n$ find it's base and dimension. $U=\{M\in M_n: AM=MD\}$ Matrix $A\in M_n(\mathbb{R})$ has $n$ different eigenvalues $\lambda_1,\lambda_2,...,\lambda_n$ and let $U=\{M\in M_n: AM=MD\}$,where $D=diag(\lambda_1,\lambda_2,...\lambda_n)$.
Prove that $U$ is a vector subspace of space $V=M_n$ and then find it's base and dimension.
My approach:
Since $A$ has $n$ different eigenvalues we know that the eigenvectors are linearly independent. So $rank(S)=n$,where $S$ is the matrix of eigenvectors. Because $S$ clearly satisfies the given condition, $S\in U$ and since all the columns of $S$ are linearly independent we conclude that $dim(U)=n$ where the base consists of matrices with who have one column as an eigenvector and the other ones are zero columns.
Is my approach correct?
 A: One can see what you're doing, but the wording can use some improvement.
First of all, I assume you're given that $\lambda_i\in\mathbb R$ because otherwise there's little chance to have $U\subset M_n(\mathbb R)$.
What I think you did: We see that $AM=MD$ if and only if for all $i$, the $i$th column of $M$ is an eigenvector of $A$ belonging to $\lambda_i$. For fixed nonzero eigenvectors $v_i$, by noting that all eigenspaces have dimension $1$, we have $$U=\left\{\begin{pmatrix}\\\mu_1v_1&\cdots &\mu_nv_n\\{}\end{pmatrix}: \mu_i\in\mathbb R\right\}$$
So that the matrices $$\begin{pmatrix}\\0&\cdots &0&v_i&0&\cdots&0\\{}\end{pmatrix}$$
are a basis of $U$, and $\dim(U)=n$.

Here are some phrases that make me unhappy:

Since $A$ has $n$ different eigenvalues we know that the eigenvectors are linearly independent.

False. $A$ has uncountably many eigenvectors. What is true is that a set of nonzero eigenvectors belonging to different eigenvalues is linearly independent

So $rank(S)=n$,where $S$ is the matrix of eigenvectors.

Again, there are infinitely many eigenvectors, so presumably you're making a choice of eigenvectors here.

[...] since all the columns of $S$ are linearly independent we conclude that $\dim(U)=n$ where the base consists of matrices with who have one column as an eigenvector and the other ones are zero columns.

The conclusion is correct, but it is crucial to note here why it is important that $A$ has distinct eigenvalues, so that this is indeed a basis. (All eigenspaces have dimension 1.)

Self-test: Show that if $A$ is diagonalisable (say over $\mathbb R$) and the eigenspaces have dimensions $d_1,\ldots,d_k$, with $\sum_{i=1}^kd_i=n$, then $$\dim(U)=\sum_{i=1}^kd_i^2.$$
