A question on commutation of matrices Given a diagonal matrix $D$, and a nilpotent matrix $N$, do we always have $DN=ND$? If not so, what further conditions do we need to have it?
This question came form an ODE/Linear Algebra problem: Give $A\in \mathcal{M}_{n\times n}(\mathbb{R})$, there exists an invertible matrix $P$, and a matrix $B=D+N$, $D$ diagonal and $N$ nilpotent,  such that $A=PBP^{-1}$. Moreover, it is stated that $DN=ND$. Why?
 A: Certainly not in general: consider, for example $D = \left(\begin{array}{clcr}1&0\\0&-1 \end{array} \right)$ and $N = \left(\begin{array}{clcr}0&1\\0&0 \end{array} \right)$.
A necessary and sufficient condition for diagonal $D$ and nilpotent $N$ to commute is that whenever $v$ is an eigenvector of $D$ with eigenvalue $\lambda$, then $Nv$ is either an eigenvector of $D$ with eigenvalue $\lambda$ or is the zero vector. ( That is, each eigenspace of $D$ is $N$-invariant).
Later edit in response to amended question. It is true that every square complex matrix $A$ may be written in the form $A = D+N$ with $D$ diagonalizable- not necessarily diagonal- and $N$ nilpotent, and with $DN = ND$. Equivalently, there is an invertible matrix $P$ such that $P^{-1}AP = D'+N'$, where $D'$ is genuinely diagonal and $N'$ is nilpotent and $D' N' = N' D'$. This is the Jordan decomposition, closely related to Jordan normal form. It is useful because it makes it fairly easy to compute $\exp(A)$ for a matrix $A$, for example. It is the case that $D$ and $N$ may both be expressed as polynomials in $A$, so they both commute with $A$ and they commute with each other.
A: Let $J_k(\lambda)$ denote the Jordan block of size $k$ associated with $\lambda$.  Let $A_1 \oplus A_2 \oplus \cdots \oplus A_m$ denote the block-diagonal matrix
$$
\pmatrix{A_1 \\ & A_2 \\&& \ddots \\ &&& A_m}
$$
We note that for two block diagonal matrices partitioned in the same fashion, we have
$$
(A_1 \oplus A_2 \oplus \cdots \oplus A_m)+
(B_1 \oplus B_2 \oplus \cdots \oplus B_m) = 
(A_1 + B_1) \oplus (A_2 + B_2) \oplus \cdots \oplus (A_m + B_m)
\\
(A_1 \oplus A_2 \oplus \cdots \oplus A_m)
(B_1 \oplus B_2 \oplus \cdots \oplus B_m) = 
(A_1 B_1) \oplus (A_2B_2) \oplus \cdots \oplus (A_m B_m)
$$
Now, the Jordan form of the matrix $A$ can be written as
$$
J = J_{k_1}(\lambda_1) \oplus J_{k_2}(\lambda_2) \oplus \cdots \oplus J_{k_m}(\lambda_m)
$$
Let $I_k$ denote the identity matrix of size $k$.  We define
$$
D = (\lambda_1 I_{k_1}) \oplus (\lambda_2 I_{k_2}) \oplus \cdots \oplus (\lambda_m I_{k_m})\\
N = J_{k_1}(0) \oplus J_{k_2}(0)\oplus \cdots \oplus J_{k_m}(0)
$$
Verify that $J = D + N$, and that $DN = ND$.
A: Here's a simple example of $DN\ne ND$:
$$
  DN=\left[\begin{array}{cc}1 & 0 \\ 0 & 2\end{array}\right]\left[\begin{array}{cc}0 & 1 \\ 0 & 0\end{array}\right] =
  \left[\begin{array}{cc}0 & 1 \\ 0 & 0\end{array}\right] \\
  ND=\left[\begin{array}{cc}0 & 1 \\ 0 & 0\end{array}\right]\left[\begin{array}{cc}1 & 0 \\ 0 & 2\end{array}\right] =
  \left[\begin{array}{cc}0 & 2 \\ 0 & 0\end{array}\right]
$$
