Skip to main content

Chapter 37
Correlation and Covariance — Shared Coherence

Probability and Statistics
Author: Mark Anthony Higgins
© Mark Anthony Higgins 11 October 2025
Revised Date: 15 June 2026
Audio Overview
Flow Algebra
flow "Correlation and Covariance — Shared Coherence"

# ---------- CONCEPT ----------
# Covariance and correlation describe how two random variables share coherence — how their fluctuations align or oppose.
# Covariance measures the joint strength and direction of variation; correlation normalises this measure, revealing the degree of alignment independent of scale.
# Together, they form the geometry of dependency in probability space — the structure of shared flow between distributions.

# ---------- STATES ----------
state CoherenceSystem(C):
  RandomVariables:
    description: "X, Y — measurable distributed states on (Ω, 𝒜, P)."
  JointDistribution:
    description: "P_{X,Y}(x,y) — joint probability describing combined behaviour."
  MarginalDistributions:
    description: "P_X(x), P_Y(y) — individual distributions of X and Y."
  Covariance:
    description: "Cov(X,Y) = E[(X−E[X])(Y−E[Y])] — shared variation."
  Correlation:
    description: "ρ(X,Y) = Cov(X,Y)/(σ_X σ_Y) — normalised coherence measure."
  CovarianceMatrix:
    description: "Σ = E[(X−μ)(X−μ)^T] — multidimensional generalisation of joint coherence."
  Independence:
    description: "X ⟂ Y ⇔ P_{X,Y} = P_X P_Y ⇒ Cov(X,Y)=0 (for linear dependence)."

# ---------- PARAMETERS ----------
params:
  integrability: "E[X²], E[Y²] < ∞"
  centering: "μ_X=E[X], μ_Y=E[Y]"
  variances: "σ_X²=Var(X), σ_Y²=Var(Y)"
  closure: true

# ---------- INVARIANTS ----------
invariants:
  - "Cov(X,Y) = E[XY] − E[X]E[Y]."
  - "Var(X) = Cov(X,X)."
  - "Cov(aX+b, cY+d) = ac Cov(X,Y)."
  - "Var(aX+b) = a²Var(X)."
  - "ρ(X,Y) = Cov(X,Y)/(σ_X σ_Y)."
  - "−1 ≤ ρ(X,Y) ≤ 1."
  - "If ρ(X,Y)=0 ⇒ uncorrelated (no linear relation)."
  - "For jointly Gaussian X,Y: ρ=0 ⇔ independence."
  - "Covariance matrix Σ symmetric, positive semidefinite."
  - "Eigenvectors of Σ define principal directions of variance (PCA basis)."
  - "Total variance (trace Σ) = sum of eigenvalue variances."

# ---------- TRANSFORMS ----------
transforms:
  ComputeCovariance(X,Y):
    rule: "Cov(X,Y) = E[(X−E[X])(Y−E[Y])]."
  ComputeCorrelation(X,Y):
    rule: "ρ(X,Y) = Cov(X,Y)/(σ_X σ_Y)."
  Standardise(X):
    rule: "Z_X = (X−E[X])/σ_X (z-score normalisation)."
  CovarianceMatrixFromData(X):
    rule: "Σ = (1/n) Σ_i (x_i − μ)(x_i − μ)^T."
  CorrelationMatrixFromCov(Σ):
    rule: "R_{ij} = Σ_{ij}/√(Σ_{ii}Σ_{jj})."
  AffineTransform(X):
    rule: "Y = A X + b ⇒ Σ_Y = A Σ_X A^T."
  CovarianceOfSum(X,Y):
    rule: "Var(X+Y) = Var(X)+Var(Y)+2Cov(X,Y)."
  ConditionalCovariance(X|Y):
    rule: "Σ_{X|Y} = Σ_{XX} − Σ_{XY}Σ_{YY}^{−1}Σ_{YX}."
  PCA_Decomposition(Σ):
    rule: "Σ = PΛP^T ⇒ decorrelate via Z = P^T(X−μ)."

# ---------- MONITORS ----------
monitors:
  SymmetryCheck:
    measure: "Cov(X,Y)−Cov(Y,X)"
    meaning: "Zero ⇒ symmetry holds."
  CorrelationBounds:
    measure: "ρ(X,Y)"
    condition: "−1 ≤ ρ ≤ 1."
  IndependenceTest:
    meaning: "Check if P_{X,Y} = P_X P_Y ⇒ Cov=0."
  PositiveSemidefiniteCheck:
    measure: "v^T Σ v"
    condition: "≥0 for all v (covariance matrix valid)."
  PCA_VarianceCapture:
    meaning: "Fraction of total variance captured by first k eigenmodes."
  MulticollinearityCheck:
    meaning: "Detect strong correlations (|ρ|≈1) among variables."

