A Tight Analysis of Hutchinson's Diagonal Estimator

Prathamesh Dharangutte, Christopher Musco

TL;DR

This paper provides a "tight" theoretical analysis of Hutchinson’s diagonal estimator, a popular algorithm for approximating the diagonal of a large matrix using only matrix-vector multiplications. The authors prove that the estimator's error is independent of the matrix dimension ($n$), removing a $\log(n)$ factor present in previous analyses and showing that the method is even more efficient for high-dimensional problems than previously theorized.

What Problem Does This Paper Address?

In many fields—ranging from machine learning (optimizing Hessians) to geophysics—researchers need to know the diagonal entries of a massive square matrix $\mathbf{A}$. However, $\mathbf{A}$ is often too large to store or compute explicitly. We only have "implicit" access to it via matrix-vector products (i.e., we can compute $\mathbf{A}x$ for any $x$).

Hutchinson’s estimator is the standard tool for this: you multiply $\mathbf{A}$ by several random vectors $\mathbf{g}$ (usually with $\pm 1$ entries) and perform an entry-wise product to extract diagonal information. While practically successful, theoretical guarantees were lagging. Previous work suggested that the number of samples needed to achieve a certain accuracy grew with the size of the matrix ($O(\log n)$). This paper asks: Does the complexity really depend on the dimension $n$, or is Hutchinson's estimator "dimension-independent"?

Methods

The authors employ several sophisticated probabilistic techniques to sharpen the error bounds:

  • Symmetrization and Scalar Comparison: Instead of analyzing the error vector directly, they use a symmetrization argument to compare its moments to a simpler scalar random variable.
  • Connection to Trace Estimation: They show that the squared error of the diagonal estimator is identically distributed to Hutchinson’s trace estimator applied to a specific positive semi-definite matrix ($\mathbf{B} = \bar{\mathbf{A}}^T \bar{\mathbf{A}}$). This allows them to leverage the well-developed theory of trace estimation (like the Hanson-Wright inequality).
  • Vector-valued Bernstein Inequalities: They refine the analysis of how the stochastic error concentrates around zero, avoiding the "union bound" over entries that typically introduces the unwanted $\log(n)$ factor.

Datasets

Not discussed in the paper. This is a purely theoretical/mathematical work focused on proving convergence theorems and error bounds. No empirical experiments or datasets were used.

Key Insights and Ideas

  • Dimension Independence: The most significant "aha moment" is that the error depends only on the Frobenius norm of the off-diagonal elements ($\|\bar{\mathbf{A}}\|_F$) and the number of samples ($m$), not the size of the matrix ($n$). This makes the estimator highly scalable for "Big Data" applications.
  • The Rademacher Advantage: The paper highlights why Rademacher random vectors ($\pm 1$) are often superior to Gaussian vectors for this task. Because the 4th moment of a Rademacher variable is exactly 1, the expected error is strictly smaller than it would be with Gaussians (where the 4th moment is 3).
  • Tightness: The authors provide a simple $2 \times 2$ matrix example to show that their bound is "tight"—meaning it is mathematically impossible to prove a better bound for this specific estimator.

Key Results

  • Theorem 1 (Main Result): For a matrix $\mathbf{A}$, Hutchinson’s estimator $\mathbf{r}^m(\mathbf{A})$ using $m$ Rademacher samples achieves: $$\|\mathbf{r}^m(\mathbf{A}) - \text{diag}(\mathbf{A})\|_2 \le c \sqrt{\frac{\log(2/\delta)}{m}} \|\bar{\mathbf{A}}\|_F$$ with probability $1-\delta$. This confirms that to reach an error $\epsilon$, we only need $m = O(\log(1/\delta)/\epsilon^2)$ samples, regardless of $n$.

  • Generalized Estimators: They extend the analysis to non-Rademacher vectors (like Gaussians). While these also achieve dimension-independent bounds, they require a slightly more complex "median trick" or accept a slightly worse error constant due to higher 4th moments.

Limitations and Future Work

  • Non-Rademacher "Log" Terms: For generalized sub-Gaussian estimators (Theorem 7), the bound still contains an extra $\log^4(1/\delta)/m^2$ term. The authors suspect this is a technical artifact of their proof and could potentially be removed.
  • Lower Bounds: While the analysis of this specific estimator is tight, it remains an open question whether a different algorithm could perform even better in the matrix-vector product model.
  • Structured Matrices: The current analysis is general; future work could explore if specific matrix structures (like sparsity or low-rank off-diagonals) allow for even faster convergence.

Summary updated

BibTeX
@inproceedings{dharangutte2023tight,
  author = {Prathamesh Dharangutte and Christopher Musco},
  title = {{A Tight Analysis of Hutchinson's Diagonal Estimator}},
  booktitle = {SOSA},
  year = {2023},
  doi = {10.1137/1.9781611977585.ch32},
}
Figure