# When does a real-valued function of a matrix depend only on eigenvalues?

Let $\mathcal{N}$ be the space of all $n \times n$ matrices that are similar to some nonnegative matrix with zero diagonal and let $f: \mathcal{N} \to \mathbb{R}$ be a continuously differentiable function. What are the lightest assumptions I can impose on $f$ to obtain that $f(M)$ it depends only on eigenvalues on $M$? Of course I can require that $f(M)$ be invariant to similarity transformations of $M$. But I would like something lighter. Ideally, I'd like to know that it suffices to assume only that $f(D M D^{-1})=f(M)$ for any diagonal, nonnegative matrix $D$.

I wonder If continuity of $f$ and thinking about nearby matrices gets any additional traction, though. –  Ben Golub Nov 9 '12 at 15:59
Clearly not. Conjugating by a diagonal matrix does not change the diagonal entries of $M$. The diagonal entries are trivially continuous functions. They are not similarity invariant. –  Will Sawin Nov 9 '12 at 16:14