# ---------- EQUATIONS ----------
equations:
  - "Cov(X,Y) = E[(X−E[X])(Y−E[Y])]"
  - "Cov(X,Y) = E[XY] − E[X]E[Y]"
  - "Var(X) = Cov(X,X)"
  - "ρ(X,Y) = \\frac{Cov(X,Y)}{σ_X σ_Y}, \\quad −1 ≤ ρ ≤ 1"
  - "Σ = E[(X−μ)(X−μ)^T]"
  - "Var(X+Y) = Var(X)+Var(Y)+2Cov(X,Y)"
  - "Σ_Y = AΣ_XA^T"
  - "Σ_{X|Y} = Σ_{XX} − Σ_{XY}Σ_{YY}^{−1}Σ_{YX}"
  - "R_{ij} = \\frac{Σ_{ij}}{\\sqrt{Σ_{ii}Σ_{jj}}}"
  - "Eigendecomposition: Σ = PΛP^T, Λ=diag(λ_1,…,λ_d), λ_i≥0"

# ---------- NOTES ----------
notes:
  - "Covariance measures joint deviation — the shared movement of two variables relative to their means."
  - "Correlation rescales covariance into a dimensionless measure of alignment — removing dependence on magnitude or units."
  - "Positive covariance/correlation: variables rise and fall together; negative: one rises as the other falls."
  - "The covariance matrix generalises this structure — its off-diagonal entries encode shared coherence between dimensions."
  - "Decorrelating via PCA rotates the system to orthogonal axes, eliminating shared covariance — independent modes of variation."
  - "Covariance quantifies the strength of shared fluctuation; correlation quantifies its purity — how perfectly aligned those fluctuations are."
  - "In Flow Algebra, covariance represents the coupling of coherence between flows, while correlation expresses the normalised symmetry of that coupling — shared coherence as measurable alignment in the probability field."
Explanatory Notes

Covariance and correlation describe how two random variables share coherence — how their movements align, oppose, or drift independently within a probabilistic field.
They reveal the internal geometry of uncertainty: not only how wide a variable spreads (its variance), but how its fluctuations relate to those of another variable.

In this way, covariance and correlation are the mathematics of connection — quantifying the symmetry or coupling between probabilistic flows.

The covariance between two random variables XX and YY is defined as

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

or equivalently,

\[ \mathrm{Cov}(X, Y) = E[XY] - E[X]E[Y] \]

It measures how XX and YY vary together relative to their means.
If both tend to increase or decrease in tandem, the covariance is positive; if one tends to rise when the other falls, it is negative.

A zero covariance means their fluctuations are uncorrelated — no linear relationship, even if nonlinear structure might remain.

The variance itself is a special case of covariance,

\[ \mathrm{Var}(X) = \mathrm{Cov}(X, X) \]

and represents the self-coherence of a variable — how it fluctuates with itself.
Thus, variance measures internal spread, while covariance measures shared spread.

The correlation coefficient normalises covariance, removing the effect of scale and units:

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

A correlation of +1+1 indicates perfect alignment (one variable is an exact linear multiple of the other);
a correlation of −1-1 indicates perfect opposition (one rises as the other falls);
and 00 indicates complete independence in linear structure.
Correlation thus isolates directional coherence — the pure pattern of dependency, freed from differences in magnitude.

In multiple dimensions, these relationships are encoded in the covariance matrix:

\[ \Sigma = E\!\left[(X - \mu)(X - \mu)^{T}\right] \]

which preserves the coherence structure while reorienting it.
This means that even as the coordinate frame changes, the relational geometry — the essence of dependency — remains intact.

For Gaussian fields, correlation and covariance acquire a deeper significance:
because linear relationships fully determine dependence, zero covariance implies independence.
Thus, in the Gaussian world, correlation is coherence itself — the total measure of relationship between two flows.

Conceptually, covariance quantifies the strength of coupling between random variables — how tightly their probabilistic waves move together.
Correlation refines that into pure alignment, expressing the shape of their relationship independent of energy or scale.

Together they describe both the force and the form of coherence: covariance as amplitude, correlation as direction.

In Flow Algebra, covariance represents coupled coherence — the shared energy between two probabilistic fields.
Correlation represents normalised alignment — the symmetry of that shared energy once the fields are balanced.
Covariance tells how much one flow influences another; correlation tells how purely their directions align.

Through these measures, uncertainty acquires structure:

Fluctuations cease to be random noise and become a geometry of relations —
a web of shared coherence,
woven by the mathematics of correlation.

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