A Feynman-Kac Type Theorem for ODEs: Solutions of Second Order ODEs as Modes of Diffusions
Abstract.
In this article, we prove a Feynman-Kac type result for a broad class of second order ordinary differential equations. The classical Feynman-Kac theorem says that the solution to a broad class of second order parabolic equations is the mean of a particular diffusion. In our situation, we show that the solution to a system of second order ordinary differential equations is the mode of a diffusion, defined through the Onsager-Machlup formalism. One potential utility of our result is to use Monte Carlo type methods to estimate the solutions of ordinary differential equations. We conclude with examples of our result illustrating its utility in numerically solving linear second order ODEs.
2010 Mathematics Subject Classification:
60H30, 60G15, 34B051. Introduction
The Feynman-Kac theorem is a widely known and extensively used formula that relates the solutions of second order parabolic partial differential equations (PDEs) to the average of a transformation of a diffusion. It was introduced in [22] and has since seen tremendous utility and generalization. The Feynman-Kac formula has been extended to stochastic PDE in e.g. [4, 19, 20]. It has also seen utility in physics, see e.g. [1, 8, 17, 24, 27]. It has been used also in interacting particle systems, see e.g. [7, 11, 12, 13]. It has been used in finance, see e.g. [21].
There are many forms of the Feynman-Kac formula, see e.g. [25] for a standard reference. In one form, the Feynman-Kac formula says the following.
Theorem 1 (Feynman-Kac).
Consider the partial differential equation
on the domain , with terminal condition and sufficiently regular. Then
where is the solution to the solution to the stochastic differential equation
with initial condition , a standard Brownian motion and is the measure associated to .
Linear second order ordinary differential equations and systems thereof find extensive use in engineering, physics, biology, geometry, control theory and many other areas of pure and applied mathematics. One example of a system of such equations in physics is the matrix Airy equation, which has connections to the intersection theory on the moduli space of curves, see [23]. Further examples abound in the computation of long-run average costs associated with diffusion processes, which can be expressed as solutions of second-order ordinary differential equations (ODEs). In this article, we demonstrate a theorem analogous to Theorem 1 for second order ordinary differential equations. However in the ODE case, solutions are represented as the conditional “mode” of a diffusion instead of a conditional mean. By “mode”, we mean the minimizer of an Onsager-Machlup function. It was first shown in [15] that the Onsager-Machlup function is a Lagrangian for the “most likely path” or “mode” of a diffusion. Our main theorem can be summarized as follows, see Theorem 22 for a full version.
Theorem 2 (Feynman-Kac for ODEs).
Consider the differential equation
(1) |
where the unknown , with boundary conditions and . Let and be (almost) arbitrary real valued functions. Then there exists a choice of functions and that depend on and so that the solution to (1) is
(2) |
where , is a standard Brownian motion and additionally . Here, the conditional mode of a diffusion is defined as the minimizer of the Onsager-Machlup function defined in Theorem 13 over all paths with .
The term is analogous to the Feynman-Kac for PDEs case, Theorem 1. The Feynman-Kac formula can first be proven for diffusions with no factor in front of the term. Then including the exponential weight term, one can get more general terms in front of .
The primary tool we will use is the Onsager-Machlup formalism established in [15, 10, 26]. In particular, we will extend the Portmanteau theorem in [26], which relates information projections, Kullback-Leibler weighted control, finding the most likely path of a diffusion and Euler-Lagrange equations. In [15], it was shown that the so-called “Onsager-Machlup” function is a Lagrangian for the most likely path of a diffusion. That is, the minimizer is the “mode” of the path. We show that the solution to (almost) any second order linear ODE is the (potentially weighted) conditional mode a diffusion, defined as the minimizer of the Onsager-Machlup function. Additionally, we extend our results to include systems of second order linear ODEs.
2. Preliminaries
In this section, we collect some preliminary results on stochastic analysis on Wiener space and finding modes of diffusions through the Onsager-Machlup formalism. For more information, see [3, 10, 18, 26]. We first define classical Wiener space and the Cameron-Martin space of Brownian motion which play a central role in our paper.
Definition 3.
We say that is classical Wiener space, where is the space of continuous valued functions on the compact interval with , are the Borel sets from the supremum norm and is classical Wiener measure corresponding to a standard -dimensional Brownian motion .
Definition 4.
The Cameron-Martin space associated to classical Wiener space is the Sobolev space of all absolutely continuous functions whose derivative lie in . We also denote the Cameron-Martin norm of an element by
The primary reason why we need the Cameron-Martin space is the following theorem, called the Cameron-Martin theorem.
Theorem 5.
[18, Theorem 3.41] Let be classical Wiener measure on . For , define the pushforward measure by
for all Borel . Then the pushforward measure is absolutely continuous with respect to if and only . Furthermore, the Radon-Nikodym derivative of with respect to is
For more information on Cameron-Martin spaces see [18], Chapter 3. We formally define the set of Gaussian shift measures from Theorem 5 to be
(3) |
The Cameron-Martin theorem states that one can shift by “deterministic” paths that lie in the Cameron-Martin space in a way that the pushforward measure is absolutely continuous with respect to . The generalization to shifting classical Wiener measure by more general processes is Girsanov’s theorem. We provide both a forward and a reverse direction here.
Theorem 6.
[3, Lemma 5.76] Let be classical Wiener space, and assume:
(a) is a progressively measurable process with respect to the filtration generated by the standard Brownian motion ;
(b) The sample paths are almost surely in the Cameron-Martin space ;
(c) Novikov’s condition,
where , holds.
Then, the process is a standard Brownian motion under with density
Theorem 7.
[3, Theorem 5.72] Let be classical Wiener space, and suppose . Then, there exists a progressively measurable process with sample paths almost surely in the Cameron-Martin space so that the process is a standard Brownian motion under . Furthermore, the density is given by
where .
We can now introduce Onsager-Machlup formalism for finding the mode of a diffusion. The Onsager-Machlup function is defined as below.
Definition 8.
Let be a classical Wiener measure on . Let be the open ball of radius around . Let be another measure that is absolutely continuous with respect to . If the limit
exists for all , then is called the Onsager-Machlup function for .
In order to ensure that the Onsager-Machlup function exists, we need the following hypothesis and theorem taken from [10].
Hypothesis 9.
Let be a functional satisfying the following conditions:
(i) For every there is an such that
for all .
(ii) is locally bounded above, i.e., for every there is a such that
for all with .
(iii) is locally Lipschitz continuous, i.e., for every there exists such that
for all with and .
Theorem 10.
Remark 11.
The minimizer of the Onsager-Machlup function can be seen as the “most likely” path of the diffusion, which was shown in [15]. This fact is central to the approach in this paper. Furthermore, we define the conditional mode to minimize over a region. That is, for a subset and a process whose path measure has a density
we define
if the infimum is indeed achieved.
We also recall the definition of Kullback-Leibler divergence. For two probability measures on some measurable space , the KL divergence is defined by
We recall three key properties of the KL-divergence: (i) ; (ii) if and only if ; and (iii) is convex. The next result shows how to compute the KL-divergence between two shift measures drawn from the Cameron-Martin space .
Theorem 12.
[9, Lemma 3.20] Let be a centered Gaussian measure on with Cameron-Martin space , and let and for some . Then, the Radon-Nikodym derivative exists and
3. A Portmanteau Theorem
The final result we need is analogous to Theorem 1.1 from [26], a portmanteau theorem that lets us convert from Euler-Lagrange equations, to information projections, to Kullback Leibler (KL) divergence weighted control, to Onsager-Machlup functions for measures on classical Wiener space.
Theorem 13.
Let be a classical Wiener space with Cameron-Martin space (see Definition 4). Let be a functional so that and . Furthermore, assume that the functional defined by exists and satisfies Hypothesis 9. Define the probability measure on with density
and the probability measure on with density
Let be the set of Gaussian shift measures which are absolutely continuous with respect to (defined in Eq. (3)). Define to be the subset of defined in (3) defined by
(4) |
Furthermore, suppose that is such that that and therefore there is a progressively measurable process so that by Itô’s representation theorem. Let be the Lagrangian
(5) |
Suppose that there exist and such that for all , , and . Consider the calculus of variations problem:
Consider the following four optimization problems:
(a) (Information projection)
(b) (State independent KL-weighted control)
(c) (Conditional mode of )
(d) (Calculus of variations)
Then, the optimal values , , and are all attained (and so all three problems have optimal solutions). By the Cameron-Martin theorem (see Theorem 5), we can identify each shift measure with its corresponding shift , and so we have
In the above, we have used equivalence “” for shorthand to denote that (or ) if and only if its corresponding shift (or ).
Proof.
Equivalence of (a) and (b) Under assumptions the and the measure is well defined, see Lemma 2.4 in [6]. Then we can note that for any equivalent to we have that
Taking an infimum of both sides shows that problem (a) is equivalent to problem (b).
Equivalence of (a) and (d) We just have to check that for all where is defined in (3), with shift we have that
To this aim, we note that if where is defined in (3) with corresponding shift that
By Girsanov’s theorem, Theorem 6, we have that where is a Brownian motion under . Therefore the KL divergence is thus
Using the mean zero property of Itô integration yields that
Therefore using Fubini’s theorem and a polarization identity we conclude that
The assumptions on the Lagrangian imply that there is a unique solution to problem (d) and hence there is a solution to problem (a).
Equivalence of (a) and (c) Using Theorem 12 and the definition of for each with corresponding shift , we have that
Using the equivalence between (a) and (d), along with the assumptions on the Lagrangian concludes.
∎
Remark 14.
Theorem 13 is based on [26, Theorem 1.1]. However, there are three key differences. First, parts (a), (b), and (c) are stated in terms of a general Gaussian measure in [26, Theorem 1.1] whereas in Theorem 13 it is stated for a dimensional Brownian motion. Second, part (d) in [26, Theorem 1.1] is only stated in terms of a dimensional Brownian motion whereas in Theorem 13 it is for dimensions. Third, in [26, Theorem 1.1], everything is stated in terms of unconditional mode instead of conditional mode from Theorem 13.
4. Proof of Feynman-Kac for ODEs
In this section, we restate Theorem 2 in more detail and offer a proof. For pedagogical reasons, we first prove the result for a single ODE. We then extend to the case of a system of ODEs. The proof for the system is similar but it is included for completeness.
4.1. Feynman-Kac for single ODE
In this subsection we prove our Feynman-Kac result for a single linear second order ODE. First we prove the case in which and thus and we are working with no exponential weight. We then use this to construct the solution for general . First we have the following lemma.
Lemma 15.
If for matrix and vector , then .
Proof.
We just have to show that . Recall that . To the stated aim, we write that
∎
Proposition 16.
Consider the differential equation
(6) |
where the unknown , with boundary conditions and . Let and be functions so that the differential equations
(7) |
and
have solutions, . Let be the diffusion corresponding to given in Theorem 13 with . Then the solution to (6) is
(8) |
Here, the conditional mode of a diffusion is defined as the minimizer of the Onsager-Machlup function defined in Theorem 13 over all paths with , as in Remark 11.
Proof.
Remark 17.
The equation
(11) |
is an example of a Riccati equation, whose general form is
where are continuous functions and . See [2] for conditions on solving Riccati equations explicitly. To this aim, they convert the Riccati equation to a second order linear differential equation
where In the case of Theorem 16, the Riccati equation (11) turns into the homogeneous equation
with Note however that this is not quite the homogeneous version of (6) because in (6) we insist that .
Explicitly giving for an equation (6) comes down to the solvability of the equation (11). We give an example of when (11) is explicitly solvable as a corollary.
Corollary 18.
Consider the differential equation
(12) |
where the unknown , with boundary conditions and . Let be and let be a constant. Then the solution to (12) is
(13) |
where is the diffusion
Remark 19.
Lemma 20.
Let as in Portmanteau theorem be such that depends nontrivially on . Then the resulting Euler Lagrange equation has a nonlinearity in .
Proof.
We write down the Lagrangian as
Taking derivatives yields
and
The Euler-Lagrange equation for is thus
Because depends nontrivially on , the term
depends nonlinearly on with no terms involving or . The three other terms will all involve a or a , so there is no chance for cancellation. ∎
Corollary 21.
We finally prove our main theorem for general by applying a simple transformation to solutions given in Proposition 16. This is the full version of Theorem 2.
Theorem 22 (Feynman-Kac for ODEs).
Consider the differential equation
(14) |
where the unknown , with boundary conditions and . Let and be real valued functions. Let . Define the functions
and
Suppose that the differential equations
and
have solutions, , implying that the solution given in Proposition 16 to the equation
exists. Then the solution to (14) is
(15) |
Proof.
Differentiating once yields that
Differentiating again gives
Checking that satisfies equation (14) concludes that
∎
4.2. Feynman-Kac for Systems of Equations
In this subsection, we extend Theorem 22 to the case of systems of linear second order ODEs. The proofs are similar to the proofs in the previous section, but we include them for completeness.
Proposition 23.
Consider the system of differential equations
(16) |
where the unknown , with boundary conditions and . Let be a matrix and let be a vector so that the differential equations
and
have solutions, . Let be the diffusion corresponding to given in Theorem 13 with . Then the solution to (16) is
(17) |
Here, the conditional mode of a diffusion is defined as the minimizer of the Onsager-Machlup function defined in Theorem 13 over all paths with , as in Remark 11.
Proof.
Theorem 24 (Feynman-Kac for system of ODEs).
Consider the system of differential equations
(20) |
where the unknown , with boundary conditions and . Let be matrices and let be a vector. Let . Suppose that the matrix exponentials and exist and commutes with both and . Define the functions
and
where denotes the standard exponential of a matrix. Suppose that the differential equations
(21) |
and
have solutions, , implying that the solution given in Proposition 23 to the equation
exists. Then the solution to (14) is
(22) |
Proof.
Differentiating once yields that
Differentiating again gives
Checking that satisfies equation (14) using the commutivity assumption concludes that
∎
5. Examples
In this section, we give a few examples of the process for various ODEs.
Example 1.
Consider the ODE
As there is no term, we may use Proposition 16 directly. In this case, solves the first order differential equation
Thus we may let . As there is no term, we may simply let . Therefore choosing and thus
Thus the solution is the conditional mode of the process with density
That is, the process
Example 2.
Consider the ODE
As we must use the full Theorem 22. We note that and . So therefore is the same as the previous example and we only need to include the exponential weight to get that
Example 3.
Consider the ODE
Then we can let and . Therefore . Therefore
Thus the solution is the conditional mode of the process with density
That is, the process is
We conclude with an example of an ODE so that equation (7) cannot be solved explicitly.
Example 4.
Consider the Airy ODE
with boundary conditions and . As we may use Proposition 16. must satisfy
However, this equation is not explicitly solvable by hand. Therefore we estimate using a regular perturbation expansion and use part (d) of our portmanteau Theorem 13 to estimate the solution. We numerically minimize the functional
over all which are Legendre polynomials of degree less than with the estimated , we call this minimizer . We plot the estimated solutions against the true solution, along with the value of the functional
for various degrees of approximation in Figure 1.



