First-Order ODEs

The workhorse equations of engineering. Learn separable equations, homogeneous (y/x) equations, exact equations and integrating factors, linear first-order equations with the integrating factor e^∫P, Bernoulli equations, orthogonal trajectories, and applications: RC/RL circuits, Newton's cooling, mixing tanks, population growth and motion with drag — with an RK4 check.

A capacitor charging, a hot part cooling, a tank mixing and a skydiver slowing all obey first-order ODEs. Mastering their solution methods covers a large share of practical dynamic analysis.

An analogy

Solving a first-order ODE is like finding a route when you only know the compass bearing at every point — the method rewinds the bearings into a path.

Separable equations

Move all y terms to one side and x terms to the other, integrate both sides, then apply the initial condition. Watch for lost solutions when dividing (e.g. y = 0).

Linear equations

Multiply by μ = e^(∫P dx) so the left side becomes (μy)′. This handles time-varying inputs, e.g. RC circuits driven by ramps or sinusoids.

Exact, homogeneous and Bernoulli

Exact equations come from a potential F(x, y); an integrating factor may make an equation exact. Homogeneous equations use v = y/x. Bernoulli equations (drag ∝ v², logistic growth) become linear with v = y^(1−n).

Applications

RC: RC dv/dt + v = V_s; RL: L di/dt + Ri = V; cooling; mixing; logistic P′ = rP(1 − P/K); orthogonal trajectories (field lines ⟂ equipotentials).

Formulas

Worked example: Cooling constant

Given: Part at 90 °C in 20 °C air; 60 °C after 10 min

Find: k and time to reach 30 °C.

Answer: k = 0.056 /min; 34.8 min

Worked example: RL circuit

Given: L = 0.5 H, R = 10 Ω, V = 12 V, i(0) = 0

Find: i(t) and i(0.1 s).

Answer: 1.04 A

RK4 check of Newton's law of cooling

import math

# Newton's law of cooling: dT/dt = -k (T - Ta)
k, Ta, T0 = 0.056, 20.0, 90.0

def f(t, T):
    return -k * (T - Ta)

def rk4(f, t, y, h):
    k1 = f(t, y)
    k2 = f(t + h/2, y + h*k1/2)
    k3 = f(t + h/2, y + h*k2/2)
    k4 = f(t + h, y + h*k3)
    return y + h * (k1 + 2*k2 + 2*k3 + k4) / 6

t, T, h = 0.0, T0, 1.0
while t < 30 - 1e-9:
    T = rk4(f, t, T, h)
    t += h
exact = Ta + (T0 - Ta) * math.exp(-k * 30)
print(f"RK4:   T(30) = {T:.6f} C")
print(f"Exact: T(30) = {exact:.6f} C")
# RK4:   T(30) = 33.046180 C
# Exact: T(30) = 33.046178 C

Comparing an analytic solution with a numerical one is the standard verification step: agreement to 6 digits confirms both the algebra and the code.

Common mistakes

Applications

Key takeaways

Going further