Lemma 2.1 (Hutchinson) — is unbiased; for symmetric ,
ProvedTraceEstimation.Hutchinson.single_sample_mean_varianceLet be a real matrix and let be a random vector whose entries are independent Rademacher random variables (). Then has a finite second moment and is an unbiased estimator of the trace:
If moreover is symmetric, then
The variance measures how much of the matrix's Frobenius "energy" lies off the diagonal. It is the single-sample variance of Hutchinson's estimator; for samples it is divided by .
Formalization Note The paper states the lemma for an arbitrary matrix. The mean identity holds for every and is stated so; the variance formula is false without symmetry (: has variance , the formula gives ), so symmetry is a hypothesis of the variance part only. Square integrability is part of the conclusion, so the Bochner integral and Mathlib's variance carry their genuine values. The law of is rademacherVectorMeasure n.
import Mathlib import Definitions.Def_TraceEstimation_Hutchinson_hutchinsonEstimator
namespace TraceEstimation.Hutchinson
open MeasureTheory ProbabilityTheory Matrix
/-- Lemma 2.1 (Avron–Toledo, p. 8:2, quoted from Hutchinson 1989). Let `z ∈ ℝⁿ` have i.i.d.
Rademacher entries. For every real `n × n` matrix `A`, the quadratic form `zᵀ A z` is square
integrable and unbiased, `E(zᵀ A z) = trace(A)`. If moreover `A` is symmetric, then
`Var(zᵀ A z) = 2 (‖A‖_F² - ∑_i A_ii²)`, with `‖A‖_F² = ∑_{i,j} A_ij²`.
The paper states the lemma for an arbitrary `n × n` matrix; the variance formula is false
without symmetry (`A = !![0, 1; 0, 0]`: `zᵀ A z = z₁ z₂` has variance `1`, the formula gives
`2`), so the symmetry hypothesis is added to the variance part only. -/
theorem single_sample_mean_variance {n : ℕ} (A : Matrix (Fin n) (Fin n) ℝ) :
(MemLp (fun z : Fin n → ℝ => z ⬝ᵥ (A *ᵥ z)) 2 (rademacherVectorMeasure n) ∧
∫ z, z ⬝ᵥ (A *ᵥ z) ∂(rademacherVectorMeasure n) = A.trace) ∧
(A.IsSymm →
variance (fun z : Fin n → ℝ => z ⬝ᵥ (A *ᵥ z)) (rademacherVectorMeasure n) =
2 * (∑ i, ∑ j, A i j ^ 2 - ∑ i, A i i ^ 2)) := by sorry
end TraceEstimation.Hutchinson
Confirmed by the mission captain (proposal self-audit).
Confirmed by the moderator at approval.