41  First-order ODEs

When the rate of change depends on the state

An RC circuit: a resistor and capacitor in series, connected to a voltage source. The capacitor charges up. At t = 0 you disconnect the source. The voltage across the capacitor starts dropping.

The question is not “what is the voltage after 1 second?” You could measure that with a multimeter. The question is: what function describes the voltage at every instant? How does it fall — linearly, exponentially, as a step? Does it depend on R and C individually or only on their product? What happens if you double the capacitance?

To answer those questions you need an equation that the voltage function must satisfy. That equation involves the derivative of the voltage — it is an ordinary differential equation. Solving it means finding the function, not a number.

This chapter develops two techniques — separation of variables and the integrating factor — that between them handle a large fraction of first-order ODEs encountered in engineering. The chapter closes with the existence and uniqueness theorem, which tells you something crucial: you should check that a solution exists before spending time looking for one.


41.1 What this chapter helps you do

Symbols to keep handy

These are the bits of notation you'll see a lot. If a line of symbols feels like a fence, read it out loud once, then keep going.

  • (x): mu of x

Definitions to keep handy

These are the words we keep coming back to. If one feels slippery, come back here and steady it before you push on.

  • ordinary differential equation (ODE): An equation that relates a function to its derivatives, so the ‘unknown’ is a whole function, not a single number.

  • general solution: A family of solution curves that includes an arbitrary constant.

  • initial condition: A specific value like y(x0)=y0 that selects one curve from the family.

  • separable: A first-order ODE where all the y-stuff and x-stuff can be separated onto opposite sides and integrated.

  • integrating factor: A function you multiply a linear ODE by so the left-hand side becomes the derivative of a product.

This chapter teaches you how to solve for a function when you are given a rule for its rate of change. You will learn to:

  • recognise when a first-order ODE is separable, and turn it into two integrals
  • recognise a first-order linear ODE, and use an integrating factor to make the left side a perfect derivative
  • use an initial condition y(x_0)=y_0 to select one curve from a family of solutions
  • check whether you should expect one solution or many (existence and uniqueness)

Watch for this

  • A general solution contains an arbitrary constant; an initial condition removes it.
  • Treating \frac{dy}{dx} like a fraction is a notational convenience; it is valid in the separable method, but you still have to separate correctly before integrating.
  • When you integrate, keep track of the constant of integration and where it belongs.

41.2 The ODE problem

A function y(x) satisfies an ordinary differential equation when substituting y and its derivatives into the equation produces an identity. The simplest possible example:

How to read the ODE notation

  • Symbol: y' / \dfrac{dy}{dx}

  • Reads as: “y prime” / “d y by d x”

  • Means: the instantaneous rate of change of y with respect to x

  • Use when: you are describing how a quantity evolves as the input changes

  • Common misread: y' is not a separate variable; it is a derivative of y(x)

  • Symbol: y(x_0)=y_0

  • Reads as: “y of x-zero equals y-zero”

  • Means: an initial condition (the solution must pass through a specific point)

  • Use when: you need one specific solution curve, not a family

  • Common misread: the initial condition does not solve the ODE by itself; it selects among solutions

  • Symbol: C

  • Reads as: “C” (a constant)

  • Means: the arbitrary constant created by integration

  • Use when: you integrate and get a family of antiderivatives

  • Common misread: you cannot drop C before using the initial condition

y' = y

This asks: for which functions does the derivative equal the function itself? The answer is y = Ce^x for any constant C. There is not one solution — there is a family of them, one curve for each value of C.

This is the fundamental shift from algebra. In algebra you solve for a number. In an ODE you solve for a function.

41.2.1 Order and linearity

The order of an ODE is the order of the highest derivative that appears. This chapter covers first-order ODEs: equations involving y and y', but not y'' or higher.

An ODE is linear if it can be written in the form

a_n(x)\,y^{(n)} + a_{n-1}(x)\,y^{(n-1)} + \cdots + a_1(x)\,y' + a_0(x)\,y = f(x)

