Ordinary Differential Equation

Ordinary Differential Equation (ODE)

The defination of ODE

An ODE is an equation in which the unknown quantity is a function, and it also involves derivatives of the unknown function.

For example, the forced spring-mass system:

d2x(t)dt2+γdx(t)dt+v2x(t)=w(t).(1)\frac{d^2 x(t)}{d t^2} + \gamma \frac{d x(t)}{dt} + v^2 x(t) = w(t). \qquad (1)

In this equation:

  • vv and γ\gamma are constants that determine the resonant angular velocity
    and damping of the spring.

  • w(t)w(t) is a given function that may or may not depend on time.

  • position variable xx is called dependent variable.

  • time tt is called independent variable.

  • This equation is second order. It contains the second derivative and doesn’t have higher-order terms.

  • This equation is linear. x(t)x(t) is linearly. There is no terms like x2(t),logx(t)x^2(t), \log x(t)

  • This equation is inhomogeneous. Because it contains forcing term w(t)w(t).

The solution to ODE

It can be divided to two categories:

  • particular solution: a function that satisfies the differential equation and does not contain any arbitrary constants.

  • general solution: a function that satisfies the differential equation and contains free constants.

To exactly solve the differential equation, it is necessary to combine the general
solution with some initial conditions (i.e., x(t0)x(t_0), dx(t)dtt0\frac{d x(t)}{dt} |_{t_0}) or some other (boundary) conditions of the differential equation.

Different formulation of ODE

It is common to omit the time tt, so equation (1) can also be writen is this form:

d2xdt2+γdxdt+v2x=w.\frac{d^2 x}{d t^2} + \gamma \frac{d x}{dt} + v^2 x = w.

Sometimes, time derivatives are also denoted with dots over the variable,
for example:

x¨+γx˙+v2x=w.(2)\ddot{x} + \gamma \dot x + v^2 x = w. \qquad (2)

State-space form of the differential equation (first-order vector differential equation)

  • order: the order of a differential equation is the order of the highest derivative that appears in the equation.

  • Order NN ODE can convert to Order 1 vector ODE
    i.e.,
    if we define a state variable x=(x1=x,x2=x˙)\vec{x} = (x_1 = x, x_2 = \dot{x}), then we can convert equation(2) to

(dx1(t)dtdx2(t)dt)=(01v2γ)(x1(t)x2(t))+(01)w(t)(3)\begin{pmatrix} \frac{d x_1 (t)}{dt} \\ \frac{d x_2 (t)}{dt} \end{pmatrix} = \begin{pmatrix} 0 & 1 \\ -v^2 & -\gamma \end{pmatrix} \begin{pmatrix} x_1 (t) \\ x_2 (t) \end{pmatrix} + \begin{pmatrix} 0 \\ 1 \end{pmatrix} w(t) \qquad (3)

Define dx(t)dt=(dx1(t)dtdx2(t)dt),\frac{d \vec{x}(t)}{dt} = \begin{pmatrix} \frac{d x_1 (t)}{dt} \\ \frac{d x_2 (t)}{dt} \end{pmatrix}, f(x(t))=(01v2γ)(x1(t)x2(t))f(\vec{x}(t)) = \begin{pmatrix} 0 & 1 \\ -v^2 & -\gamma \end{pmatrix} \begin{pmatrix} x_1 (t) \\ x_2 (t) \end{pmatrix} and
L=(01).\mathbf{L} = \begin{pmatrix} 0 \\ 1 \end{pmatrix}.

Equation (3) can be seen to be a special case of this form:

dx(t)dt=f(x(t),t)+L(x(t),t)w(t)\frac{d \vec{x}(t)}{dt} = f(\vec{x}(t), t) + \mathbf{L}(\vec{x}(t), t)\vec{w}(t)

where the vector-valued function x(t)RD\vec{x}(t) \in R^D is the state of the system. f(,)f(\cdot, \cdot) and L(,)\mathbf{L}(\cdot, \cdot) are arbitrary functions. w(t)\vec{w}(t) is some (vector-valued) forcing function, driving function, or input to the system.

  • The first-order vector differential equation representation of an nnth-order
    differential equation is often called the state-space form of the differential
    equation.

  • The theory and solution methods for first-order vector differential equations are easier to analyze.

  • And, nn th order differential equations can (almost) always be converted into equivalent nn-dimensional vector-valued first-order differential equations.

