Ordinary differential equations
Nature rarely tells us a quantity directly. It tells us how the quantity changes. A differential equation is that rule of change.
"A hot cup of tea cools faster when it is much hotter than the room." That sentence is an equation: the rate of change of temperature is proportional to the temperature difference. A differential equation connects an unknown function with its derivatives. Solving it means finding the function — the whole cooling curve — from the rule alone.
- what an ODE (Ordinary Differential Equation) is, its order, and when it is linear;
- to read a direction field and sketch solutions without solving anything;
- classic models: growth and decay, logistic growth, cooling, oscillators, epidemics;
- initial value vs boundary value problems, and the theorem that guarantees a unique solution.
Water flows into a tank at 2 litres per minute, and at time $0$ it holds 1 litre. The rule of change is the ODE $y'(t) = 2$ with initial condition $y(0) = 1$. Its solution is a straight line: $y(t) = 1 + 2t$. Check: the derivative of $1 + 2t$ is $2$ ✓, and at $t = 0$ it gives $1$ ✓. A different starting amount gives a parallel line — the ODE fixes the slope, the initial condition picks which line. If instead $y' = 0$ (tap closed), the level never changes; if $y' = t$ (tap opened gradually), the solution is the parabola $y = t^2/2 + y(0)$.
1. What is an ODE?
An ordinary differential equation (ODE) is an equation involving an unknown function $y(t)$ of one variable and some of its derivatives, e.g. $F(t, y, y', y'', \dots, y^{(n)}) = 0$. Its order is that of the highest derivative. It is linear if it has the form $a_n(t)y^{(n)} + \dots + a_1(t)y' + a_0(t)y = g(t)$; otherwise it is nonlinear. A solution on an interval $I$ is a function that satisfies the equation at every $t \in I$.
Boyce, DiPrima & Meade, Elementary Differential Equations and Boundary Value Problems, 11th ed., Wiley (2017), chapter 1 "Introduction"."Ordinary" means one independent variable. When the unknown depends on several variables (space and time) the equation contains partial derivatives and is a PDE (Partial Differential Equation) — Chapter 7.
| Equation | Order | Linear? | Models |
|---|---|---|---|
| $y' = ky$ | 1 | yes | bank interest, radioactive decay, bacteria |
| $y' = r y\,(1 - y/K)$ | 1 | no ($y^2$ term) | population with limited resources |
| $T' = -k\,(T - T_{\text{room}})$ | 1 | yes | Newton's law of cooling |
| $m y'' + c y' + k y = 0$ | 2 | yes | spring, shock absorber, RLC (Resistor–Inductor–Capacitor) circuit |
| $\theta'' + \frac{g}{L}\sin\theta = 0$ | 2 | no | pendulum |
2. Solving the simplest ODE
Solve $y' = ky$ with $y(0) = y_0$. Separate variables: $\frac{dy}{y} = k\,dt$. Integrate: $\ln|y| = kt + C$. So $$y(t) = y_0\, e^{kt}.$$ Check: $y' = k y_0 e^{kt} = k y$ ✓. For $k < 0$ this is decay; the half-life is $\ln 2/|k|$. Every linear ODE with constant coefficients is solved by exponentials — that is why $e$ is everywhere.
Notice that the ODE alone has infinitely many solutions $Ce^{kt}$. The extra fact $y(0) = y_0$ — an initial condition — picks one. An ODE together with initial conditions is an initial value problem (IVP).
3. Direction fields: seeing solutions without solving

A first-order ODE $y' = f(t, y)$ tells you the slope of the solution at every point $(t, y)$. Draw a short dash with that slope at many points: this is a direction field. Solutions are curves that follow the dashes everywhere.
Consider $y' = f(t, y)$, $y(t_0) = y_0$. If $f$ and $\partial f/\partial y$ are continuous in a rectangle $|t - t_0| \le a$, $|y - y_0| \le b$, then there is an interval $|t - t_0| \le h$ (with $0 < h \le a$) on which the initial value problem has exactly one solution.
Boyce, DiPrima & Meade (2017), chapter 2, "The Existence and Uniqueness Theorem"; Coddington & Levinson, Theory of Ordinary Differential Equations, McGraw-Hill (1955), chapter 1.$y' = 3y^{2/3}$, $y(0) = 0$ has two solutions: $y = 0$ and $y = t^3$. Here $\partial f/\partial y = 2y^{-1/3}$ blows up at $y = 0$, so the theorem does not apply. A physical model with non-unique solutions usually means something is missing from the model.
4. Second-order equations: oscillators

Newton's second law (force = mass × acceleration) is second order, because acceleration is the second derivative of position. A mass on a spring with friction obeys $$m\,y'' + c\,y' + k\,y = 0, \qquad y(0) = y_0,\ y'(0) = v_0.$$ Two initial conditions are needed: where the mass starts and how fast it is moving. Trying $y = e^{rt}$ gives the characteristic equation $mr^2 + cr + k = 0$, whose roots decide the behaviour: complex roots → oscillation that dies out (underdamped), a double root → critically damped, two real roots → overdamped.
Any $n$-th order ODE can be rewritten as a system of $n$ first-order ODEs. With $v = y'$: $y' = v$, $v' = -(c v + k y)/m$. This is how computers handle them (Chapter 6), in vector form $\mathbf u' = \mathbf F(t, \mathbf u)$.
5. Systems: the SIR epidemic model
Split a population into Susceptible, Infected and Recovered fractions. Infection happens when S meets I; recovery happens at a constant rate: $$S' = -\beta S I, \qquad I' = \beta S I - \gamma I, \qquad R' = \gamma I.$$ This model (Kermack & McKendrick, Proc. R. Soc. Lond. A 115, 1927, 700–721) was used throughout the COVID-19 pandemic. The basic reproduction number $R_0 = \beta/\gamma$ decides whether an outbreak grows ($R_0 > 1$).
6. Initial vs boundary value problems
An IVP (Initial Value Problem) gives all conditions at one starting time: "the ball is thrown from here with this velocity". A boundary value problem (BVP) gives conditions at two ends of a region: "a cable is fixed at both poles; what shape does it hang in?" For example $$-u''(x) = f(x),\quad 0 < x < 1, \qquad u(0) = 0,\ u(1) = 0$$ models the steady temperature in a rod with heat source $f$ and ends held at 0. BVPs may have one, none or many solutions; e.g. $u'' + \pi^2 u = 0$, $u(0) = u(1) = 0$ has all solutions $C\sin(\pi x)$.
Boyce, DiPrima & Meade (2017), chapter 10 "Partial Differential Equations and Fourier Series", section on two-point boundary value problems.Physics-informed neural networks (Chapter 16) solve ODEs and BVPs by training a network $u_\theta(t)$ so that $u_\theta' - f(t, u_\theta) \approx 0$. Neural ODEs (Chen, Rubanova, Bettencourt & Duvenaud, NeurIPS 2018) go the other way: they learn the right-hand side $f$ as a neural network from data, $\mathbf u' = \mathrm{NN}_\theta(\mathbf u)$. Parameter estimation — finding $\beta, \gamma$ or a cooling rate $k$ from measurements — is the inverse problem at the heart of many applications.
7. Try it in Python
import numpy as np
import matplotlib.pyplot as plt
def sir(u, beta=0.35, gamma=0.1):
S, I, R = u
return np.array([-beta*S*I, beta*S*I - gamma*I, gamma*I])
def rk4(f, u0, t): # classical Runge-Kutta (Chapter 6)
u = np.zeros((len(t), len(u0))); u[0] = u0
for n in range(len(t) - 1):
h = t[n+1] - t[n]
k1 = f(u[n]); k2 = f(u[n] + h/2*k1); k3 = f(u[n] + h/2*k2); k4 = f(u[n] + h*k3)
u[n+1] = u[n] + h/6*(k1 + 2*k2 + 2*k3 + k4)
return u
t = np.linspace(0, 160, 801)
u = rk4(sir, np.array([0.99, 0.01, 0.0]), t)
for k, name in enumerate("SIR"):
plt.plot(t, u[:, k], label=name)
plt.xlabel("days"); plt.ylabel("fraction"); plt.legend(); plt.grid(alpha=.3)
plt.title("SIR model, R0 = 3.5"); plt.show()
print("peak infected fraction: %.3f on day %.0f" % (u[:, 1].max(), t[u[:, 1].argmax()]))
What is the order of $y''' + y\,y' = \sin t$, and is it linear?
Right: the highest derivative is $y'''$, and the product $y\,y'$ makes it nonlinear.
How many initial conditions does $m y'' + c y' + k y = 0$ need for a unique solution?
Right — an $n$-th order equation needs $n$ conditions: here position $y(0)$ and velocity $y'(0)$.
- An ODE relates a function of one variable to its derivatives; order = highest derivative.
- Initial conditions select one solution; Picard–Lindelöf guarantees exactly one when $f$ is smooth enough.
- Direction fields show the qualitative behaviour (equilibria, growth, decay) without solving.
- Higher-order ODEs become first-order systems $\mathbf u' = \mathbf F(t,\mathbf u)$.
- Few ODEs have formula solutions — numerical methods (next chapter) and PINNs fill the gap.
Further reading
- W. E. Boyce, R. C. DiPrima & D. B. Meade, Elementary Differential Equations and Boundary Value Problems, 11th ed., Wiley, 2017.
- G. F. Simmons, Differential Equations with Applications and Historical Notes, 3rd ed., CRC Press, 2016.
- E. A. Coddington & N. Levinson, Theory of Ordinary Differential Equations, McGraw-Hill, 1955.
- S. H. Strogatz, Nonlinear Dynamics and Chaos, 2nd ed., CRC Press, 2015 — phase portraits, equilibria and stability.
- R. T. Q. Chen, Y. Rubanova, J. Bettencourt & D. Duvenaud, "Neural ordinary differential equations", NeurIPS 2018.