where all coefficients depend only on x, not on y. For first-order:

a_1(x)\,y' + a_0(x)\,y = f(x)

If y or y' appear raised to a power, inside a trig function, multiplied together, or otherwise nonlinearly, the equation is nonlinear. Nonlinear first-order ODEs are harder; two important special cases (separable equations and the logistic equation) are tractable analytically, but most require numerical methods.

41.2.2 General and particular solutions

The general solution of a first-order ODE contains one arbitrary constant C. Geometrically it is a one-parameter family of curves — every value of C gives one solution curve.

A particular solution is obtained by applying an initial condition: a specified value y(x_0) = y_0. This pins one curve from the family.

For example, y' = 2x has general solution y = x^2 + C. The initial condition y(0) = 3 gives C = 3, so the particular solution is y = x^2 + 3.

41.2.3 Why existence and uniqueness matters

Before solving an ODE, it is worth knowing whether a solution exists and, if it does, whether it is unique. If uniqueness fails, a numerical solver that finds a solution may not find the solution relevant to your physical problem. The Picard-Lindelöf theorem (stated precisely at the end of this chapter) gives sufficient conditions for both. In practice: check the theorem first, solve second.


41.3 Separable ODEs

A first-order ODE is separable if it can be written in the form

\frac{dy}{dx} = g(x)\,h(y)

The method is to separate all y-dependence to the left and all x-dependence to the right, then integrate both sides.

Method. Divide both sides by h(y) (assuming h(y) \neq 0):

\frac{1}{h(y)}\,\frac{dy}{dx} = g(x)

Interpret \frac{dy}{dx}\,dx = dy and integrate. This is shorthand for a substitution — treating dy/dx as a ratio is a notational convenience that can be made rigorous via the substitution rule for integrals; the result is always valid for separable ODEs.

\int \frac{dy}{h(y)} = \int g(x)\,dx + C

The constant of integration appears once — it is conventional to write it on the right. The initial condition then determines C.

41.3.1 Worked example 1: exponential growth and decay

Solve \dfrac{dy}{dt} = ky, with y(0) = y_0.

This is separable. Divide by y (assuming y \neq 0):

\frac{dy}{y} = k\,dt

Integrate both sides:

\ln|y| = kt + C_1

Exponentiate:

|y| = e^{C_1} e^{kt}

Three sub-steps are compressed here: (1) remove the absolute value signs by introducing a \pm — so |y| = e^{C_1}e^{kt} becomes y = \pm e^{C_1}e^{kt}; (2) rename \pm e^{C_1} as A, which is still a nonzero constant since e^{C_1} > 0 always; (3) check whether y = 0 is also a solution — substituting gives 0 = k \cdot 0, which is true, so y = 0 is valid and we extend A to allow zero as well. Collecting these observations:

y(t) = A e^{kt}

Apply the initial condition y(0) = y_0:

y_0 = A e^0 = A

Particular solution:

\boxed{y(t) = y_0\,e^{kt}}

The constant k controls the behaviour. If k > 0 the function grows without bound — radioactive build-up, compound interest, early-stage epidemic spread. If k < 0 (write k = -\lambda, \lambda > 0) the function decays to zero — radioactive decay, drug clearance, capacitor discharge. The quantity \tau = 1/|\lambda| is the time constant: the time for the function to fall to e^{-1} \approx 36.8\% of its initial value, or equivalently, the time at which the tangent at t = 0 would reach zero.

41.3.2 Worked example 2: Newton’s law of cooling

A body at temperature T loses heat to an environment at constant temperature T_{\text{env}}. Newton’s law of cooling states that the rate of heat loss is proportional to the temperature difference:

\frac{dT}{dt} = -k(T - T_{\text{env}}), \qquad k > 0

The negative sign ensures cooling: if T > T_{\text{env}}, the right side is negative, so T decreases. The equation is separable, but a substitution makes it cleaner. Let u = T - T_{\text{env}}. Then \frac{du}{dt} = \frac{dT}{dt} (since T_{\text{env}} is constant), and the equation becomes:

