Variance equals the second moment minus the square of the mean
ProvedNarrowDNF.Influence.variance_eq_secondMomentcombinatoricsnarrow-dnf-authors-importprobabilitystoc-2027
For a finite Boolean cube, let and . Define . For every real parameter and real function ,
For this is the usual probability identity. The finite algebraic formulation also holds outside that interval, where the weights can be signed.
Preamble
import Mathlib.Algebra.BigOperators.Ring.Finset
import Mathlib.Algebra.Order.BigOperators.Group.Finset
import Mathlib.Algebra.Order.BigOperators.Ring.Finset
import Mathlib.Data.Fintype.BigOperators
import Mathlib.Data.Fintype.Pi
import Mathlib.Data.Real.Basic
import Mathlib.Logic.Equiv.Prod
import Mathlib.Tactic.Linarith
import Mathlib.Tactic.Ring
import Definitions.Def_NarrowDNF_Influence
import Definitions.Def_NarrowDNF_ProductMeasure
namespace NarrowDNF.Influence
end NarrowDNF.Influence
namespace NarrowDNF.ProductMeasure
end NarrowDNF.ProductMeasure
noncomputable section
open scoped BigOperators
open NarrowDNF
open NarrowDNF.Influence
section Cube
variable {ι : Type*} [Fintype ι] [DecidableEq ι]
Formal statement
theorem NarrowDNF.Influence.variance_eq_secondMoment (p : ℝ) (F : (ι → Bool) → ℝ) :
variance p F = ProductMeasure.expectation p (fun x => F x ^ 2) -
ProductMeasure.expectation p F ^ 2 := by sorrySource