TITLE: A Closed Form for the Diagonal Matrix Nearest an Arbitrary Square Matrix
QUESTION [8 upvotes]: If I have a square matrix in $\mathbf{A} \in \mathbb{R}^{n \times n}$, I want to find another diagonal matrix $\mathbf{D} \in \mathbb{R}^{n \times n}$ that minimizes the residual $ \min_\mathbf{D} || \mathbf{A-D} ||^2 $, where the norm here is the induced norm $\max_{x\neq 0} \frac{\mathbf{||Ax||_2}}{\mathbf{||x||_2}}$. Is there a currently-known closed form for this optimization?

REPLY [3 votes]: The case of the $2$-norm may well not have a closed form.  However, in the Frobenius norm the problem has a trivial answer: $D_A = \mathrm{diag}(A)$.  Since $\| A \|_2 \leq \| A \|_F \leq \sqrt{n} \| A \|_2$, one then has that
$$
\frac{1}{\sqrt{n}} \| A - D_A \| \leq \min_{D} \| A - D \| \leq \| A - D_A \|,
$$
which, at the least, gives a bound.