\frac{du}{dt} = -ku

This is y' = ky with k \to -k. By the previous example:

u(t) = u_0\,e^{-kt}

where u_0 = T(0) - T_{\text{env}}. Substituting back:

\boxed{T(t) = T_{\text{env}} + (T_0 - T_{\text{env}})\,e^{-kt}}

The temperature difference decays exponentially. As t \to \infty, T \to T_{\text{env}}: the body equilibrates with its surroundings, as expected. The constant k depends on the thermal properties of the body and the medium — a copper block cools faster than a ceramic mug of the same mass (larger k).



41.4 Linear first-order ODEs

Not every first-order ODE is separable. Consider:

y' + 2xy = e^{-x^2}

The right side prevents simple separation. But the equation is linear — it has the form

y' + P(x)\,y = Q(x)

This is the standard form of a first-order linear ODE.

41.4.1 The integrating factor

How to read the integrating factor

  • Symbol: \mu(x)
  • Reads as: “mu of x”
  • Means: a helper function you choose so the left side becomes \dfrac{d}{dx}[\mu(x)\,y]
  • Use when: the ODE is in standard linear form y' + P(x)\,y = Q(x)
  • Common misread: \mu is not mysterious physics; it is a bookkeeping choice that makes the product rule do the work

The key idea: multiply both sides by a function \mu(x), chosen so that the left side becomes the derivative of a product. If

\mu(x)\,y' + \mu(x)\,P(x)\,y = \frac{d}{dx}[\mu(x)\,y]

then by the product rule the right side expands as \mu\,y' + \mu'\,y. Matching:

\mu(x)\,P(x) = \mu'(x)

This is a separable ODE for \mu:

\frac{d\mu}{\mu} = P(x)\,dx \implies \ln\mu = \int P(x)\,dx \implies \mu(x) = e^{\int P(x)\,dx}

No constant of integration is needed — any \mu that works is sufficient, and the simplest choice sets the constant to zero.

Why this is the key step. After multiplying by \mu, the ODE becomes:

\frac{d}{dx}[\mu(x)\,y] = \mu(x)\,Q(x)

The left side is a perfect derivative. Integrate both sides:

\mu(x)\,y = \int \mu(x)\,Q(x)\,dx + C

y = \frac{1}{\mu(x)}\left[\int \mu(x)\,Q(x)\,dx + C\right]

The integrating factor converts the ODE into a straightforward integration problem.

Summary of the method:

  1. Write in standard form: y' + P(x)\,y = Q(x)
  2. Compute \mu(x) = e^{\int P(x)\,dx}
  3. Multiply both sides by \mu: left side becomes \frac{d}{dx}[\mu y]
  4. Integrate both sides
  5. Solve for y; apply initial condition to find C

41.4.2 Worked example: RC circuit

A series RC circuit connected to a constant voltage source V_s satisfies Kirchhoff’s voltage law:

V_R + V_C = V_s

The resistor voltage is V_R = Ri = RC\,\frac{dV_C}{dt} (using i = C\,\frac{dV_C}{dt}). Writing V = V_C:

RC\,\frac{dV}{dt} + V = V_s

Divide by RC to reach standard form:

\frac{dV}{dt} + \frac{1}{RC}\,V = \frac{V_s}{RC}

Here P(t) = \frac{1}{RC} and Q(t) = \frac{V_s}{RC}.

Step 2. Integrating factor:

\mu(t) = e^{\int \frac{1}{RC}\,dt} = e^{t/RC}

Step 3. Multiply through:

\frac{d}{dt}\left[e^{t/RC}\,V\right] = \frac{V_s}{RC}\,e^{t/RC}

Step 4. Integrate both sides:

e^{t/RC}\,V = V_s\,e^{t/RC} + C

Step 5. Divide by e^{t/RC}:

