Primer on Ordinary Differential Equations

Table of Contents

What is an ODE?

F(t,y,y(t),y(t),,y(n)(t))=0F \left( t, y, y'(t), y''(t), \ldots, y^{(n)}(t) \right) = 0

Where:

The order is the highest derivative in the ODE. The degree is the exponent of the highest-order derivative (after clearing fractions/roots, only defined for polynomial ODEs). It is linear if the function and its derivatives appear to power 1, with no products. It is homogeneous if RHS = 0; otherwise non-homogeneous. The initial conditions are function/derivative values at a point for a unique solution.


Methods of Solving Analytically

Separation of Variables

For first-order ODEs of the form:

dydt=g(t)h(y)\frac{dy}{dt} = g(t)h(y)

Rearranging gives:

1h(y)dy=g(t)dt\frac{1}{h(y)} dy = g(t) dt

Integrating both sides:

1h(y)dy=g(t)dt\int \frac{1}{h(y)} dy = \int g(t) dt

Example:

dydt=ky\frac{dy}{dt} = ky 1ydy=kdt\frac{1}{y} dy = k dt lny=kt+C\ln |y| = kt + C y=Cekty = Ce^{kt}

Integrating Factors

For first-order linear ODEs of the form:

dydt+P(t)y=Q(t)\frac{dy}{dt} + P(t)y = Q(t)

Multiply by the integrating factor:

μ(t)=eP(t)dt\mu(t) = e^{\int P(t) dt}

Then:

ddt(μ(t)y)=μ(t)Q(t)\frac{d}{dt} \left( \mu(t)y \right) = \mu(t)Q(t)

Integrate both sides:

ddt(μ(t)y)dt=μ(t)Q(t)dt\int \frac{d}{dt} \left( \mu(t)y \right) dt = \int \mu(t)Q(t) dt μ(t)y=μ(t)Q(t)dt+C\mu(t)y = \int \mu(t)Q(t) dt + C y=1μ(t)(μ(t)Q(t)dt+C)y = \frac{1}{\mu(t)} \left( \int \mu(t)Q(t) dt + C \right)

Characteristic Equation

For linear ODEs with constant coefficients, such as:

any(n)+an1y(n1)++a1y+a0y=0a_n y^{(n)} + a_{n-1} y^{(n-1)} + \ldots + a_1 y' + a_0 y = 0

Assume a solution of the form:

y(t)=erty(t) = e^{rt}

Substituting into the ODE gives the characteristic equation:

anrn+an1rn1++a1r+a0=0a_n r^n + a_{n-1} r^{n-1} + \ldots + a_1 r + a_0 = 0

Solve for rr to find the roots. The general solution depends on the nature of the roots:

y(t)=C1er1t+C2er2t++Cnernty(t) = C_1 e^{r_1 t} + C_2 e^{r_2 t} + \ldots + C_n e^{r_n t} y(t)=(C1+C2t++Cntn1)erty(t) = (C_1 + C_2 t + \ldots + C_n t^{n-1}) e^{r t} y(t)=eαt(C1cos(βt)+C2sin(βt))y(t) = e^{\alpha t} \left( C_1 \cos(\beta t) + C_2 \sin(\beta t) \right)

Where r=α+iβr = \alpha + i\beta are the complex roots.


Methods of Solving Numerically

Euler's Method

For first-order ODEs of the form:

dydt=f(t,y)\frac{dy}{dt} = f(t, y)
  1. Choose a step size hh and initial condition y(t0)=y0y(t_0) = y_0.
  2. Compute the next value:
y(t0+h)=y0+hf(t0,y0)y(t_0 + h) = y_0 + h f(t_0, y_0)
  1. Repeat for subsequent points:
y(tn+1)=yn+hf(tn,yn)y(t_{n+1}) = y_n + h f(t_n, y_n)
  1. Continue until the desired range is covered.

Workflow

First Order ODEs