logo

A Trick to Solve Ordinary Differential Equations Backwards in Time 📂Numerical Analysis

A Trick to Solve Ordinary Differential Equations Backwards in Time

Method

dydt=f(y) {\frac{ d y }{ d t }} = f(y) Consider a numerical solver KK for solving the given ordinary differential equation using a future time point T>0T > 0 and initial value y0y_{0}. Assume it operates as follows: K(f,T,y0)={y(t):t[0,T]} K \left( f , T , y_{0} \right) = \left\{ y(t) : t \in [0, T] \right\} Conversely, to obtain {y(s):s[S,0]}\left\{ y(s) : s \in [-S, 0] \right\} at a past time point S>0S > 0, one would calculate K(f,S,y0)K \left( -f , S , y_{0} \right).

Explanation

The trick introduced above involves a method to send the solver in reverse time, regardless of its form. This reverse-time manipulation is particularly useful in analyzing dynamical systems to locate unstable fixed points, and similar tasks.

The crux of the trick is that reversing time is simple, requiring only the substitution of ff with f-f.

Motive

f(y)=dydt=limh0y(t+h)y(t)h    y(t+h)y(t)+hf(y) \begin{align*} & f(y) = {\frac{ d y }{ d t }} = \lim_{h \to 0} {\frac{ y(t + h) - y(t) }{ h }} \\ \implies & y (t + h) \approx y(t) + h f(y) \end{align*} Consider, for example, the Euler method, which derives such approximation for sufficiently small hh. According to the definition of a derivative y˙\dot{y}, there should be no harm in using y(t)y(th)y(t) - y(t - h) instead of y(t+h)y(t)y(t + h) - y(t) in the numerator. Consequently, the following calculation is possible. f(y)=dydt=limh0y(t)y(th)h    y(th)y(t)hf(y)=y(t)+h(f(y)) \begin{align*} & f(y) = {\frac{ d y }{ d t }} = \lim_{h \to 0} {\frac{ y(t) - y(t - h) }{ h }} \\ \implies & y (t - h) \approx y(t) - h f(y) = y(t) + h \cdot \left( - f (y) \right) \end{align*} This backward solution implies that if the Euler method is KK, solving K(f,h,y0)K \left( -f , h , y_{0} \right) is effectively the same.

Variable Substitution

However, if KK is not the Euler method, deriving results from such intuition alone becomes challenging. We attempt to explain this generalization using variable substitution like s=ts = -t. Here, the positive progression of ss towards S>0S > 0 indicates the reverse movement of tt, implying that time tt flows backward. The original ordinary differential equation y˙=f(y)\dot{y} = f(y) can thus be expressed as follows, using the chain rule: dydt=f(y)    dydsdsdt=f(y)    dyds=f(y)    y=f(y) \begin{align*} & {\frac{ d y }{ d t }} = f(y) \\ \implies & {\frac{ d y }{ d s }} {\frac{ d s }{ d t }} = f(y) \\ \implies & {\frac{ d y }{ d s }} = - f(y) \\ \implies & y ' = - f(y) \end{align*} Formally, this is equivalent to solving y=g(y)y ' = g (y) for g=fg = - f, and effectively applies the original method KK by merely reversing the sign of ff.