Let A∈Rn×n be a symmetric matrix with eigendecomposition A=∑i=1nλiuiuiT, where λi are the eigenvalues and ui are the orthonormal eigenvectors of A.
Recall the matrix function
A natural approach is to combine the implicit trace estimation algorithms discussed earlier in this chapter with black-box methods for approximating x↦xTf(A)x or x↦f(A)x, such as the Lanczos method for matrix functions.
Recall that using k−1 matrix-vector products with A, the Lanczos method for quadratic forms produces an approximation Lan-QFk(f;A,x) that is an approximation to xTf(A)x.
Stochastic Lanczos Quadrature (SLQ) simply combines this method with the Girard-Hutchinson trace estimator.
A simple application of the triangle inequality gives a bound on expected squared error of the SLQ estimator.
Proof
By the triangle inequality and since (x+y)2≤2(x2+y2), we have
As with implicit trace estimation, the accuracy of SLQ can be improved using a control variate.
In particular, suppose F is a low-rank approximation to f(A) whose trace we can compute exactly.
Since
The variance of this estimator scales with ∥f(A)−F∥F2 rather than ∥f(A)∥F2, so it can be substantially more accurate when F is a good approximation to f(A).
Techniques for efficiently obtaining a low-rank approximation to f(A) are described in Matrix function low-rank approximation.
In particular, Krylov-aware methods Chen & Hallman, 2023Persson et al., 2025 were developed with this application in mind, and for operator monotone functions, a suitable F can be obtained using products with A only.
Chen, T., Trogdon, T., & Ubaru, S. (2025). Randomized Matrix-Free Quadrature: Unified and Uniform Bounds for Stochastic Lanczos Quadrature and the Kernel Polynomial Method. SIAM Journal on Scientific Computing, 47(3), A1733–A1757. 10.1137/23m1600414
Trefethen, L. N. (2019). Approximation Theory and Approximation Practice, Extended Edition. Society for Industrial. 10.1137/1.9781611975949
Chen, T., & Hallman, E. (2023). Krylov-Aware Stochastic Trace Estimation. SIAM Journal on Matrix Analysis and Applications, 44(3), 1218–1244. 10.1137/22m1494257
Persson, D., Chen, T., & Musco, C. (2025). Randomized block-Krylov subspace methods for low-rank approximation of matrix functions. https://arxiv.org/abs/2502.01888