Skip to main content

Welcome to a Grasp lesson

Create a free account to keep studying and create your own study path.

Lesson 32

Multivariate Gaussian Conditioning with Schur Complements

Recommended resources

Welcome back! In our previous lesson, we established a constructive understanding of the multivariate Gaussian, deriving its density function by applying an affine transformation to a vector of independent standard normal variables. This revealed the deep connection between the covariance matrix and the geometric "stretching and rotating" of the probability space.

Today, we will build directly on that structural insight to answer a fundamental question in probabilistic modeling: If a set of variables is jointly Gaussian, what can we say about the distributions of subsets of those variables? This will lead us to the concepts of marginal and conditional distributions. Your objective is to learn how to compute the marginal and conditional distributions of a multivariate Gaussian using the Schur complement, as required in many generative models.

These operations are not just mathematical exercises; they are the bedrock of inference in models like Variational Autoencoders (VAEs) and classical state-space models, where we constantly need to reason about latent variables given observed data, or integrate out nuisance variables.

1. Partitioning a Gaussian Vector

Let's consider a -dimensional random vector that follows a multivariate Gaussian distribution, . Suppose we partition this vector into two components, of dimension and of dimension , where .

This partitioning induces a corresponding block structure in the mean vector and the covariance matrix :

Here, is the covariance matrix of , is the covariance matrix of , and (which is the transpose of ) is the cross-covariance matrix between and .

Our goal is to find the distributions (the marginal) and (the conditional).


2. Marginal Distributions: The Simple Case

The marginal distribution is what we get when we "ignore" or integrate out : . Intuitively, if you project the ellipsoidal cloud of points from the joint distribution onto the subspace of , you get the marginal distribution.

One of the remarkable properties of the Gaussian is that this marginal is also Gaussian. The proof is surprisingly elegant and relies on the affine transformation property we studied last time. The following video provides a clear explanation.

(PP 6.8) Marginal distributions of a Gaussian

This video from the "mathematicalmonk" channel gives a great intuition for marginalization as a projection and provides a concise proof using the affine property.

Please watch the entire video. First, absorb the intuition of projecting samples from a 2D Gaussian onto one of the axes. Then, follow the proof for the 2D case, which uses a simple projection matrix. Finally, see how this generalizes to the block-partitioned case. The key idea is to define a projection matrix A = [I \ \ 0] such that \mathbf{x}_a = A\mathbf{x}. Since this is an affine transformation of a Gaussian variable, the result must also be Gaussian.

As the video proves, the result is beautifully simple. The marginal distribution of is obtained by simply selecting the corresponding blocks from the mean vector and covariance matrix:


3. Conditional Distributions: Slicing the Gaussian

Finding the conditional distribution is more involved but arguably more important for inference. It answers the question: "Given that I've observed the value of , what is my updated belief about the distribution of ?" Geometrically, this is like taking a "slice" through the joint probability density at a fixed value of .

The resulting distribution is, once again, a Gaussian. The video below provides the intuition and the formulas.

(PP 6.9) Conditional distributions of a Gaussian

This video, also from "mathematicalmonk", visualizes conditioning as slicing the density and presents the formulas for the conditional mean and covariance.

First, watch the visual explanation of taking a slice through a 2D Gaussian's density to get the conditional distribution. This 3D visualization is particularly helpful. Then, pay close attention to the general formulas for the conditional mean and covariance. Don't worry about the mnemonic story unless you find it helpful for memorization.

The conditional distribution is given by , where:

  • Conditional Mean:
  • Conditional Covariance:

The conditional mean is a linear function of the observed value . It starts at the prior mean and adjusts it based on how far the observed is from its own mean , scaled by the correlation term .

The conditional covariance, interestingly, does not depend on the value of . Observing reduces our uncertainty about , and the amount of this reduction is fixed. The term is always positive semi-definite, so the conditional covariance is always "smaller" than or equal to the marginal covariance .

The image below nicely illustrates these concepts for a 2D Gaussian.