V(t) = V_s + C\,e^{-t/RC}

Apply V(0) = V_0:

V_0 = V_s + C \implies C = V_0 - V_s

Particular solution:

\boxed{V(t) = V_s + (V_0 - V_s)\,e^{-t/RC}}

Reading the solution physically: the voltage starts at V_0 and approaches V_s exponentially with time constant \tau = RC. If V_0 = 0 (capacitor initially uncharged), the voltage rises from zero to V_s. If V_0 > V_s (capacitor initially overcharged), it decays down. The product \tau = RC — measured in seconds when R is in ohms and C in farads — governs how fast the transient dies. After 5\tau the transient is below 1% of its initial magnitude; engineers call this “essentially complete.”



41.5 Applications

41.5.1 Mixing problem

A 100 L tank initially contains fresh water. Brine at concentration 2 g/L flows in at 4 L/min. The well-mixed solution flows out at 4 L/min, so the volume stays constant at 100 L.

Let S(t) be the salt content in grams at time t. The rate of change is:

\frac{dS}{dt} = \underbrace{2 \times 4}_{\text{in}} - \underbrace{\frac{S}{100} \times 4}_{\text{out}} = 8 - \frac{S}{25}

Rearranging to standard form:

\frac{dS}{dt} + \frac{1}{25}\,S = 8

Integrating factor: \mu = e^{t/25}.

\frac{d}{dt}\left[e^{t/25}\,S\right] = 8\,e^{t/25}

e^{t/25}\,S = 200\,e^{t/25} + C

S(t) = 200 + C\,e^{-t/25}

Initial condition S(0) = 0 gives C = -200:

\boxed{S(t) = 200\!\left(1 - e^{-t/25}\right)}

As t \to \infty, S \to 200 g — this is the equilibrium: 2 g/L in 100 L. The approach is exponential with time constant \tau = 25 min. The tank is at 99% of equilibrium after 5\tau = 125 min. The form of this solution is identical to the RC circuit: a system driven toward equilibrium by a constant input, with exponential relaxation.

41.5.2 Drug pharmacokinetics: one-compartment model

A drug is injected as a bolus (instantaneous dose) of D_0 mg into the bloodstream. The drug is cleared by the kidneys at a rate proportional to the blood concentration C(t) (mg/L), with elimination rate constant k_e (min⁻¹). The volume of distribution is V_d (L).

The ODE for the amount A(t) = C(t)\,V_d in the body is:

\frac{dA}{dt} = -k_e\,A, \qquad A(0) = D_0

This is y' = ky with k = -k_e. Solution:

A(t) = D_0\,e^{-k_e t}

The blood concentration is C(t) = A(t)/V_d = (D_0/V_d)\,e^{-k_e t}.

The half-life of the drug is the time for the concentration to halve:

C(t_{1/2}) = \frac{C_0}{2} \implies e^{-k_e t_{1/2}} = \frac{1}{2} \implies t_{1/2} = \frac{\ln 2}{k_e}

This is the number quoted on drug package inserts. A drug with t_{1/2} = 4 hours requires dosing every 4–8 hours to maintain therapeutic levels. The simplicity of this model makes it foundational in pharmacology — more realistic models add compartments (tissue, fat, CSF) but the same ODE structure applies to each.


41.6 Existence and uniqueness

Before investing effort in solving an ODE, it is worth asking whether a solution exists and whether it is unique. The Picard-Lindelöf theorem gives a sufficient condition.

Theorem (Picard-Lindelöf). Consider the initial value problem

y' = f(x, y), \qquad y(x_0) = y_0

If f and \partial f / \partial y are both continuous on some open rectangle R = \{(x,y) : |x - x_0| < a,\; |y - y_0| < b\} containing (x_0, y_0), then there exists an interval |x - x_0| < h (for some h > 0) on which the IVP has a unique solution.

The theorem does not tell you the size of h — the solution may only exist locally, not for all x. But it does guarantee that on some interval, exactly one solution passes through the given initial point.

