MATH1231 - Ordinary Differential Equations

Ordinary Differential Equations are equations expressed in terms of ONE independent variable and AT LEAST one of the derivatives is a function of this variable. (lolwut)

The order of an ODE is the order of the highest derivative present.

Essentially any solution to an nth order ODE is a function which when differentiated n times creates the ODT.


\begin{align} y(x) = \frac{x^3}{3} + 5x + C \text{ is the general solution to } \frac{dy}{dx} = x^2 + 5 \end{align}

Initial value problems

An initial value problem (IVP) is an nth order ODE with the extra information of a set of values of the solution and its first (n-1) derivatives at some fixed point.

These values are called the initial conditions of the IVP.

Equation, y(0) = 2, dy/dx is 7 for x = 0

First order


A separable ODE is a differential equation where the two variables can be separated to have all of x on one side, all of y on the other.

These can usually be written as

\begin{align} \frac{dy}{dx} = \frac{g(x)}{h(y)} \end{align}

We solve these by writing it as $h(y)dy = g(x)dx$, then integrating to find the implicit solution $H(y) = G(x) + C$

1st Order linear

These are called linear since there are no non-linear terms of y or y’ (i.e. no sin(y), powers of y, etc)
To solve them:

  1. Write them in the form:
\begin{align} \frac{dy}{dx} + f(x)y = g(x) \end{align}
  1. Let h(x) (the integrating factor) be:
\begin{align} e^{\int f(x)dx} \end{align}
  1. Multiply the equation by h(x):
\begin{align} h(x)\frac{dy}{dx} + h(x)f(x)y = h(x)g(x) \end{align}
  1. Use the product rule of differentiation

(i.e. remembering that $h(x) = e^{\int f(x)dx}$ then h(x)y differentiates to h(x)f(x)y + h(x)d/dx (as in, uv -> u'v + uv'))
to write it as:

\begin{align} \frac{d}{dx} (h(x)y) = g(x)h(x) \end{align}

This step seems confusing and like it doesn't make sense, so I'm going to analyse it more in depth:

\begin{align} h(x)\frac{dy}{dx} + h(x)f(x)y \rightarrow \frac{d}{dx} (h(x)y) \end{align}

What's happening here is that as $h(x) = e^{\int f(x)dx}$, it differentiates to $\int f(x)dx \cdot e^{\int f(x)dx}$. Essentially, deriving $h(x)y(x) = h'(x)y(x) + h(x)y'(x)$. Which leads to $f(x)h(x)y(x) + h(x)\frac{dy}{dx}$

  1. Integrate both sides and rearrange to get y on one side

Exact ODEs

Exact ODEs deal with functions of two variables.

\begin{equation} F(x,y) + G(x,y)dy/dx = 0 \end{equation}

If $\frac{\partial F}{\partial y} = \frac{\partial G}{\partial x}$ (i.e they have the same derivative) then this is an exact function

If the function is exact then there is a solution $H(x,y) = C$, where $F(x,y) = \frac{\partial H}{\partial x} \text{and} G(x, y) = \frac{\partial H}{\partial y}$

Or approaching from the other side, and starting , with the equation: $H(x, y) = C$

If the second order mixed partial derivatives of H are equal then $H(x, y) = C$ has solutions $F(x,y) \text{and} G(x,y)$, where they are respectively equal to $\frac{\partial H}{\partial x} \text{and} \frac{\partial H}{\partial y}$

Second Order - Linear ODEs with Constant Coefficients

Second order equations have the form of:

\begin{align} \frac{d^2 y}{dx^2} + a\frac{dy}{dx} + by = f(x) \end{align}


A 2nd Order Equation is Homogeonous if f(x) = 0. i.e.

\begin{align} \frac{d^2 y}{dx^2} + a\frac{dy}{dx} + by = 0 \end{align}

or more simple

\begin{equation} y'' + ay' + by = 0 \end{equation}

If $y_1$ and $y_2$ are solutions to the above equation then any linear combination ($Ay_1 + By_2$) is also a solution to the equation.

The proof for the above is simple - if $y_1$ goes to 0, and $y_2$ goes to 0, then multiplying them by numbers and adding them will still end up with 0.

Characteristic Equation

The characteristic equation is:

\begin{align} \lambda^{2} e^{\lambda x} + a \lambda e^{\lambda x} + b e^{\lambda x} \\ = e^{\lambda x} ( \lambda^{2} + a \lambda + b) \\ \end{align}

Essentially what we've done so far, (but using m instead of $\lambda$) is let m2 = y'', m = y' and 1 = y. The equation $y'' + ay' + by = 0$ can now be written as $m^2 + am + b = 0$. We work out m in the next section

$\delta = b^2 - 4ac$

  1. If $\delta > 0$

There are two solutions to the characteristic equation.
We take the results of m and set them as $m_1 \text{ and } m_2$, as well as setting A and B to be the factorisation of the characteristic equation (e.g. $(m - A)(m - B)$.

\begin{equation} y = Ae^{m_1x} + Be^{m_2x} \end{equation}
  1. If $\delta < 0$

There are two complex solutions, of the form:

\begin{align} m = a \pm ib \end{align}

We solve these by setting $y = e^{ax}(Acos(bx) + Bsin(bx))$
If we do not know A and/or B, we work them out with initial conditions, or leave them as variables.

E.g. $y'' + 2y' + 2y = 0, y(0) = 1, y'(0) = 0$

\begin{array} {l} m^2 + 2m + 2 = 0 \\ m = \frac{-2 \pm \sqrt{4-8}}{2} \\ m = -1 \pm i \\ \text {Hence} \\ y = e^{-x}(Acos(x) + Bsin(x)) \\ y' = -e^{-x}(Acos(x) + Bsin(x) + e^{-x}(-Asin(x) + Bcos(x)) \\ y' = e^{-x}((B-A)cos(x) - (A+B)sin(x)) \\ \text {Using initial conditions we can figure out that B-A must equal 0, and also that A = 1. Hence:} \\ y = e^{-x} (cos(x) + sin(x)) \end{array}
  1. If $\delta = 0$

There is one solution to the equation, such that $m = \frac{-b}{2}$

\begin{equation} y = Ae^{mx} + Bxe^{mx} \end{equation}


Inhomogeneous solutions are defined as those where f(x) != 0.

We solve these by setting $f(x) = h_x + p_x$ (homogeneous solution + polynomial solution).

Polynomial Solution

We solve this by making educated guesses:
(where p and q polynomials of the same degree)

\begin{array} f(x) & y(x) \\ p(x) & q(x) \\ p(x)e^{p(x)} & q(x)e^{q(x)} \\ p(x)cos(ax) \text { or } p(x)sin(ax) & q_1(x)cos(ax) + q_2(x)sin(ax) \\ p(x)e^{p(x)}sin(bx) \text { or } p(x)e^{p(x)}cos(bx)|& q_1(x)e^{p(x)}sin(bx) + q_2(x)e^{p(x)}cos(bx) \\ \end{array}

If the guess is a solution multiply the guess by x.
If it's still a solution multiply it again by x (i.e. by x2)