On the left, for correlated variables \(X_1\) and \(X_2\), the joint distribution is an ellipse. The marginal distribution \(p(X_1)\) is shown in black along the horizontal axis. The conditional distribution \(p(X_2 | X_1 \approx 1.5)\) is the purple curve—a "slice" of the joint. On the right, for uncorrelated variables, the joint is a circle and the conditional distribution's mean does not depend on the value of \(X_1\).

4. Derivation using the Schur Complement

Now, where do these formulas come from? The derivation is a beautiful piece of matrix algebra that hinges on understanding the structure of the inverse of a partitioned matrix. The key component that emerges is the Schur complement.

The article "The Venerable Gaussian" provides an excellent, self-contained derivation. We'll walk through it in two steps. First, we'll master the necessary matrix machinery.

The Venerable Gaussian

This article by Maxime Robeyns provides a thorough treatment of Gaussian manipulations. We will first focus on the section that details the inversion of a partitioned matrix.

Please read the section Inverting a Partitioned Matrix and the following subsection on Schur Complements. Focus on the definition: the Schur complement of a block \mathbf{D} in a matrix \mathbf{M} = \begin{bmatrix}\mathbf{A} & \mathbf{B} \\ \mathbf{C} & \mathbf{D}\end{bmatrix} is defined as \mathbf{M}/\mathbf{D} \doteq \mathbf{A} - \mathbf{B}\mathbf{D}^{-1}\mathbf{C}. Notice that the conditional covariance we stated earlier, \mSigma_{a|b} = \mSigma_{aa} - \mSigma_{ab}\mSigma_{bb}^{-1}\mSigma_{ba}, is precisely the Schur complement of the block \mSigma_{bb} in the covariance matrix \mSigma. This is not a coincidence!

With the Schur complement and the block matrix inverse formulas in hand, we can now tackle the main derivation. The strategy is to write out the quadratic form in the exponent of the joint distribution and algebraically manipulate it to separate it into two parts: one corresponding to and another corresponding to . By comparing the latter part to the standard Gaussian form, we can "read off" the parameters of the conditional distribution.

The Venerable Gaussian

Now, let's use the matrix results to derive the conditional distribution parameters. This section may look dense, but the logic is straightforward: rearrange the exponent of the joint PDF to match the exponent of the conditional PDF.

Start by reading the statement of the results in the subsections Marginal of a Joint Gaussian and Conditional of a Joint Gaussian. Then, carefully follow the proof. The core of the proof is the block-diagonalization of the quadratic form Q. The author masterfully rewrites Q as a sum of two separate quadratic forms, one for the conditional and one for the marginal. Finally, read the section Working with Gaussians for an alternative perspective on the same derivation. This approach, often called "completing the square," involves matching coefficients of the quadratic and linear terms in \mathbf{x}_a to the general Gaussian exponent. Given your background, you might find this method particularly intuitive.

This derivation is a cornerstone of many proofs in machine learning. It shows how conditioning on a Gaussian variable involves a linear update to the mean and a reduction in covariance given by the Schur complement.


Conclusion

In this lesson, we have explored the fundamental properties of marginal and conditional distributions within a multivariate Gaussian framework. These operations are essential tools for probabilistic inference.

Key Takeaways:

  • Partitioning: A multivariate Gaussian vector can be partitioned into sub-vectors, with corresponding blocks in the mean vector and covariance matrix.
  • Marginalization: The marginal distribution of a subset of variables is also Gaussian. Its parameters are found by simply taking the corresponding blocks of the original mean and covariance matrix. This is equivalent to projecting the distribution onto a subspace.
  • Conditioning: The conditional distribution of one subset of variables given another is also Gaussian. This is equivalent to taking a slice through the joint density.
  • Schur Complement: The covariance matrix of the conditional distribution is given by the Schur complement of the appropriate block in the joint covariance matrix. This reflects the reduction in uncertainty from observing a correlated variable.

We now have the tools to manipulate and reason about joint Gaussian distributions. In our next lesson, we will shift our focus from the properties of distributions to the problem of estimation. We will explore Maximum Likelihood Estimation (MLE) and see how minimizing common loss functions like Mean Squared Error is equivalent to finding the MLE for a Gaussian model of the data.