Linear ODEs

Equation (3) is also a special case of the linear differential equations:

dx(t)dt=F(t)x(t)+Lw(t).\frac{d \vec{x}(t)}{dt} = \mathbf{F}(t) \vec{x}(t) + \mathbf{L} \vec{w}(t).

where F(t)\mathbf{F}(t) is a matrix-valued function of time. L\mathbf{L} is a matrix. w(t)\vec{w}(t) is a vector-valued function of time.

  • homogeneous: the equation is homogeneous if the forcing function w(t)\vec{w}(t) is zero for all tt.
  • time-invariant: the equation is time-invariant if F(t)\mathbf{F}(t) is constant for all tt.

In the following sections, we first start with the simple scalar linear time-invariant homogeneous differential equation with fixed initial condition at t=0t = 0. Then, we will consider the multidimensional generalization of this equation. Besides, we also consider the linear time-invariant inhomogeneous differential equations. Finally, we will consider more general differential equations.

Solutions of Linear Time-Invariant Differential Equations

Consider the scalar linear homogeneous differential equation with fixed initial condition at t=0t = 0:

dx(t)dt=Fx(t),x(0)=given,(4)\frac{d x(t)}{dt} = F x(t), x(0) = \text{given}, \qquad (4)

where FF is a constant.

This equation can be solved by separation of variables:

dx(t)x(t)=Fdt.\frac{d x(t)}{x(t)} = F dt.

Integrating the left-hand side from x(0)x(0) to x(t)x(t), and right-hand side from 00 to tt, we get

logx(t)x(0)=Ft.\log \frac{x(t)}{x(0)} = F t.

Combining the initial condition, we get

x(t)=x(0)eFt.x(t) = x(0) e^{F t}.

Another way to solve this equation is to by intergrating both sides of equation (4) from 00 to tt. We get

x(t)=x(0)+0tFx(τ)dτ.x(t) = x(0) + \int_0^t F x(\tau) d \tau.

The we can substitute the solution back into the right-hand side of the equation, and we get

