A Gaussian process (GP) is often described as an infinite-dimensional Gaussian distribution. That definition alone does not explain how a kernel constrains functions, how observations produce a posterior, or why prediction has a closed form. The essential tool is the conditional distribution of a multivariate Gaussian: GP marginalization, regression, and uncertainty updates all follow from the same linear-algebra formulas. Readers who want to review finite-dimensional distributions, covariance, and correlation can begin with Stochastic Processes 2: Joint Distributions and Dependence.
Most Gaussian-process inference is a direct consequence of multivariate Gaussian conditioning.
1. Start with Multivariate Gaussian Conditioning
1.1 Geometry, marginalization, and correlation
The density of a -dimensional random vector is . The quadratic form describes an ellipsoid. In the eigendecomposition , the columns of give its principal directions and gives the corresponding semiaxis lengths.
All three marginal distributions in the figure are ; only the correlation coefficient changes. Stronger correlation squeezes the probability cloud into a narrower band. Once is known, the plausible range of also narrows. A GP uses precisely this covariance between input locations to propagate information from observations.
If a subvector is selected from , its marginal distribution remains Gaussian: . Selecting components is equivalent to multiplication by a selection matrix , so . Marginalization merely extracts the relevant mean entries and covariance submatrix; no new integration is required.
1.2 Deriving the conditional distribution
Partition a jointly Gaussian vector into two blocks:
Set and construct the residual . Its covariance with the second block is . The pair remains jointly Gaussian, and uncorrelated jointly Gaussian variables are independent. Consequently, .
The residual has mean and variance . Given , the relation yields
The derivation needs only two facts: linear transformations preserve Gaussianity, and uncorrelated components of a jointly Gaussian vector are independent.
1.3 Reading predictive behavior from the formula
The conditional distribution remains Gaussian, so a GP with fixed hyperparameters and Gaussian observation noise has a closed-form posterior. The correction to the conditional mean is proportional to the cross-covariance ; if , observing does not change the mean of . The conditional covariance is the Schur complement and cannot exceed the prior covariance because the subtracted matrix can be written as .
With fixed hyperparameters, conditional covariance depends on observation locations rather than observed values. Active learning can therefore evaluate how much a candidate measurement location would reduce uncertainty before collecting its value. If the lengthscale, signal variance, or other hyperparameters are learned from data, observed values affect posterior covariance indirectly through those hyperparameters.
Take and observe . The conditional mean changes from 0 to , while the conditional variance falls from 1 to .
A normalized vertical slice through the joint density at is still bell-shaped, but its center moves to 1.36 and its width contracts substantially.
2. From Finite Gaussian Vectors to Distributions over Functions
2.1 The intuition from denser index sets
Plot a Gaussian vector with component indices on the horizontal axis and component values on the vertical axis. Choose locations , form a covariance matrix with , draw a sample from , and connect adjacent components.
For , a sample is only a line segment. For , the polyline already resembles a smooth function. Every construction step still samples from an ordinary finite-dimensional Gaussian. Increasing the dimension suggests what a distribution over functions means, but a more careful construction must establish that the limit exists and explain where the kernel comes from.
2.2 Deriving a kernel from Bayesian linear regression
Let be a fixed vector of basis functions. Define and assign a Gaussian prior to the weights. For any finite inputs , the function-value vector is and is therefore Gaussian. Its mean is zero, and its covariance is . The basis functions and weight prior induce the kernel; a valid kernel is more than an arbitrary similarity score.
As a concrete example, take Gaussian basis functions with width and centers . As the center spacing approaches zero and the weight variance is scaled appropriately, the discrete sum converges to
The second line follows by completing the square with . The result is a squared exponential (SE) kernel with lengthscale and variance .
With few basis functions, the implied kernel is uneven and the function is confined to an -dimensional space. The numerical kernel approaches the analytic limit as grows. If , then has rank at most and must be singular. A nonparametric model does not lack parameters; instead, the function can use infinitely many parameters, and inference has integrated the weights out.
2.3 Definition and consistency
A stochastic process is a Gaussian process if every finite vector has a multivariate Gaussian distribution. The definition uses finite-dimensional distributions because any practical prediction also queries only finitely many input locations.
The distributions defined on different finite point sets must be consistent: marginalizing a distribution on a larger set must reproduce the distribution defined directly on its subset. Gaussian marginalization extracts the corresponding blocks of the mean vector and covariance matrix, so finite-dimensional distributions generated by a shared mean function and kernel are automatically consistent. The Kolmogorov extension theorem then guarantees a stochastic process with those finite-dimensional distributions.
Writing and gives . For a general stochastic process, the first two moments do not determine the complete distribution. Every finite-dimensional distribution of a GP is Gaussian, so its mean and kernel determine its full probability law. In practice, data are often centered and is used; the kernel and observations then generate the posterior mean function.
3. What Prior Assumptions Does a Kernel Express?
3.1 Positive semidefiniteness is mandatory
A kernel must make positive semidefinite for every finite point set, because the variance of any linear combination cannot be negative. A function that decreases with distance is not necessarily a valid kernel. For example, use on 12 equally spaced points in :
| Smallest eigenvalue of | |
|---|---|
| 1 | |
| 2 | approximately |
| 3 | |
| 4 |
The function is a valid kernel only for . Values and produce negative eigenvalues, implying a linear combination with a negative “variance”; Cholesky factorization also fails. The case is the SE kernel. Its smallest eigenvalues can approach machine precision, so a mathematically valid kernel can still be numerically ill-conditioned.
3.2 Quantifying smoothness through increment variance
For a zero-mean stationary GP, increments satisfy . The expansion of the kernel near directly determines mean-square smoothness:
- The SE kernel has , so its first-increment variance is .
- The Matérn 3/2 kernel has , also giving first-increment variance.
- The Matérn 1/2 kernel has , giving first-increment variance.
- Brownian motion has ; its paths are continuous but almost surely nowhere differentiable.
The SE and Matérn 3/2 kernels both have quadratic first-increment variance. Their higher-order smoothness can be distinguished with the second difference .
| Kernel | First-difference slope | Second-difference slope | Mean-square derivatives |
|---|---|---|---|
| SE | 2 | 4 | |
| Matérn 3/2 | 2 | 3 | 1 |
| Matérn 1/2 | 1 | 1 | 0 |
| Brownian | 1 | 1 | 0 |
Matérn- samples are generally mean-square differentiable times. The SE kernel assumes infinite differentiability, a very strong constraint. Matérn 3/2 or 5/2 often better represents data with rough changes or only finite smoothness.
3.3 Lengthscales, common kernels, and composition
The lengthscale controls the distance over which correlation decays. A small correlates only nearby inputs and produces rapidly varying sample functions; a large preserves correlation across longer distances and produces smoother variation. The signal variance controls vertical amplitude. An SE sample on an interval of length has roughly zero-crossing-scale oscillations, so a useful lengthscale should match a physically meaningful variation scale.
| Name | Expression, | Main property | | --- | --- | --- | | Squared Exponential | | Infinitely differentiable and extremely smooth | | Matérn 3/2 | | Once mean-square differentiable | | Matérn 1/2 (OU) | | Continuous, nondifferentiable, and Markov | | Periodic | | Exactly periodic with period | | Brownian | | Nonstationary, with variance growing over time |
A wider bright band in a covariance heatmap means stronger long-range correlation and smoother sample functions. A periodic kernel produces parallel bands at integer multiples of the period. The Brownian kernel depends on the earlier time rather than only the time difference, so its heatmap is angular and nonstationary.
Sums and products of positive-semidefinite kernels remain positive semidefinite. A sum superposes two independent structures, a product enforces both structures, and first transforms the inputs. Adding trend, periodic, and short-term disturbance kernels yields a model with all three effects. The product lets seasonal patterns drift gradually and is often more realistic than exact periodic repetition.
The kernel contains the model’s principal prior assumptions about function space. “Nonparametric” does not mean “assumption-free”: choosing an SE, Matérn, or periodic kernel directly determines smoothness, extrapolation, and correlation structure.
4. GP Regression, Hyperparameters, and Stable Computation
4.1 Deriving the regression equations
Let the training inputs be , with observations , independent noise , and prior . Denote latent function values at test inputs by . The training outputs and test values have joint distribution
where , , and . Substitution into the conditional Gaussian formula from Section 1 gives
Once the kernel and noise parameters are fixed, inference requires solving linear systems rather than gradient descent or iterative sampling. The posterior mean depends on , while posterior covariance depends only on input locations and hyperparameters.
4.2 A prediction that can be calculated by hand
Take and . Observe and , then predict at . Since and , the required matrices are
Solving gives . The posterior mean is , and the posterior variance is , corresponding to a standard deviation of about 0.636.
The predictive mean is close to the arithmetic mean 0.1 but is not a simple average. The kernel matrix accounts for the correlation of each observation with the test point and for correlation between observations. Because the test location was not directly observed, posterior variance falls from its prior value 1 to 0.4044 rather than to zero. The variance calculation does not use , exactly as the Gaussian conditioning formula predicts.
4.3 Two views of the posterior mean
Define . The posterior mean becomes , a linear combination of kernel functions centered on the training inputs. A zero prior mean therefore does not force the posterior mean to remain zero.
The same equation can be written as , where . GP regression is consequently a linear smoother: predictions are weighted sums of observations, although weights may be negative and need not be restricted to nearest neighbors. The posterior mean is also identical to the kernel-ridge-regression solution, while the GP probability model additionally supplies a conditional covariance.
With no observations, the posterior equals the prior. One observation shifts the mean and lowers variance nearby. As observations cover the input interval, the posterior band contracts inside the observed region but returns toward the prior width when extrapolating. The noise variance lets the posterior mean smooth the data; the model approaches exact interpolation as .
4.4 Cholesky factorization and ill-conditioning
A GP implementation should never form the matrix inverse explicitly. Factor with Cholesky decomposition, then use triangular solves for the mean, variance, and log determinant:
L = cholesky(K + σn² I)
α = solve(Lᵀ, solve(L, y))
mean = k*ᵀ α
v = solve(L, k*)
variance = k** - vᵀv
log_determinant = 2 sum(log(diag(L)))
Cholesky factorization is faster and more stable than explicit inversion. The expression is also less likely to produce a negative variance from floating-point error. Exact GP computation still costs time and storage.
The eigenvalues of an SE kernel decay rapidly. On the same 12 points, increasing the lengthscale through 0.5, 1, 2, and 4 gives condition numbers of approximately , , , and . Double precision has a dynamic range of only about , so the final two matrices are numerically singular. A standard remedy adds diagonal jitter, , often with . The observation-noise term also improves conditioning, which is why noiseless GP interpolation can be more difficult than noisy regression.
4.5 Learning hyperparameters with marginal likelihood
The lengthscale , signal standard deviation , and noise standard deviation can change predictions substantially.
A common approach maximizes the marginal likelihood after integrating out the latent function . With , the log marginal likelihood is
The first term measures data fit, the second penalizes model capacity, and the third is constant. A larger makes functions more rigid and reduces the complexity penalty, but the fit term deteriorates rapidly once the model becomes too rigid to explain observed variation.
The total objective in the figure reaches its maximum near . As , and the fit term approaches the constant . A short-lengthscale model does not fit perfectly; it treats most structure as independent variation. Marginal likelihood is generally nonconvex and may have competing optima such as “long lengthscale with low noise” and “short lengthscale with high noise.” Multiple starting points are advisable, and small data sets require prior knowledge or cross-validation to check the optimized result.
5. Brownian Bridges, Stationarity, and Spectra
5.1 Constructing a Brownian bridge by conditioning
Brownian motion is itself a GP because every finite-dimensional distribution is jointly Gaussian. If , independent increments give , so its kernel is .
Conditioning the entire process on produces a Brownian bridge. Take and . The cross-covariance is and . The conditional mean remains zero, while . A Brownian bridge is therefore , with pointwise variance attaining its maximum at .
Brownian-bridge samples are fixed at zero at both endpoints and have their greatest uncertainty near the midpoint. The example turns a relationship between classical stochastic processes into covariance-matrix conditioning and also demonstrates that a GP need not be stationary or smooth.
5.2 Stationary kernels and Bochner’s theorem
With a constant mean, a kernel that depends only on the lag makes the corresponding GP weakly stationary. If the kernel depends only on the distance , it is also isotropic. Gaussian-process distributions are fully determined by their means and covariances, so a constant mean and translation-invariant covariance make weak stationarity imply strict stationarity. General stochastic processes do not share that equivalence; Stochastic Processes 3: Stationarity develops the distinction.
Bochner’s theorem characterizes stationary kernels in the frequency domain: a continuous function is a stationary positive-semidefinite kernel if and only if it is the Fourier transform of a finite positive measure, . The measure is the process’s power spectrum, so choosing a stationary kernel is equivalent to choosing a nonnegative spectrum.
The SE kernel has a Gaussian spectrum whose high frequencies decay faster than any polynomial, yielding infinitely many mean-square derivatives. A Matérn- spectrum decays as and retains only finitely many spectral moments, limiting sample smoothness. Peaks at selected frequencies express periodic structure; Spectral Mixture kernels use mixtures of such peaks to approximate stationary kernels. For , the Fourier transform of takes negative values, explaining in the frequency domain why the function is no longer a valid covariance kernel.
6. Practical Limits and a Modeling Checklist
Exact GP computation requires time and storage, becoming a bottleneck before sample sizes reach the tens of thousands. Inducing-point approximations such as FITC and SVGP, Kronecker structure, random Fourier features, and KISS-GP can reduce the cost. Every approximation trades among accuracy, memory, and implementation complexity.
Isotropic kernels also degrade in high-dimensional inputs. Pairwise distances concentrate as dimension grows, and an SE kernel may make most off-diagonal entries nearly equal, leaving little local structure for the model to distinguish. Automatic relevance determination assigns a separate lengthscale to each input dimension and can identify some irrelevant dimensions, but it does not replace meaningful dimensionality reduction, feature design, or a structured prior.
Posterior variance measures uncertainty under the selected kernel, noise model, and hyperparameters; it is not the true prediction error. A misspecified kernel can produce a narrow interval far from reality, and additional data may make the wrong model even more confident. Closed-form regression also assumes independent Gaussian observation noise. Heteroscedastic, heavy-tailed, or correlated noise must be modeled explicitly and often requires approximate inference.
Before applying a GP, check four questions: does the kernel express plausible smoothness and periodic structure; is the covariance matrix positive semidefinite and acceptably conditioned; does the observation-noise model match the data-generating mechanism; and can the sample size support exact factorization? Once those conditions are addressed, the core model remains compact: the mean and covariance functions define a joint Gaussian structure, observations update means and uncertainties through conditioning, and stable linear-system solves perform the actual computation.