This notebook contains an excerpt from the Python Programming and Numerical Methods - A Guide for Engineers and Scientists, the content is also available at Berkeley Python Numerical Methods.

The copyright of the book belongs to Elsevier. We also have this interactive book online for a better learning experience. The code is released under the MIT license. If you find this content useful, please consider supporting the work on Elsevier or Amazon!

# Reduction of Order¶

Many numerical methods for solving initial value problems are designed specifically to solve first-order differential equations. To make these solvers useful for solving higher order differential equations, we must often reduce the order of the differential equation to first order. To reduce the order of a differential equation, consider a vector, $$S(t)$$, which is the state of the system as a function of time. In general, the state of a system is a collection of all the dependent variables that are relevant to the behavior of the system. Recalling that the ODEs of interest in this book can be expressed as

$f^{(n)}(t) = F\left(t, f(t), f^{(1)}(t), f^{(2)}(t), f^{(3)}(t),\ldots, f^{(n-1)}(t)\right),$

for initial value problems, it is useful to take the state to be

$\begin{split} S(t) =\left[\begin{array}{c} f(t) \\ f^{(1)}(t) \\ f^{(2)}(t) \\ f^{(3)}(t) \\ \cdots \\ f^{(n-1)}(t) \end{array}\right]. \end{split}$

Then the derivative of the state is

$\begin{split} \frac{dS(t)}{dt} =\!\left[\begin{array}{c} f^{(1)}(t) \\ f^{(2)}(t) \\ f^{(3)}(t) \\ f^{(4)}(t) \\ \cdots \\ f^{(n)}(t) \end{array}\right]\!=\!\left[\begin{array}{c} f^{(1)}(t) \\ f^{(2)}(t) \\ f^{(3)}(t) \\ f^{(4)}(t) \\ \cdots \\ F\left(t, f(t), f^{(1)}(t),\ldots, f^{(n-1)}(t)\right) \end{array}\right]\!=\!\left[\begin{array}{c} S_2(t) \\ S_3(t) \\ S_4(t) \\ S_5(t) \\ \cdots \\ F\left(t, S_1(t), S_2(t),\ldots, S_{n-1}(t)\right) \end{array}\right]\!, \end{split}$

where $$S_i(t)$$ is the $$i^{\mathrm{th}}$$ element of $$S(t)$$. With the state written in this way, $$\frac{dS(t)}{dt}$$ can be written using only $$S(t)$$ (i.e., no $$f(t)$$) or its derivatives. In particular, $$\frac{dS(t)}{dt} = {\mathcal{F}}(t,S(t))$$, where $${\mathcal{F}}$$ is a function that appropriately assembles the vector describing the derivative of the state. This equation is in the form of a first-order differential equation in $$S$$. Essentially, what we have done is turn an $$n^{\mathrm{th}}$$ order ODE into $$n$$ first order ODEs that are coupled together, meaning they share the same terms.

TRY IT! Reduce the second order pendulum equation to first order, where

$\begin{split} S(t) =\left[\begin{array}{c} \Theta(t) \\ \dot{\Theta}(t) \end{array}\right]. \end{split}$

Taking the derivative of $$S(t)$$ and substituting gives the correct expression.

$\begin{split} \frac{dS(t)}{dt} =\left[\begin{array}{c} S_2(t) \\ -\frac{g}{l}S_1(t) \end{array}\right] \end{split}$

It happens that this ODE can be written in matrix form:

$\begin{split} \frac{dS(t)}{dt} =\left[\begin{array}{cc} 0 & 1 \\ -\frac{g}{l} & 0 \end{array}\right]S(t) \end{split}$

ODEs that can be written in this way are said to be linear ODEs.

Although reducing the order of an ODE to first order results in an ODE with multiple variables, all the derivatives are still taken with respect to the same independent variable, $$t$$. Therefore, the ordinariness of the differential equation is retained.

It is worth noting that the state can hold multiple dependent variables and their derivatives as long as the derivatives are with respect to the same independent variable.

TRY IT! A very simple model to describe the change in population of rabbits, $$r(t)$$, and wolves, $$w(t)$$, might be

$\frac{dr(t)}{dt} = 4r(t) - 2w(t)$

and

$\frac{dw(t)}{dt} = r(t) + w(t).$

The first ODE says that at each time step, the rabbit population multiplies by 4, but each wolf eats two of the rabbits. The second ODE says that at each time step, the population of wolves increases by the number of rabbits and wolves in the system. Write this system of differential equations as an equivalent differential equation in $$S(t)$$ where

$\begin{split} S(t) =\left[\begin{array}{c} r(t) \\ w(t) \end{array}\right]. \end{split}$

The following first-order ODE is equivalent to the pair of ODEs.

$\begin{split} \frac{dS(t)}{dt} = \left[\begin{array}{cc} 4 & -2 \\ 1 & 1 \end{array}\right]S(t). \end{split}$