Solution (source code)

= Solution

The <Weyl-von Neumann theorem> states that on a separable <Hilbert space> a <self-adjoint operator> is a diagonal <self-adjoint operator> plus a compact <self-adjoint operator>. For a bounded operator $T$, the perturbation can in fact be chosen Hilbert-Schmidt with arbitrarily small <Hilbert-Schmidt norm>. The separable-space formulation is also recorded in https://www.isibang.ac.in/~soumyashant/misc/collected-works-of-kadison/1980s/1988_The_Weyl_theorem_and_block_decompositions.pdf[Kadison's Corollary B].

Here is a constructive proof. The bounded self-adjoint spectral theorem decomposes a separable $H$ into countably many cyclic reducing spaces, on each of which $T$ is multiplication by $x$ in $L^2(\mu)$ for a finite measure supported in a bounded real interval. First work on one such space. Partition the interval into $N$ intervals of length at most $\delta$, and repeatedly bisect them. Let $E_j$ be the finite-dimensional space of functions constant on the level-$j$ intervals. These spaces are nested and their union is dense, since dyadic step functions approximate continuous functions and continuous functions are dense in $L^2(\mu)$.

Choose normalized interval indicators as a basis of $E_0$, and choose <orthonormal bases> of $E_j\ominus E_{j-1}$ within each parent interval. This is possible because the refinement splits into orthogonal parent blocks. Each new basis vector at level $j\geq1$ is supported in an interval of length at most $\delta2^{-(j-1)}$, and there are at most $N2^{j-1}$ such vectors. For every basis vector $e$ choose a real $\lambda_e$ in its supporting interval and define the diagonal operator $De=\lambda_e e$. Then
$$
\|(T-D)e\|\leq\text{length of its supporting interval},
$$
so
$$
\|T-D\|_{\mathrm{HS}}^2
=\sum_e\|(T-D)e\|^2
\leq N\delta^2+\sum_{j\geq1}N2^{j-1}\delta^22^{-2(j-1)}
=3N\delta^2.
$$
One may take $N=O(\delta^{-1})$, so this bound tends to zero as $\delta\to0$. The error is Hilbert-Schmidt, hence compact; it is self-adjoint because both $T$ and $D$ are.

On the countably many cyclic summands choose error bounds $\varepsilon_j$ with $\sum_j\varepsilon_j^2<\varepsilon^2$. Combining their <orthonormal bases> and diagonal operators gives $T=D+K$ with $\|K\|_{\mathrm{HS}}<\varepsilon$, proving the assertion. For an unbounded <self-adjoint operator>, first split by spectral intervals $[j,j+1)$, apply the bounded construction on each, and choose summable error bounds. The resulting total $K$ is bounded compact, and $D=T-K$ has the same domain as $T$; the diagonal domain condition follows from the boundedness of $K$.

Separability matters. Take an uncountable orthogonal sum of copies of multiplication by $x$ on $L^2[0,1]$. The range closure of a <compact operator> is separable, and a separable subspace of this direct sum is supported in only countably many summands: choose a countable dense set and unite its countable supports. A self-adjoint compact error therefore vanishes on every remaining summand, each of which reduces the proposed diagonal operator $D=T-K$. The restriction of a diagonal self-adjoint operator to a reducing subspace has pure point spectrum, whereas multiplication by $x$ on $L^2[0,1]$ has no eigenvectors. This is a contradiction, qualifying the theorem if the unspoken separability convention is dropped.