x(t)=x(0)+0tFx(τ)dτ=x(0)+0tF[x(0)+0τFx(τ)dτ]dτ=x(0)+Fx(0)t+0t0τF2x(τ)dτdτ=x(0)+Fx(0)t+F2x(0)t22+0t0τ0τF3x(τ)dτdτdτ=...=x(0)+Fx(0)t+F2x(0)t22+F3x(0)t36+=(1+Ft+F2t2/2+F3t3/3!+)x(0)=eFtx(0).(Taylor expansion)\begin{aligned} x(t) &= x(0) + \int_0^t F x(\tau) d \tau \\ &= x(0) + \int_0^t F [x(0) + \int_0^{\tau} F x(\tau') d \tau'] d \tau \\ &= x(0) + F x(0) t + \int_0^t \int_0^{\tau}F^2 x(\tau') d \tau' d \tau \\ &= x(0) + F x(0) t + F^2 x(0) \frac{t^2}{2} + \int_0^t \int_0^{\tau} \int_0^{\tau'}F^3 x(\tau'') d \tau'' d \tau' d \tau \\ &= ...\\ &= x(0) + F x(0) t + F^2 x(0) \frac{t^2}{2} + F^3 x(0) \frac{t^3}{6} + \cdots\\ &= (1 + Ft + F^2 t^2 /2 + F^3 t^3 /3! + \cdots) x(0)\\ &= e^{F t} x(0). \qquad (\text{Taylor expansion}) \end{aligned}

For the multidimensional linear homogeneous differential equation with fixed initial condition at t=0t = 0:

dx(t)dt=Fx(t),x(0)=given,(5)\frac{d \vec{x}(t)}{dt} = \mathbf{F} \vec{x}(t), \vec{x}(0) = \text{given}, \qquad (5)

where F\mathbf{F} is a constant matrix.

We can not use the separation of variables method to solve this equation, because the x(t)\vec{x}(t) is a vector. But we can use the series-based method to solve this equation. Similar to the scalar case, we can get a solution of equation (5):

x(t)=eFtx(0).(6)\vec{x}(t) = e^{\mathbf{F} t} \vec{x}(0). \qquad (6)

where the matrix exponential eFt=I+Ft+F2t22!+e^{\mathbf{F} t} = \mathbf{I} + \mathbf{F}t + \frac{\mathbf{F}^2 t^2}{2!} + \cdots.

Remark:

  • The matrix exponential is not the same as the element-wise exponential of a matrix. Thus, we can not compute it by using the element-wise exponential function.

  • But the matrix exponential function can be found as a built-in function in many programming languages, such as MATLAB and Python.

  • Another way to compute it analytically, by using the Taylor expansion of the matrix exponential function, the Laplace or Fourier transform.

Next, let’s move to the linear time-invariant inhomogeneous differential equations:

dx(t)dt=Fx(t)+Lw(t),x(t0)=given,(7)\frac{d \vec{x}(t)}{dt} = \mathbf{F} \vec{x}(t) + \mathbf{L} \vec{w}(t), \vec{x}(t_0) = \text{given}, \qquad (7)

where F\mathbf{F} is a constant matrix, L\mathbf{L} is a constant matrix, and w(t)\vec{w}(t) is a vector-valued function of time.

First, we can move the Fx(t)\mathbf{F} \vec{x}(t) to the left-hand side of the equation and multify both sides with a integrating factor exp(Ft)\exp(- \mathbf{F}t), and get

exp(Ft)dx(t)dtexp(Ft)Fx(t)=exp(Ft)Lw(t),\begin{aligned} \exp(- \mathbf{F}t) \frac{d \vec{x}(t)}{dt} - \exp(- \mathbf{F}t)\mathbf{F} \vec{x}(t) = \exp(- \mathbf{F}t) \mathbf{L} \vec{w}(t), \end{aligned}

Since ddtexp(Ft)x(t)=exp(Ft)dx(t)dtexp(Ft)Fx(t)\frac{d}{dt} \exp(- \mathbf{F}t) \vec{x}(t) = \exp(- \mathbf{F}t) \frac{d \vec{x}(t)}{dt} - \exp(- \mathbf{F}t)\mathbf{F} \vec{x}(t), we can rewrite the above equation as

ddtexp(Ft)x(t)=exp(Ft)Lw(t).\frac{d}{dt} \exp(- \mathbf{F}t) \vec{x}(t) = \exp(- \mathbf{F}t) \mathbf{L} \vec{w}(t).

Integrating both sides from t0t_0 to tt, we get

exp(Ft)x(t)exp(Ft0)x(t0)=t0texp(Fτ)Lw(τ)dτ.\exp(- \mathbf{F}t) \vec{x}(t) - \exp(- \mathbf{F}t_0) \vec{x}(t_0) = \int_{t_0}^t \exp(- \mathbf{F}\tau) \mathbf{L} \vec{w}(\tau) d \tau.

Then, we can get the solution of equation (7):

x(t)=exp(F(tt0))x(t0)+t0texp(F(tτ))Lw(τ)dτ.(8)\vec{x}(t) = \exp(\mathbf{F}(t - t_0)) \vec{x}(t_0) + \int_{t_0}^t \exp(\mathbf{F}(t - \tau)) \mathbf{L} \vec{w}(\tau) d \tau. \qquad (8)

Solutions of General Linear ODEs

The previous section only consider the linear time-invariant differential equations(FF is a constant). In this section, we will consider the general linear differential equations with time-varying coefficients.

For the linear homogeneous time-varying differential equation with fixed initial condition at t=t0t = t_0:

dx(t)dt=F(t)x(t),x(t0)=given,(9)\frac{d \vec{x}(t)}{dt} = \mathbf{F}(t) \vec{x}(t), \quad \vec{x}(t_0) = \text{given}, \qquad (9)

where F(t)\mathbf{F}(t) is a matrix-valued function of time.
We can not use the exponential matrix to solve this equation, because the F(t)\mathbf{F}(t) is a time-varying matrix. But the solution of this equation has a general form:

x(t)=Ψ(t,t0)x(t0),(10)\vec{x}(t) = \mathbf{\Psi}(t, t_0) \vec{x}(t_0), \qquad (10)

where Ψ(t,t0)\mathbf{\Psi}(t, t_0) is a matrix-valued function of time, and it is called the transition matrix. The transition matrix Ψ(t,t0)\mathbf{\Psi}(t, t_0) satisfies the following differential properties:

Ψ(τ,t)τ=F(τ)Ψ(τ,t),Ψ(τ,t)t=Ψ(τ,t)F(t),Ψ(τ,t)=Ψ(τ,s)Ψ(s,t)(11)Ψ(t,τ)=Ψ1(τ,t)Ψ(t,t)=I.\begin{aligned} \frac{\partial \mathbf{\Psi}(\tau, t)}{\partial \tau} &= \mathbf{F}(\tau) \mathbf{\Psi}(\tau, t), \\ \frac{\partial \mathbf{\Psi}(\tau, t)}{\partial t} &= - \mathbf{\Psi}(\tau, t) \mathbf{F}(t), \\ \mathbf{\Psi}(\tau, t) &= \mathbf{\Psi}(\tau, s) \mathbf{\Psi}(s, t) \qquad (\text{11}) \\ \mathbf{\Psi}(t, \tau) &= \mathbf{\Psi}^{-1}(\tau, t) \\ \mathbf{\Psi}(t, t) &= \mathbf{I}. \end{aligned}

In most cases, the transition matrix Ψ(t,t0)\mathbf{\Psi}(t, t_0) does not have a closed-form solution.

For the linear inhomogeneous time-varying differential equation with fixed initial condition at t=t0t = t_0:

dx(t)dt=F(t)x(t)+L(t)w(t),x(t0)=given,(12)\frac{d \vec{x}(t)}{dt} = \mathbf{F}(t) \vec{x}(t) + \mathbf{L}(t) \vec{w}(t), \quad \vec{x}(t_0) = \text{given}, \qquad (12)

where F(t)\mathbf{F}(t) is a matrix-valued function of time, L(t)\mathbf{L}(t) is a matrix-valued function of time, and w(t)\vec{w}(t) is a vector-valued function of time.
The solution of this equation has a general form:

x(t)=Ψ(t,t0)x(t0)+t0tΨ(t,τ)L(τ)w(τ)dτ.(13)\vec{x}(t) = \mathbf{\Psi}(t, t_0) \vec{x}(t_0) + \int_{t_0}^t \mathbf{\Psi}(t, \tau) \mathbf{L}(\tau) \vec{w}(\tau) d \tau. \qquad (13)

When F(t)\mathbf{F}(t) and L(t)\mathbf{L}(t) is constant, the solution of equation (7) is a special case of (13) and we can verfiy that the Ψ(t,t0)=exp(F(tt0))\Psi(t, t_0) = \exp(\mathbf{F}(t - t_0)) satisfies properties (10).

Fourier tansforms and Laplace transforms are two useful methods to solve inhomogeneous linear time-invariant ODE (Note that time-invariant).

Fourier Transforms

The Fourier transform of a function x(t)x(t) is defined as:

X(iw)=F[x(t)]=x(t)exp(iwt)dt,(14)X(i w) = \mathcal{F}[x(t)] = \int_{-\infty}^{\infty} x(t) \exp(-iwt) \text{d}t, \qquad (14)

where ii is the imaginary unit.

The inverse Fourier transform of (14) is:

x(t)=F1[X(iw)]=12πX(iw)exp(iwt)dt.x(t) = \mathcal{F}^{-1}[X(i w)] = \frac{1}{2\pi} \int_{-\infty}^{\infty} X(iw) \exp(i w t) \text{d}t.

Some useful properties:

  • differention: F[dnx(t)dtn]=(iw)nF[x(t)]\mathcal{F}[\frac{\text{d}^n x(t)}{\text{d} t^n}] = (iw)^{n} \mathcal{F}[x(t)].

  • convolution: F[x(t)y(t)]=F[x(t)]F[y(t)]\mathcal{F}[x(t) \ast y(t)] = \mathcal{F}[x(t)] \ast \mathcal{F}[y(t)], where the convolution \ast is defined as

    x(t)y(t)=x(tτ)y(τ)dτx(t) \ast y(t) = \int_{-\infty}^{\infty} x(t - \tau)y(\tau) \text{d}\tau

If we want to use Fourier transform to solve ODEs, the initial condition must be 0.

Now, let’s use Fourier transform to solve the linear time-invariant inhomogeneous differential equations:

dx(t)dt=Fx(t)+Lw(t),x(t0)=0,\frac{d \vec{x}(t)}{dt} = \mathbf{F} \vec{x}(t) + \mathbf{L} \vec{w}(t), \quad \vec{x}(t_0) = 0,

where F\mathbf{F} is a constant matrix, L\mathbf{L} is a constant matrix, and w(t)\vec{w}(t) is a vector-valued function of time.

Take Fourier tranforms componentwise give

(iw)X(iw)=FX(iw)+LW(iw),(iw)\vec{X}(iw) = \mathbf{F} \vec{X}(iw) + \mathbf{L} \vec{W}(iw),

thus, we can get

X(iw)=[(iw)IF]1LW(iw),\vec{X}(iw) = [(iw)\mathbf{I} - \mathbf{F}]^{-1} \ast \mathbf{L} \vec{W}(iw),

The solution is the inverse Fourier transform

x(t)=F1[[(iw)IF]1LW(iw)]=F1[((iw)IF)1]Lw(t),(15)x(t) = \mathcal{F}^{-1}[[(iw)\mathbf{I} - \mathbf{F}]^{-1} \ast \mathbf{L} \vec{W}(iw)] = \mathcal{F}^{-1}[((iw)\mathbf{I} - \mathbf{F})^{-1}]\ast \mathbf{L} \vec{w}(t), \qquad (15)

Since x(t0)=0\vec{x}(t_0) = 0, compare the solution (15) with solution (8), we can obtain

F1[((iw)IF)1]=exp(Ft)u(t), \mathcal{F}^{-1}[((iw)\mathbf{I} - \mathbf{F})^{-1}] = \exp(\mathbf{F}t) u(t),

where u(t)u(t) is the Heaviside step function, which is 0 for t<0t<0 and 1 for t0t \geq 0.

Laplace Transforms

The Laplace transform of a function f(t)f(t) is defined on space {tt0}\{t | t\geq 0\}:

F(s)=L[f(t)]=0f(t)exp(st)dt,(16)F(s) = \mathcal{L}[f(t)] = \int_{0}^{\infty} f(t)\exp(-st) \text{d}t, \qquad (16)

where s=σ+iws = \sigma + iw.

The inverse transform is f(t)=L1[F(s)]f(t) = \mathcal{L}^{-1}[F(s)].

Remember that the Fourier transform needs the initial condition x(0)=0x(0) = 0. But Laplace transform can take the initial conditions into account. If x(0)=givenx(0) = \text{given}, then

L[dx(t)dt]=sL[x(t)]x(0)=sX(s)x(0).\mathcal{L}[\frac{\text{d} x(t)}{\text{d} t}] = s \mathcal{L}[x(t)] - x(0) = s X(s) - x(0).

L[dnx(t)dtn]=snX(s)sn1x(0)dxn1dtn1(0).\mathcal{L}[\frac{\text{d}^n x(t)}{\text{d} t^n}] = s^n X(s) - s^{n-1} x(0) - \cdots - \frac{\text{d} x^{n-1}}{\text{d} t^{n-1}}(0).

Now, let’s use Laplace transform to solve the linear time-invariant inhomogeneous differential equations:

dx(t)dt=Fx(t)+Lw(t),x(t0)=given0,\frac{d \vec{x}(t)}{dt} = \mathbf{F} \vec{x}(t) + \mathbf{L} \vec{w}(t), \quad \vec{x}(t_0) = \text{given} \ne 0,

where F\mathbf{F} is a constant matrix, L\mathbf{L} is a constant matrix, and w(t)\vec{w}(t) is a vector-valued function of time.

Take Laplace tranforms componentwise give

sX(s)x(0)=FX(s)+LW(s).s X(s) - x(0) = \mathbf{F} X(s) + \mathbf{L} W(s).

Then,

X(s)=[sIF]1x(0)+[sIF]1LW(s).(17)X(s) = [s\mathbf{I}-\mathbf{F}]^{-1} x(0) + [s\mathbf{I}-\mathbf{F}]^{-1} \ast \mathbf{L} W(s). \qquad (17)

Compare the solution (17) with solution (8), we can obtain

L1[(sIF)1]=exp(Ft)\mathcal{L}^{-1}[(s\mathbf{I}-\mathbf{F})^{-1}] = \exp(\mathbf{F}t)

for t0t \geq 0.

Reference

Simo Särkkä and Arno Solin (2019). Applied Stochastic Differential Equations. Cambridge University Press.

  • Copyright: Copyright is owned by the author. For commercial reprints, please contact the author for authorization. For non-commercial reprints, please indicate the source.
  • Copyrights © 2021-2026 Xue Yu
  • Visitors: | Views: