A heated rod: from physics to Gaussian process regression
September 18, 2026
A few years ago, my former colleague Petr developed a method for solving PDE-based inverse problems, which he called optimization of a discrete loss (ODIL)1. It can reconstruct fields from sparse data by minimizing residuals of the discretized PDE together with a mean square loss on the data.
In practice, measurements are noisy. This led me to develop a Bayesian extension of the method, named BODIL2. I have noticed that these ideas are linked to earlier work on inverse problems and Gaussian process (GP) regression. To understand this link in more detail, I decided to apply BODIL to a physical system, leading to a well-known kernel that is often used in GP regression.
Heat equation on a thin rod
Let's start with a physical system: a thin rod, heated with a source. What is the temperature along the rod?
This can be modeled with the heat equation: the temperature field evolves as where is the heat diffusivity, a source term depending on position, and the second term describes relaxation to ambient temperature 3. At steady state, expressing the temperature relative to as and choosing units where : where is a length scale. If we solve this equation for a single point source , the temperature takes the form which is also the Green function for this problem.
The temperature is a lot smoother than the source term since diffusion tends to smooth out any field.
When we know the source term, we can now predict the temperature profile, as it is given by the convolution between the source term and the Green function. But what if we do not know the source term?
The inverse problem
Suppose that instead of a known source term, we have measurements of the rod temperature at given positions . The measurements have errors, which we model as independent, normally distributed with a known standard deviation . Can we infer the temperature profile?
Two observations: this is an inverse problem, and there are uncertainties in the measurements, so we may treat the problem with a Bayesian approach. This is the approach taken by BODIL: represent the field on a grid, then define a likelihood and a prior, which together define the posterior distribution of the field.
Here the solution field, represented on a uniform grid, is the temperature over a rod of unit length, , where is the grid spacing. The likelihood is straightforward: we assume that the measurements are normally distributed around the solution field, giving where is the interpolation of at the measurement location .
The prior contains the physics, encoded as a discretization of the PDE, here a central finite-difference scheme. Since we know nothing about the source, we encode it as white noise, with amplitude . This gives the following prior4: The following plot shows samples from this prior:
Despite the white noise assumption on the source, the temperature profiles are smooth! Putting everything together, we obtain the posterior:
We now have a reconstruction of the whole temperature profile, given sparse measurements and a physical prior, with quantified uncertainties. Note that we have used a finite number of grid points , but changing barely changes the predictions. What happens, mathematically, in the continuum limit?
From prior to GP kernel
The continuum limit can help us understand BODIL as a GP. First, let's rewrite the log prior as where is the discrete residual operator, corresponding to in the continuum limit (we ignore boundary effects). The prior is thus a Gaussian with covariance In the continuum limit, the question is whether converges to a grid-independent kernel . We have seen earlier that solving for in the continuum limit is a convolution of with the Green function . Therefore, for any , giving , and thus the covariance matrix reads defining a kernel that does not depend on the grid size as . The kernel only depends on the distance : What this means is that two nearby points are correlated, as they feel the same heat sources in their neighbourhood. This correlation vanishes once the points are further apart than .
This is the Matérn kernel with (in the usual parametrization, , this corresponds to and ).
From posterior to GP regression
The posterior contains both the prior and the likelihood. The latter was defined with the interpolation operator for each of the data points, which we can write as a single interpolation matrix so that . With these new notations the log-likelihood is expressed as giving the log-posterior (up to an additive constant independent of ): which is a Gaussian with precision and mean . Multiplying the latter by and rearranging gives Not very interpretable. Let's write it in terms of the (discrete) kernel.
We first define and substitute it into , to get . Substituting this into the definition of gives , and thus . Substituting this back into the mean, we have that We can use a similar trick to get the covariance of the posterior:
In the continuum limit, is the kernel evaluated between pairs of measurement points, and is the kernel evaluated between grid points and measurement locations, . Here denotes the positions of all measurements, and the matrix of kernel values between every pair of positions. Therefore, equation corresponds to the GP regression formula and equation corresponds to These are equations (2.23) and (2.24) in Rasmussen and Williams (2006).
In the GP form, evaluating the posterior at a new point requires first factorizing the dense matrix, at a cost of operations. In the discrete case, we need to solve a linear system of size that is banded, since and only couple neighbouring grid points: its cost is linear in and independent of , which may be a lot cheaper in some cases.
Summary
As a Bachelor student, I understood mathematical concepts best when they came with a physical picture: Fourier transforms through waves, differential equations through mechanics, stochastic processes through Brownian motion. GPs turn out to be no exception, and writing this post gave me the picture I was missing.
When the PDE is linear, solving the inverse problem with BODIL tends to GP regression as the grid is refined, and the kernel is the Green function of the PDE convolved with itself. Choosing a kernel is choosing a physics, whether one knows it or not.
When the PDE is non-linear, the posterior is not Gaussian anymore, and we have something more general than GPs. I might take a closer look at non-linear cases in a future post.
Footnotes
-
Karnakov, P., Litvinov, S. and Koumoutsakos, P., 2024. Solving inverse problems in physics by optimizing a discrete loss: Fast and accurate learning without neural networks. PNAS Nexus, 3(1), p.pgae005. DOI ↩
-
Amoudruz, L., Litvinov, S., Papadimitriou, C. and Koumoutsakos, P., 2026. Bayesian inference for PDE-based inverse problems using the optimization of a discrete loss. Computer Methods in Applied Mechanics and Engineering, 455, p.118903. DOI · PDF ↩
-
If we want to link these coefficients to physical quantities: , where is the radius of the rod, its density, its specific heat, is the surface heat transfer coefficient. The source term is , where is the heating power per unit length. ↩
-
The factor makes the sum a Riemann sum of , so that the prior does not depend on the grid resolution. The residuals at and involve and , which lie outside the rod; we take the ends of the rod to be insulated, and . ↩