What failure looks like. Consider y' = y^{2/3} with y(0) = 0.

Here f(x,y) = y^{2/3}, which is continuous everywhere. But \partial f / \partial y = \frac{2}{3} y^{-1/3}, which is not continuous at y = 0 — the theorem’s hypothesis fails. And indeed, uniqueness fails: both

y_1(x) = 0 \qquad \text{and} \qquad y_2(x) = \left(\frac{x}{3}\right)^3

satisfy y' = y^{2/3} and y(0) = 0. There is not a unique solution through the origin.

Engineering consequence. When the theorem applies, you know that any reasonable numerical method converges to the same solution — there is no ambiguity about which solution you are approximating. When it fails, a numerical solver may track different solution branches depending on the step size or starting perturbation, and the results can be misleading. Check the theorem first.


41.7 What you can do now

You can now look at a first-order ODE and decide which of two core methods applies: separation or integrating factor. You can produce a general solution, apply an initial condition to get a particular solution, and you know when it is worth checking existence and uniqueness before trusting an answer (especially a numerical one).

41.8 Exercises

These exercises are puzzles with physical content. The interesting part is identifying the method (separable or integrating factor) and setting up the solution correctly.


Exercise 1. Solve \dfrac{dy}{dx} = \dfrac{x}{y}. Find the general solution and the particular solution satisfying y(0) = 2.


Exercise 2. Solve \dfrac{dy}{dt} = -0.1y with y(0) = 500. Find y(t), then find the time at which y = 100.


Exercise 3. Coffee at 90°C sits in a 20°C room. The cooling constant is k = 0.05 min⁻¹. Find T(t). How long until the coffee reaches 60°C?


Exercise 4. Solve y' + 2y = 4 using the integrating factor method. Find the general solution, then the particular solution with y(0) = 1.


Exercise 5. An RC circuit satisfies V' + V = 12 (taking RC = 1 s). The capacitor is initially uncharged: V(0) = 0. Find V(t). What does V(t) approach as t \to \infty, and why?


Exercise 6. A 100 L tank initially contains 10 g of salt. Brine at 0.5 g/L flows in at 2 L/min; the well-mixed solution flows out at 2 L/min. Set up and solve the ODE for total salt S(t) (grams). Find S(t) and the long-run salt content.


41.9 Where this goes

This chapter covered first-order ODEs. The two methods here — separation of variables and the integrating factor — handle a large class of single first-order equations. They are not the whole story.

Second-order ODEs (Chapter 2) introduce new phenomena: oscillation, resonance, and damping. A mass on a spring, an LC circuit, a building subject to seismic loading — these all require second-order equations and the concept of complementary and particular solutions.

Systems of ODEs (Chapter 3) handle multiple interdependent quantities: two species in competition, currents in a multi-loop circuit, the position and velocity of a mechanical system as coupled first-order equations. The phase plane — a picture in state space rather than time — provides geometric insight that algebraic solutions alone cannot.

Laplace transforms (Chapter 4) convert ODEs to algebraic equations in a new variable, solve them there, and invert the transform. The technique handles discontinuous forcing (switches, impulses) cleanly and connects naturally to control system design.

The techniques of this chapter will reappear in all three. The RC circuit solution you derived here is the building block for understanding filter transients, step responses, and feedback systems.

Where this shows up

  • An electrical engineer designing an RC filter needs the time constant \tau = RC to set the cutoff frequency — it comes directly from the ODE solution.
  • A pharmacokineticist calculating a dosing interval needs the drug half-life t_{1/2} = (\ln 2)/k_e — from the same exponential decay formula.
  • A chemical engineer sizing a mixing tank needs to know how long before the outlet concentration reaches 99% of the inlet — a mixing problem of exactly the form in Exercise 6.
  • A control engineer specifying a first-order lag in a block diagram is working with \tau\,\dot{y} + y = u — the RC circuit equation in disguise.

The ODE changes labels. The mathematics does not.