Skip to main content

Chapter 33
Expectation and Variance as Field Averages

Probability and Statistics
Author: Mark Anthony Higgins
© Mark Anthony Higgins 11 October 2025
Revised Date: 15 June 2026
Audio Overview
Flow Algebra
flow "Expectation and Variance as Field Averages"

# ---------- CONCEPT ----------
# Expectation represents the centre of coherence in a probability field — the weighted balance of outcomes.
# Variance measures the spread of coherence — how far the field extends from its mean.
# Together, they define the first and second moments of the probability distribution: balance and dispersion in the space of uncertainty.

# ---------- STATES ----------
state MomentSystem(M):
  RandomVariable:
    description: "X: Ω → ℝ — measurable distributed state."
  Distribution:
    description: "P_X or density f_X(x) — weight field describing probability distribution."
  Expectation:
    description: "E[X] = ∫ x f_X(x) dx — mean or centre of coherence."
  Variance:
    description: "Var(X) = E[(X−E[X])²] — field spread about the mean."
  HigherMoments:
    description: "μ_n = E[(X−E[X])^n] — generalised shape descriptors of distribution."
  Covariance:
    description: "Cov(X,Y) = E[(X−E[X])(Y−E[Y])] — joint coherence measure."
  Correlation:
    description: "ρ(X,Y) = Cov(X,Y)/(σ_X σ_Y) — normalised alignment of fluctuations."

# ---------- PARAMETERS ----------
params:
  density: "f_X(x) ≥ 0, ∫ f_X(x) dx = 1"
  measure_space: "(Ω, 𝒜, P)"
  integrability: "E[|X|] < ∞, E[X²] < ∞"
  normalization: "P(Ω)=1"
  independence: optional
  closure: true

# ---------- INVARIANTS ----------
invariants:
  - "E[X] = ∫ x f_X(x) dx = ∫_Ω X dP."
  - "E[aX + b] = aE[X] + b."
  - "Var(X) = E[X²] − (E[X])²."
  - "Var(aX + b) = a² Var(X)."
  - "Cov(X,Y) = E[XY] − E[X]E[Y]."
  - "Var(X+Y) = Var(X)+Var(Y)+2Cov(X,Y)."
  - "If X, Y independent ⇒ Cov(X,Y)=0 ⇒ Var(X+Y)=Var(X)+Var(Y)."
  - "E[g(X)] = ∫ g(x) f_X(x) dx (LOTUS)."
  - "Law of total expectation: E[X] = E[E[X|Y]]."
  - "Law of total variance: Var(X) = E[Var(X|Y)] + Var(E[X|Y])."

# ---------- TRANSFORMS ----------
transforms:
  ComputeExpectation(f_X):
    rule: "E[X] = ∫ x f_X(x) dx."
  ComputeVariance(f_X):
    rule: "Var(X) = ∫ (x−μ)² f_X(x) dx."
  ShiftVariable(Y=aX+b):
    rule: "E[Y]=aE[X]+b, Var(Y)=a²Var(X)."
  JointVariance(X,Y):
    rule: "Var(X+Y)=Var(X)+Var(Y)+2Cov(X,Y)."
  CovarianceCalc(f_{X,Y}):
    rule: "Cov(X,Y)=∬ (x−μ_X)(y−μ_Y) f_{X,Y}(x,y) dx dy."
  ExpectFunction(g):
    rule: "E[g(X)]=∫ g(x) f_X(x) dx."
  ConditionalExpectation(X|Y):
    rule: "E[X|Y]=∫ x f_{X|Y}(x|Y) dx — expectation as function of Y."
  TotalVarianceDecompose(X,Y):
    rule: "Var(X)=E[Var(X|Y)]+Var(E[X|Y])."
  CenterVariable(X):
    rule: "X_c = X − E[X] — mean-removed variable."

# ---------- MONITORS ----------
monitors:
  NormalisationCheck:
    measure: "∫ f_X(x) dx"
    target: 1
  MeanZeroCheck:
    measure: "E[X_c]"
    meaning: "Should equal 0 after centering."
  VarianceNonnegative:
    measure: "Var(X)"
    condition: "Var(X) ≥ 0 with equality iff X constant."
  CovarianceSymmetry:
    measure: "Cov(X,Y)−Cov(Y,X)"
    meaning: "Zero ⇒ symmetry holds."
  CorrelationBounds:
    measure: "ρ(X,Y)"
    condition: "−1 ≤ ρ ≤ 1."
  ConditionalConsistency:
    meaning: "Verify E[X]=E[E[X|Y]] (law of total expectation)."

# ---------- EQUATIONS ----------
equations:
  - "E[X] = \\int_{\\mathbb{R}} x f_X(x) dx"
  - "Var(X) = E[(X−E[X])²] = E[X²] − (E[X])²"
  - "Cov(X,Y) = E[XY] − E[X]E[Y]"
  - "ρ(X,Y) = \\frac{Cov(X,Y)}{σ_X σ_Y}"
  - "E[aX+b] = aE[X] + b"
  - "Var(aX+b) = a² Var(X)"
  - "Var(X+Y) = Var(X) + Var(Y) + 2Cov(X,Y)"
  - "E[g(X)] = \\int g(x) f_X(x) dx"
  - "E[X] = E[E[X|Y]], \\quad Var(X) = E[Var(X|Y)] + Var(E[X|Y])"
  - "LOTUS: E[g(X)] = \\int g(x) f_X(x) dx"

# ---------- NOTES ----------
notes:
  - "Expectation is the field’s balance point — the mean position of coherence weighted by probability."
  - "Variance measures the energy of fluctuation — how far the field deviates from its equilibrium centre."
  - "Linearity of expectation reflects the superposition principle of probability fields — averages combine without interference."
  - "Variance’s quadratic form reflects the stability of deviations — energy scales with square of distance from equilibrium."
  - "Covariance captures joint variation: how two distributions reinforce or counteract each other’s deviations."
  - "The law of total variance decomposes uncertainty into internal (within-group) and external (between-group) components — nested coherence levels."
  - "In Flow Algebra, expectation and variance describe the dynamic geometry of a probability field: the mean as the centroid of coherence, and variance as its field tension or dispersion energy."
Explanatory Notes

Expectation and variance describe the geometry of a probability field — its centre of balance and extent of spread.
They are not merely numbers but field descriptors, expressing how coherence distributes across uncertainty.
The expectation marks where probability balances; the variance measures how far that balance extends.

For a random variable XX with density fX(x)f_X(x), the expectation is defined as

\[ E[X] = \int_{-\infty}^{\infty} x\,f_X(x)\,dx \]

It represents the weighted centre of the distribution, the equilibrium point at which the flow of probability would balance perfectly if treated as a mass field.
In this sense, expectation is a centroid of coherence — the point about which all probabilistic influence is symmetrically distributed.

Because expectation is linear, it obeys the principle of superposition:

\[ E[aX + bY] = aE[X] + bE[Y] \]

It quantifies the energy of fluctuation, the field’s internal tension relative to its balance point.
A large variance means the probability field is wide and diffuse; a small one means the field is narrow and stable.
Variance is therefore a measure of stability in coherence — how tightly or loosely the distribution holds around its centre.

When two random variables XX and YY interact, their covariance

\[ \mathrm{Cov}(X, Y) = E\!\left[(X - E[X])(Y - E[Y])\right] \]

measures how their deviations align.
If both rise and fall together, covariance is positive; if one increases while the other decreases, it is negative.
When covariance is zero, their fluctuations are uncorrelated — independent directions of variation in the field.
Normalising covariance by the product of standard deviations gives the correlation coefficient,

\[ \rho(X, Y) = \frac{\mathrm{Cov}(X, Y)}{\sigma_X \sigma_Y} \]

a pure measure of alignment ranging from –1 (opposite flow) to +1 (perfect coherence).

Expectation and variance generalise to conditional and hierarchical systems through the laws of total expectation and total variance:

\[ E[X] = E[E[X \mid Y]], \qquad \mathrm{Var}(X) = E[\mathrm{Var}(X \mid Y)] + \mathrm{Var}(E[X \mid Y]) \]

These express how global coherence decomposes into nested layers: internal variation (within boundaries) and external variation (between boundaries).
They reveal the recursive structure of uncertainty — coherence within coherence — the way probability distributes across levels of description.

In Flow Algebra, expectation and variance are not static statistics but field operators:

  • E[X]E[X] locates the centroid of probability flow, the mean position of coherence.
  • Var(X)\mathrm{Var}(X) measures the tension of that flow, the squared deviation energy around equilibrium.

Expectation is the geometry of balance; variance is the geometry of deviation.
Together they describe the dynamic structure of probabilistic fields — how uncertainty centres, spreads, and stabilises itself through internal equilibrium.

These two quantities, simple in form yet profound in meaning, form the foundation of statistical geometry:
the mathematics of how coherence finds its centre,
and how the field around that centre holds itself together through balanced variation.

Related Chapters
Kireth Research
38 Thorndale Croft, Wetwang, Driffield
East Riding of Yorkshire YO25 9XZ