TITLE: Is every square matrix a sum of a diagonal matrix and a nilpotent matrix
QUESTION [13 upvotes]: The question is in the title. I am working with complex matrices. This is true for $2\times 2$ matrices, but becomes complicated already for $3\times 3$ matrices if we try to brute force it. By brute force, I mean taking an arbitrary $3\times 3$ matrix and imposing conditions on the diagonal entries so that the matrix is nilpotent.
A follow up question for matrices which can be expressed as a sum of diagonal and nilpotent matrices is whether there are infinitely many ways of doing this? This feels unlikely because the final answer seems to depend on solving $n$ independent polynomial equations in $n$ variables, but I might be wrong.

REPLY [10 votes]: This is always possible. Given $A \in M_n(\mathbb{C})$, we need to find a diagonal matrix $D$ such that $A - D$ is nilpotent. By a well-known result, this is equivalent to requiring that $\operatorname{tr}((D - A)^k) = 0$ for $1 \leq k \leq n$. Denote the diagonal entries of $D$ by $x_1, \dots, x_n$. Written explicitly, the conditions
$$ \operatorname{tr}(D-A) = \operatorname{tr}((D-A)^2) = \dots = \operatorname{tr}((D-A)^n) = 0 $$
gives us a system of $n$ polynomial equations for $x_1,\dots,x_n$ of degrees $1,\dots,n$:
$$ \operatorname{tr}(D) - \operatorname{tr}(A) = 0, \\
\operatorname{tr}(D^2) - 2\operatorname{tr}(DA) + \operatorname{tr}(A^2) = 0, \\
\operatorname{tr}(D^3) - 3\operatorname{tr}(D^2A) + 3\operatorname{tr}(DA^2) - \operatorname{tr}(A^3) = 0, \\
\vdots \\
\operatorname{tr}(D^n) + \textrm{ lower order terms } + (-1)^n \operatorname{tr}(A^n) = 0.
$$
We can homogenize the equations by adding an extra variable $w$ and then they will have the form:
$$ \operatorname{tr}(D) - w\operatorname{tr}(A) = 0, \\
\operatorname{tr}(D^2) - 2w\operatorname{tr}(DA) + w^2\operatorname{tr}(A^2) = 0, \\
\operatorname{tr}(D^3) - 3w\operatorname{tr}(D^2A) + 3w^2\operatorname{tr}(DA^2) - w^3\operatorname{tr}(A^3) = 0, \\
\vdots \\
\operatorname{tr}(D^n) + w \cdot \left( \textrm{lower order terms} \right) = 0.
$$
Now, Bézout's theorem guarantees that the homogenized system has either infinitely many solutions in
$$\mathbb{P}^n = \{ [x_1 : \dots : x_n : w] \, | \, (x_1, \dots, x_n,w) \in \mathbb{C}^{n+1} \setminus \{ \vec{0} \} \},$$
or, if it has finitely many solutions, then the number of solutions is $1 \cdot 2 \cdot \dots \cdot n = n!$, counted with multiplicities. Any solution $[x_1 : \dots : x_n : w]$ of the homogenized system for which $w \neq 0$ gives us a solution $\left( \frac{x_1}{w},  \dots, \frac{x_n}{w} \right)$ to the original system of equations while solutions of the form $[x_1 \dots : x_n : 0]$ correspond to extra solutions we have possibly added by moving to the projective space. However, if $w = 0$, the homogenized system of equations becomes
$$ \operatorname{tr}(D) = \operatorname{tr}(D^2) = \dots = \operatorname{tr}(D^n) = 0. $$
This implies that $D$ is both nilpotent and diagonal so $D = 0$ which means that the homogenized system has no solutions of the form $[x_1 : \dots : x_n : 0]$. Hence, we haven't added any solutions by moving to the projective space and the bottom line is that the original system has either infinitely many solutions or $n!$ solutions, counted with multiplicities. In any case, such a $D$ always exist.

A few comments:

If you only care about the existence of $D$, you only need to know that the zero set of $n$ homogeneous equations in $\mathbb{P}^n$ is always non-empty. This is certainly weaker than Bézout's theorem but I'm not an expert and have no idea if this result by itself has an "elementary" proof.
The argument depends heavily on the fact that $\mathbb{C}$ is algebraically closed. You can verify by a direct calculation that the result is false for $2 \times 2$ real matrices.
Generically, one expects the number of different ways to write $A$ as a sum of nilpotent and a diagonal matrix to be $n!$. It can certainly be less (this already happens for $2 \times 2$ matrices and corresponds to solutions with multiplicities) but I suspect that it will always be finite. Geometrically, this should correspond to the fact that the $n$ different hypersurfaces defined by the equations have "no common components" but I don't know how to justify this rigourously.