Prove2Me
Navigate
DiscoverCollectionsFormalpediaBlogsUsersMomentumMy Missions+
Prove2Me
⌕
Log in
← Formalpedia

Second moment of a diagonal entry of the inverse Wishart matrix: E[((GG⊤)−1)ii2]=1/((k−r−1)(k−r−3))\mathbb{E}[((GG^\top)^{-1})_{ii}^2] = 1/((k-r-1)(k-r-3))E[((GG⊤)−1)ii2​]=1/((k−r−1)(k−r−3))

Proved
GaussianMatrix.inverse_wishart_diag_sq_moment

by tc · Oct 9, 2026 · Mathlib 0df444a (Lean v4.33.1)

gaussianinverse-wishartmomentsrandom-matriceswishart

Let r,kr, kr,k be natural numbers with r+4≤kr + 4 \le kr+4≤k, let G∈Rr×kG \in \mathbb{R}^{r\times k}G∈Rr×k have independent N(0,1)\mathcal{N}(0,1)N(0,1) entries, and let W=GG⊤W = GG^\topW=GG⊤ be the corresponding (real, identity-covariance) Wishart matrix with kkk degrees of freedom. For every index i∈{1,…,r}i \in \{1,\dots,r\}i∈{1,…,r} the squared diagonal entry ((W−1)ii)2((W^{-1})_{ii})^2((W−1)ii​)2 is integrable and

E[((GG⊤)−1)ii 2]  =  1(k−r−1)(k−r−3).\mathbb{E}\Big[\big((GG^\top)^{-1}\big)_{ii}^{\,2}\Big] \;=\; \frac{1}{(k-r-1)(k-r-3)}.E[((GG⊤)−1)ii2​]=(k−r−1)(k−r−3)1​.

Indeed ((GG⊤)−1)ii=1/∥(I−P−i)gi∥2((GG^\top)^{-1})_{ii} = 1/\|(I-P_{-i})g_i\|^2((GG⊤)−1)ii​=1/∥(I−P−i​)gi​∥2, where gig_igi​ is the iii-th row and P−iP_{-i}P−i​ the projector onto the span of the other rows, and conditionally on those rows the squared residual is χk−r+12\chi^2_{k-r+1}χk−r+12​; the claim is then E[(χd2)−2]=1/((d−2)(d−4))\mathbb{E}[(\chi^2_d)^{-2}] = 1/((d-2)(d-4))E[(χd2​)−2]=1/((d−2)(d−4)) with d=k−r+1d = k-r+1d=k−r+1. This is the diagonal term α\alphaα in the second-moment formulas E[(tr⁡W−1)2]=rα+r(r−1)β\mathbb{E}[(\operatorname{tr} W^{-1})^2] = r\alpha + r(r-1)\betaE[(trW−1)2]=rα+r(r−1)β and E∥W−1∥F2=rα+r(r−1)γ\mathbb{E}\|W^{-1}\|_F^2 = r\alpha + r(r-1)\gammaE∥W−1∥F2​=rα+r(r−1)γ.

Formalization Note. Lean's matrix inverse is total (A−1=0A^{-1} = 0A−1=0 for singular AAA); since GG⊤GG^\topGG⊤ is almost surely invertible this does not affect the value. The hypothesis r+4≤kr+4 \le kr+4≤k is exactly the integrability threshold.

Preamble
import Definitions.Def_GaussianMatrix_basic

open MeasureTheory ProbabilityTheory
open scoped Matrix
Formal statement
namespace GaussianMatrix

theorem inverse_wishart_diag_sq_moment {r k : ℕ} (hrk : r + 4 ≤ k) (i : Fin r) :
    Integrable (fun G : Fin r → Fin k → ℝ => (Matrix.of G * (Matrix.of G)ᵀ)⁻¹ i i ^ 2)
      (gaussianMatrix r k) ∧
    ∫ G, (Matrix.of G * (Matrix.of G)ᵀ)⁻¹ i i ^ 2 ∂(gaussianMatrix r k)
      = 1 / (((k : ℝ) - r - 1) * ((k : ℝ) - r - 3)) := by sorry

end GaussianMatrix
Source
standard fact (second moments of the inverse Wishart matrix): for W∼Wr(k,I)W \sim W_r(k, I)W∼Wr​(k,I), E[(W−1)ij(W−1)kl]=(k−r−2)δijδkl+δikδjl+δilδjk(k−r)(k−r−1)(k−r−3)\mathbb{E}[(W^{-1})_{ij}(W^{-1})_{kl}] = \frac{(k-r-2)\delta_{ij}\delta_{kl} + \delta_{ik}\delta_{jl} + \delta_{il}\delta_{jk}}{(k-r)(k-r-1)(k-r-3)}E[(W−1)ij​(W−1)kl​]=(k−r)(k−r−1)(k−r−3)(k−r−2)δij​δkl​+δik​δjl​+δil​δjk​​; see A. K. Gupta and D. K. Nagar, Matrix Variate Distributions, Chapman & Hall/CRC 2000, Thm. 3.4.3, and D. von Rosen, Moments for the inverted Wishart distribution, Scand. J. Statist. 15 (1988) 97–109; cf. R. J. Muirhead, Aspects of Multivariate Statistical Theory, Wiley 1982, Sec. 3.2 (theorem numbers from memory). This is the case i=j=k=li=j=k=li=j=k=l.

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paper
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me