10 / 22 · Several Random Variables
The multivariate Gaussian
Derive Gaussian geometry and conditioning from one covariance matrix. Check affine predictions, distinguish independence from zero covariance, and explain why high-dimensional probability lies away from the density peak.
On this page 7
Two measurements can each fluctuate widely while their difference remains fairly predictable. A covariance matrix records that shared movement. For a jointly Gaussian vector it does more: together with the mean, it determines the entire distribution and lets us update one coordinate after observing another.
The joint-distribution lesson established how marginals, conditioning and independence relate. We now calculate them for a particular family. The main numerical example is a constructed two-coordinate Gaussian model. Its parameters are stipulated; they were not estimated from an empirical dataset.
The density#
A vector is jointly Gaussian when every linear combination of its coordinates is normally distributed, allowing a constant as a zero-variance case. Equivalently, we can construct it from independent standard normal coordinates in a vector :
Its mean is and its covariance is . The matrix may be rectangular or singular; a density over the full output space requires to be positive definite. First assume that condition in dimension and take an invertible square factor .
The inverse transformation is . For this change of variables, the forward volume factor and the squared length of the inverse image are
Substituting these into the product of standard normal densities gives
This construction and the density formula are established in Siegrist’s The Multivariate Normal Distribution, General Distribution. The determinant corrects volume; the quadratic form measures displacement after undoing the covariance transformation.
Use the following model throughout:
A lower-triangular factor makes the construction explicit:
Multiplying recovers the displayed covariance. Both coordinates have variance , and the correlation is . The density at the mean is . This is a density per unit area; a single point still has probability zero.
Covariance as geometry#
Write the displacement from the mean as . Its squared Mahalanobis distance is
For the chosen matrix,
The displacements and have the same Euclidean length, but their squared Mahalanobis distances are and . Moving both measurements together is more plausible under this covariance than moving them in opposite directions.
The covariance eigenvectors are along and , with eigenvalues and . For a positive-definite covariance with orthonormal eigenvector matrix ,
Thus a contour has semiaxis lengths . The eigenvectors set its directions and the eigenvalues set its squared widths. In our case, the displacements and both lie on the contour .
Covariance sets directions and widths
Probability inside the contour
- q ≤ 1: 39.3469%
- q ≤ 4: 86.4665%
Eigenvalues: 8 and 2. Dashed gray segments show the principal axes of the outer ellipse.
A contour radius is not automatically a one-dimensional coverage rule. In two dimensions, whitening gives . In polar coordinates the angle integrates out, leaving
Consequently, the ellipses at radii and contain approximately and of the probability. The familiar one-coordinate interval percentage does not apply to the radius-one ellipse.
Affine maps#
Let , where and are fixed. Substituting the construction gives , so the result is again jointly Gaussian, possibly degenerate:
For a scalar prediction , our model gives
Hence , where the second parameter is the variance. The covariance term reduces the variance because the coefficients have opposite signs and the input coordinates tend to move together. Treating those coordinates as independent would instead give and change the predicted uncertainty.
A rank-deficient map illustrates the density limitation. If is standard normal and , then
Its determinant is zero and all probability lies on a line. The vector is still jointly Gaussian, but has no density with respect to two-dimensional area. Inserting a pseudoinverse into the full-dimensional density formula does not fix that missing volume.
Marginals and conditionals#
Selecting a coordinate is an affine map. Thus the marginals of our model are and . A marginal averages over the other coordinate. A conditional instead fixes what was observed and renormalizes the remaining density.
Complete the square in our quadratic form:
When is given, the first term does not depend on the remaining coordinate and cancels in the conditional density ratio. The second term has a Gaussian shape, giving
At the observed value , the conditional mean is and the variance is . The mean moves upward because the covariance is positive. The variance decreases from because observing one coordinate removes some uncertainty about the other.
An observation shifts the mean and reduces spread
Before the observation: N(2, 5)
After X₁ = 3: N(4.4, 3.2)
The second parameter is the variance. The conditional density is separately normalized; it is not an unnormalized slice through the joint density.
We obtain this conditional law from , whose denominator is positive here. We do not divide by the zero probability of the event . This continuous conditional density also describes the limiting update from an increasingly narrow observation interval. Siegrist’s bivariate conditional theorem states the same general Gaussian dependence on the observed value.
For vectors partitioned into blocks and , assume the joint covariance is positive definite. Define the residual after subtracting the linear contribution of block :
Multiplying covariances gives . Since the residual and block are jointly Gaussian, the independence result in the next section applies. The residual covariance is the Schur complement:
It follows that, at an observed vector ,
The conditional mean depends on the observation; the conditional covariance does not. That constancy is a property of this Gaussian model, not a general law of conditioning. Numerically, solve linear systems involving rather than explicitly forming its inverse.
Gaussian blocks: zero covariance and independence#
If a positive-definite Gaussian covariance is block diagonal, its inverse is block diagonal too and its determinant is the product of the block determinants. Substitution into the joint density separates it into the product of the two marginal densities. Hence Gaussian blocks with zero cross-covariance are independent.
The conclusion also covers singular jointly Gaussian vectors. Their moment-generating function is
With zero cross-covariance, its exponent splits into two block terms, so the moment-generating function factors. Its uniqueness yields independence. The construction, transform formula and block result are given in Siegrist’s multivariate treatment; the residual argument above uses this factorization.
Without joint Gaussianity, zero covariance is insufficient. Let take with probabilities , and set . Symmetry gives and , so the covariance is zero. Yet , whereas . One coordinate determines the other. Checking a covariance alone cannot establish independence for an arbitrary joint law.
High dimensions: the shell#
The standard Gaussian density is highest at the origin. That point is nevertheless unrepresentative of the radius of a typical high-dimensional draw. Let have independent standard normal coordinates, and write
For one coordinate the second and fourth moments are and . Independence therefore gives
Chebyshev’s inequality gives an explicit, conservative concentration bound for :
Take and . The upper bound is , so with probability at least the radius lies between the following limits:
The reference scale is . “Thin” means small relative width as dimension grows; it does not mean every draw has the same radius.
Mass moves away from the density peak because a radial band contains more volume at larger radius. Combining that volume with the Gaussian density gives, for ,
Here is the gamma function, defined for by
This is the chi density; its squared variable has a chi-square distribution with degrees of freedom. See Siegrist, Chi-Square and Related Distributions, Moments, Related Distributions and The Chi Distribution. Differentiating the log radial density gives
For the mode is therefore . The radial density includes the amount of volume in a band; the vector density at one location does not.
Radial mass near its characteristic scale
- d = 2
- d = 16
- d = 128
The radius density peaks lie away from zero. The peak of the vector density and the peak of the radial density describe different quantities.
The plot uses the relative radius so different dimensions share a scale. It shows only radii up to twice that scale; tails continue beyond the displayed window. No samples were drawn to produce these curves.
What changed#
A covariance matrix now supports three linked calculations: ellipses show which directions vary together, affine maps propagate that variability, and conditioning removes the part explained by an observation. The same constructed matrix gave a variance of for a linear prediction and a conditional variance of for the second coordinate. These are consequences of a joint Gaussian assumption, not conclusions established by the matrix alone.
Limitations#
A mean and covariance determine a Gaussian law only after the family assumption is made. Heavy tails, multiple clusters and nonlinear dependence can share similar moments while giving very different probabilities. Separately normal-looking marginals do not establish joint Gaussianity.
The density and block-inverse formulas require the stated nonsingularity conditions. Nearly singular covariance matrices can make calculations numerically unstable; adding a diagonal regularizer changes the model and should be reported as such. Shell concentration above applies to isotropic standard coordinates, or after whitening a positive-definite Gaussian; it does not directly assert concentration of the ordinary radius for every anisotropic covariance.
What you should remember#
A Gaussian vector can be constructed by an affine map of independent standard normals. Its covariance sets the contour geometry, and the inverse covariance measures displacement in those coordinates. Affine maps and conditioning remain Gaussian; zero cross-covariance gives independence within a jointly Gaussian law. In high dimension, distinguish the density of a vector at a point from probability accumulated over a radial band.
Code#
This deterministic standard-library calculation checks the conditional update, ellipse probabilities and shell bound:
import math
mean = 2 + 3 / 5 * (3 + 1)
variance = 5 - 3 * 3 / 5
print(f"conditional mean={mean:.6f} variance={variance:.6f}")
coverage = [-math.expm1(-r * r / 2) for r in (1, 2)]
print("ellipse probabilities:", " ".join(f"{p:.6f}" for p in coverage))
radii = [math.sqrt(v) for v in (384, 512, 640)]
bound = 2 / (512 * 0.25 ** 2)
print("shell radii:", " ".join(f"{r:.6f}" for r in radii),
f"; failure_bound={bound:.6f}")
conditional mean=4.400000 variance=3.200000
ellipse probabilities: 0.393469 0.864665
shell radii: 19.595918 22.627417 25.298221 ; failure_bound=0.062500
The repository’s scripts/notes/transformation-gaussian-cases.py additionally checks the covariance factor, the completed square, every plotted ellipse point and numerical normalization of the radial densities. It regenerates original curve coordinates without external data or model dependencies.
Next#
The Gaussian update produced a conditional mean that depends on the observed coordinate. Conditional expectation develops that object for general distributions and connects it to prediction, averaging and residual error.
References#
- Kyle Siegrist, The Multivariate Normal Distribution, bivariate conditional distributions; multivariate General Distribution and Transformations: Gaussian construction, density, affine maps, marginals and independence.
- Kyle Siegrist, Chi-Square and Related Distributions, Moments, Related Distributions and The Chi Distribution: squared Gaussian radii and the radial density.
- Kyle Siegrist, The Normal Distribution, Moments: the standard normal second and fourth moments used in the shell calculation.