The approximation can be expected to improve further by employing higher degree Legendre polynomials. However, as Figure 1(B) and Figure 1(C) show, this improvement is very slow. Nonetheless, what we have demonstrated is a completely new approach to solving the Airy equation.
6. Conclusions
We presented a new Feynman-Kac type formula for systems of linear second order ODEs, by demonstrating that the solution of the ODE is the mode of a specific diffusion process that is determined by the coefficients of the ODE. To the best of our knowledge, this characterization of the solution of a given linear ODE in terms of a path functional of a stochastic process is novel and has not been identified in the literature before. This result opens the door to new ways of solving second order linear ODEs, potentially leveraging stochastic simulation, just as the Feynman-Kac theorem has led to the development of Monte Carlo methods for solving linear parabolic PDEs. We gave a few examples of the utility of our result for numerically solving ODEs. The primary bottleneck to numerically implementing this method is the calculation of which, as noted before, is the solution to a Riccati equation which is known to be difficult to solve explicitly. There is work, of course, on numerical solutions of Riccati equations, see e.g. [5]. In our current example with the Airy equation, we compute an approximate solution to the Ricatti equation by using a regular perturbation expansion (which entails the introduction of some ‘bias’ into final solution to the second order ODE).
However, once is identified, numerically computing the solution to the second order ODE can be done reasonably efficiently. Part (d) of our Portmanteau in Theorem 13 provides one possible way of computing the mode. Alternatively, the part (a) of the theorem suggests that the mode could be computed by solving the constrained information projection. One approach to doing this would be to use the Iterative Proportional Fitting Procedure (IPFP) or its discrete counterpart the Sinkhorn algorithm [14], for instance. There are also direct methods for computing the mode; see [16] for examples using a trapezoidal discretization.
To conclude, we pose two open questions:
Question 1.
Is there an efficient way of numerically estimating the solution without estimating first?
Question 2.
Can we extend our results to nonlinear ODE? That is, given a general equation
is there a condition on so that we can guarantee to find a corresponding ?
Acknowledgements
The authors would like to acknowledge Zihe Zhou for her code for the Airy equation, Example 4.
References
- [1] Luigi Accardi. On the quantum Feynman-Kac formula. Rend. Sem. Mat. Fis. Milano, 48:135–180 (1980), 1978.
- [2] Anas Al Bastami, Milivoj R. Belić, and Nikola Z. Petrović. Special solutions of the Riccati equation with applications to the Gross-Pitaevskii nonlinear PDE. Electron. J. Differential Equations, pages No. 66, 10, 2010.
- [3] Fabrice Baudoin. Diffusion processes and stochastic calculus. EMS Textbooks in Mathematics. European Mathematical Society (EMS), Zürich, 2014.
- [4] Lorenzo Bertini and Nicoletta Cancrini. The stochastic heat equation: Feynman-Kac formula and intermittence. J. Statist. Phys., 78(5-6):1377–1401, 1995.
- [5] Jafar Biazar and Mohsen Didgar. Numerical solution of Riccati equations by the Adomian and asymptotic decomposition methods over extended domains. Int. J. Differ. Equ., pages Art. ID 580741, 7, 2015.
- [6] Joris Bierkens and Hilbert J. Kappen. Explicit solution of relative entropy weighted control. Systems Control Lett., 72:36–43, 2014.
- [7] F. Cérou, P. Del Moral, and A. Guyader. A nonasymptotic theorem for unnormalized Feynman-Kac particle models. Ann. Inst. Henri Poincaré Probab. Stat., 47(3):629–649, 2011.
- [8] K. L. Chung and K. M. Rao. Feynman-Kac functional and the Schrödinger equation. In Seminar on Stochastic Processes, 1981 (Evanston, Ill., 1981), volume 1 of Progr. Prob. Statist., pages 1–29. Birkhäuser, Boston, Mass., 1981.
- [9] Y Dan. Bayesian inference for Gaussian models: Inverse problems and evolution equations. 2020.
- [10] M. Dashti, K. J. H. Law, A. M. Stuart, and J. Voss. MAP estimators and their consistency in Bayesian nonparametric inverse problems. Inverse Problems, 29(9):095017, 27, 2013.
- [11] P. Del Moral and L. Miclo. Branching and interacting particle systems approximations of Feynman-Kac formulae with applications to non-linear filtering. In Séminaire de Probabilités, XXXIV, volume 1729 of Lecture Notes in Math., pages 1–145. Springer, Berlin, 2000.
- [12] Pierre Del Moral. Feynman-Kac formulae. Probability and its Applications (New York). Springer-Verlag, New York, 2004. Genealogical and interacting particle systems with applications.
- [13] Pierre Del Moral, Arnaud Doucet, and Sumeetpal S. Singh. A backward particle interpretation of Feynman-Kac formulae. M2AN Math. Model. Numer. Anal., 44(5):947–975, 2010.
- [14] Simone Di Marino and Augusto Gerolin. An optimal transport approach for the schrödinger bridge problem and convergence of sinkhorn algorithm. Journal of Scientific Computing, 85(2):1–28, 2020.
- [15] Detlef Dürr and Alexander Bach. The Onsager-Machlup function as Lagrangian for the most probable path of a diffusion process. Communications in Mathematical Physics, 60(2):153–170, 1978.
- [16] Dimas Abreu Dutra, Bruno Otávio Soares Teixeira, and Luis Antonio Aguirre. Maximum a posteriori state path estimation: discretization limits and their interpretation. Automatica J. IFAC, 50(5):1360–1368, 2014.
- [17] Batu Güneysu, Matthias Keller, and Marcel Schmidt. A Feynman-Kac-Itô formula for magnetic Schrödinger operators on graphs. Probab. Theory Related Fields, 165(1-2):365–399, 2016.
- [18] Martin Hairer. An introduction to stochastic PDEs. arXiv preprint arXiv:0907.4178, 2009.
- [19] Yaozhong Hu, Fei Lu, and David Nualart. Feynman-Kac formula for the heat equation driven by fractional noise with Hurst parameter . Ann. Probab., 40(3):1041–1068, 2012.
- [20] Yaozhong Hu, David Nualart, and Jian Song. Feynman-Kac formula for heat equation driven by fractional white noise. Ann. Probab., 39(1):291–326, 2011.
- [21] Svante Janson and Johan Tysk. Feynman-Kac formulas for Black-Scholes-type operators. Bull. London Math. Soc., 38(2):269–282, 2006.
- [22] M. Kac. On distributions of certain Wiener functionals. Trans. Amer. Math. Soc., 65:1–13, 1949.
- [23] Maxim Kontsevich. Intersection theory on the moduli space of curves and the matrix Airy function. Comm. Math. Phys., 147(1):1–23, 1992.
- [24] József Lőrinczi, Fumio Hiroshima, and Volker Betz. Feynman-Kac-type theorems and Gibbs measures on path space, volume 34 of De Gruyter Studies in Mathematics. Walter de Gruyter & Co., Berlin, 2011. With applications to rigorous quantum field theory.
- [25] Bernt Ø ksendal. Stochastic differential equations. Universitext. Springer-Verlag, Berlin, sixth edition, 2003. An introduction with applications.
- [26] Zachary Selk, William Haskell, and Harsha Honnappa. Information projection on banach spaces with applications to state independent kl-weighted optimal control. Appl. Math. Optim., 2021.
- [27] Zhong Xin Zhao. Green function for Schrödinger operator and conditioned Feynman-Kac gauge. J. Math. Anal. Appl., 116(2):309–334, 1986.