MATH-201 · Lesson 1 of 5 · 38 min

First-order equations

Engineering laws usually describe how things change, not what they are. Newton's law of cooling says how fast a hot part loses heat; a mass balance says how fast the salt in a tank builds up; Kirchhoff's laws say how fast a capacitor charges. Each is an equation relating a quantity to its own rate of change: a differential equation. Solving it tells you the quantity itself at every instant, which is what you need for design: how long the part takes to cool, when the tank reaches its limit, how quickly the circuit responds.

This course is about ordinary differential equations (ODEs), where the unknown depends on one variable, usually time. This first chapter covers the vocabulary, the meaning of a solution and an initial value problem, direction fields, and the two workhorse methods for first-order equations: separation of variables and the integrating factor. Along the way it solves the classic first-order models of engineering: cooling, decay, draining tanks, mixing, RC circuits and motion with drag.

What is a differential equation?

A differential equation relates an unknown function to its derivatives. Its order is the highest derivative that appears:

  • \(\dfrac{dT}{dt} = -k(T - T_a)\) is first order (Newton's law of cooling).
  • \(m\ddot{x} + c\dot{x} + kx = F(t)\) is second order (a mass on a spring, Lesson 3).

An ODE is linear if the unknown and its derivatives appear only to the first power and are not multiplied together or put inside other functions. \(y' + 2y = \sin t\) is linear; \(y' = y^2\) and \(y' = \sin y\) are not. Linear equations have a complete, systematic theory; nonlinear ones usually need special tricks or numerical methods.

A solution is a function that makes the equation true for every t in some interval. Checking a proposed solution is always possible, and is a good habit: substitute it and see.

Worked problem

Checking a solution

Show that \(y = Ce^{-2t}\) solves \(y' + 2y = 0\) for every constant C.

Show solution
  1. \(y' = -2Ce^{-2t}\).
  2. \(y' + 2y = -2Ce^{-2t} + 2Ce^{-2t} = 0\). ✓

Answer: It works for every C. A first-order equation typically has a one-parameter family of solutions, the general solution

Initial value problems

The constant is fixed by one extra piece of information, usually the starting value: \(y(0) = y_0\). An ODE plus an initial condition is an initial value problem (IVP). Physically, the equation describes the rule of change, and the initial condition says where the system started. For the linear equations of this course, an IVP has exactly one solution, so once you find a function that satisfies both, you have the answer.

Direction fields

A first-order equation \(y' = f(t, y)\) tells you the slope of the solution at every point of the ty-plane, even if you cannot solve it. Drawing a short line segment with that slope at a grid of points gives a direction field; solution curves follow the segments like iron filings following a magnetic field.

Direction field for Newton's law of cooling dT/dt = minus 0.1 (T minus 20), with short slope segments on a grid of time 0 to 40 minutes and temperature 0 to 100 °C. Segments point down above 20 °C and up below it. Three solution curves starting at 90, 50 and 5 °C all approach the horizontal line T = 20.
Direction field for Newton's law of cooling. Every solution approaches the air temperature, 20 °C, the equilibrium.

The field shows the qualitative behaviour at a glance: every solution approaches 20 °C, from above or below. A constant solution such as \(T = 20\) is an equilibrium; this one is stable, because nearby solutions move toward it.

Separable equations

If the equation can be written with all the y's on one side and all the t's on the other,

\[\frac{dy}{dt} = g(t)\,h(y) \quad\Longrightarrow\quad \int \frac{dy}{h(y)} = \int g(t)\,dt\]

it is separable: integrate both sides and solve for y. (Check separately for constant solutions where \(h(y) = 0\); dividing by h(y) can lose them.)

Worked problem

Cooling a casting

A casting at 90 °C cools in 20 °C air with \(dT/dt = -0.1(T - 20)\), t in minutes. Find T(t) and the time to reach 30 °C.

Show solution
  1. Separate: \(\dfrac{dT}{T - 20} = -0.1\,dt\). Integrate: \(\ln|T - 20| = -0.1t + C\).
  2. So \(T - 20 = Ae^{-0.1t}\). At \(t = 0\), \(T = 90\), so \(A = 70\): \(T = 20 + 70e^{-0.1t}\).
  3. Set \(T = 30\): \(e^{-0.1t} = 10/70\), so \(t = 10\ln 7 = 19.5\) min.

Answer: T = 20 + 70e^{−0.1t}; it reaches 30 °C after about 19.5 minutes. In ENCM-100 the same model was solved numerically with Euler's method; here is the exact answer that method approximated

Notice the pattern \(y = y_\infty + (y_0 - y_\infty)e^{-t/\tau}\): the quantity moves from its initial value toward a final value, closing the gap by a factor of \(e\) (63%) every time constant \(\tau\). Here \(\tau = 1/k = 10\) min. The same curve appears in heating, charging, mixing and settling, and engineers estimate response times from \(\tau\) directly: about \(5\tau\) to get within 1% of the final value.

An exponential approach curve rising from 0 to 1, with marks at one, two, three, four and five time constants showing 63, 86, 95, 98 and 99 percent of the final value. A tangent line at t = 0 reaches the final value at one time constant.
First-order response. After one time constant the response is 63% of the way to its final value; after five, more than 99%.

Worked problem

Radiocarbon dating

Carbon-14 decays as \(dN/dt = -kN\) with a half-life of 5730 years. A timber sample from an old mine shoring has 30% of the carbon-14 of living wood. How old is it?

Show solution
  1. Solution: \(N = N_0e^{-kt}\). Half-life: \(e^{-k \cdot 5730} = \tfrac{1}{2}\), so \(k = \ln 2/5730 = 1.210 \times 10^{-4}\) per year.
  2. Set \(N/N_0 = 0.30\): \(t = \ln(1/0.30)/k = 1.204/1.210 \times 10^{-4} = 9950\) years.

Answer: About 9950 years, so the timber is far older than any mine; this would point to reused or ancient wood. (Real radiocarbon dates are corrected with calibration curves, but the decay law is the core)

Worked problem

Draining a tank

A tank with a constant cross-section of 1.0 m² drains through a 5.0 cm² orifice at the bottom. Torricelli's law gives the outflow speed \(\sqrt{2gh}\), so \(A\,dh/dt = -a\sqrt{2gh}\). Starting full at 2.0 m, how long does it take to empty (ideal flow)?

Show solution
  1. Separate: \(\dfrac{dh}{\sqrt{h}} = -\dfrac{a\sqrt{2g}}{A}\,dt\). Integrate: \(2\sqrt{h} = 2\sqrt{h_0} - \dfrac{a\sqrt{2g}}{A}t\).
  2. Empty when \(h = 0\): \(t = \dfrac{2A\sqrt{h_0}}{a\sqrt{2g}} = \dfrac{2(1.0)\sqrt{2.0}}{5.0 \times 10^{-4} \times 4.429} = 1277\) s.

Answer: About 1280 s, or 21 minutes. This equation is nonlinear (√h), so the level falls quickly at first and more slowly near the bottom. Real orifices discharge less than ideal flow (a discharge coefficient of about 0.6 for a sharp-edged hole), which would lengthen the time to roughly 35 minutes

Linear first-order equations

A linear first-order equation can always be put in the standard form

\[\frac{dy}{dt} + p(t)\,y = q(t)\]

Multiply through by the integrating factor \(\mu(t) = e^{\int p\,dt}\). The left side becomes the derivative of a product, \((\mu y)'\), which integrates directly:

\[\mu y = \int \mu q\,dt + C, \qquad \mu = e^{\int p(t)\,dt}\]

Worked problem

An integrating factor

Solve \(y' + 2y = 4\) with \(y(0) = 0\).

Show solution
  1. \(p = 2\), so \(\mu = e^{2t}\). Then \((e^{2t}y)' = 4e^{2t}\).
  2. Integrate: \(e^{2t}y = 2e^{2t} + C\), so \(y = 2 + Ce^{-2t}\).
  3. \(y(0) = 0\) gives \(C = -2\): \(y = 2(1 - e^{-2t})\).

Answer: y = 2(1 − e^{−2t}): a first-order rise from 0 toward 2 with time constant ½. The steady value 2 is what the equation gives when y′ = 0

The RC circuit

For a resistor R and capacitor C in series with a source \(V_s\) switched on at \(t = 0\), Kirchhoff's voltage law gives \(RC\,\dfrac{dv}{dt} + v = V_s\), linear and first order.

Left: a series circuit with a 12 V source, a switch, a 10 kilo-ohm resistor and a 100 microfarad capacitor. Right: the capacitor voltage rising from 0 toward 12 V with time constant 1 s, reaching 9 V at 1.39 s.
An RC circuit charging. The capacitor voltage follows the first-order rise with τ = RC.

Worked problem

Charging a capacitor

With \(R = 10\) kΩ, \(C = 100\) μF and \(V_s = 12\) V, and the capacitor initially uncharged, find v(t) and the time to reach 9 V.

Show solution
  1. \(\tau = RC = 10^4 \times 10^{-4} = 1.0\) s. Standard form: \(v' + v/\tau = V_s/\tau\).
  2. Same form as the previous example: \(v = 12(1 - e^{-t})\).
  3. \(9 = 12(1 - e^{-t})\) gives \(e^{-t} = 0.25\), \(t = \ln 4 = 1.39\) s.

Answer: v = 12(1 − e^{−t/1 s}); 9 V at 1.39 s. The time constant RC sets how fast timing circuits, filters and sensor interfaces respond

Mixing problems

Mass balance, rate in minus rate out, gives a linear first-order ODE for the amount of a substance in a well-mixed tank.

Worked problem

Brine in a tank

A 1000 L tank of fresh water receives brine at 0.05 kg/L flowing in at 10 L/min, while the well-mixed solution flows out at 10 L/min. How much salt is in the tank after 60 minutes?

Show solution
  1. Let x(t) be the salt (kg). Rate in = 0.05 × 10 = 0.5 kg/min. Rate out = concentration × flow = (x/1000) × 10 = x/100 kg/min.
  2. \(x' = 0.5 - x/100\), with \(x(0) = 0\). This is linear with \(\tau = 100\) min and final value \(x_\infty = 50\) kg.
  3. \(x = 50(1 - e^{-t/100})\). At t = 60: \(x = 50(1 - e^{-0.6}) = 22.6\) kg.

Answer: 22.6 kg after an hour, approaching 50 kg (the inflow concentration times the volume). The same model describes a pollutant entering a lake, a tracer in a reactor, or fresh air diluting a contaminant in a room

Motion with linear drag

Worked problem

A sphere sinking in oil

A small steel sphere of mass 0.050 kg sinks in oil. Its weight minus buoyancy is 0.30 N, and at these slow speeds the drag is linear, \(0.60v\) N. Starting from rest, find v(t) and the terminal speed.

Show solution
  1. Newton's second law: \(0.050\,v' = 0.30 - 0.60v\), or \(v' + 12v = 6\).
  2. Final value (v′ = 0): \(v_\infty = 0.5\) m/s. Time constant \(\tau = 1/12 = 0.083\) s.
  3. \(v = 0.5(1 - e^{-12t})\) m/s.

Answer: Terminal speed 0.50 m/s, reached in about 5τ ≈ 0.4 s. Measuring the terminal speed of a falling ball is a standard way to measure a fluid's viscosity

Common mistakes

  • MistakeForgetting the constant of integration, or adding it only at the end on one side.

    InsteadAdd C when integrating, then use the initial condition to find it.

  • MistakeApplying the integrating factor before putting the equation in standard form.

    InsteadDivide so the coefficient of y′ is 1, then μ = e^{∫p dt}.

  • MistakeLosing an equilibrium solution when dividing by h(y) in a separable equation.

    InsteadCheck where h(y) = 0; those constant solutions may be the physically important ones.

  • MistakeMixing units in the rate equation (L/min with kg/s).

    InsteadUse consistent units throughout; the time constant inherits the time unit used.

  • MistakeAssuming nonlinear equations behave exponentially.

    InsteadSolve them properly; the draining tank, for example, empties in finite time.

  • MistakeNever checking the solution.

    InsteadSubstitute back, check the initial condition, and check the long-time limit against physical sense.

Summary and key terms

  • A differential equation relates a function to its derivatives; its order is the highest derivative; linear equations have the unknown to the first power only.
  • An initial value problem adds a starting value and, for linear equations, has exactly one solution.
  • Direction fields show solution behaviour without solving; constant solutions are equilibria.
  • Separable equations: separate variables and integrate (cooling, decay, Torricelli draining).
  • Linear equations y′ + p y = q: multiply by μ = e^{∫p dt} and integrate (RC circuits, mixing tanks, linear drag).
  • Constant-coefficient first-order systems follow y = y∞ + (y₀ − y∞)e^{−t/τ}: 63% of the change after τ, over 99% after 5τ.
Ordinary differential equation
An equation relating a function of one variable to its derivatives.
Order
The highest derivative in a differential equation.
Linear ODE
An ODE in which the unknown and its derivatives appear linearly.
General solution
The family of all solutions, containing arbitrary constants.
Initial value problem
An ODE together with the value of the solution at a starting time.
Direction field
A plot of slope segments showing the direction of solutions.
Equilibrium solution
A constant solution, where the derivative is zero.
Separable equation
An ODE that can be written as dy/h(y) = g(t) dt.
Integrating factor
The multiplier e^{∫p dt} that makes a linear equation exactly integrable.
Time constant
τ, the time for a first-order response to cover 63% of its total change.

Practice problems

Work each problem on paper first, then reveal the answer to check.

  1. Classify by order and linearity: (a) y′ = t y²; (b) y″ + t y′ + y = cos t; (c) (y′)² + y = 0.

    Show answer

    (a) First order, nonlinear; (b) second order, linear; (c) first order, nonlinear.

  2. Solve y′ = 3t² y with y(0) = 2.

    Show answer

    Separable: ln y = t³ + C. y = 2e^{t³}.

  3. A pie at 180 °C cools in a 22 °C room and is 100 °C after 15 minutes. When is it 40 °C?

    Show answer

    158e^{−15k} = 78, k = ln(158/78)/15 = 0.0471/min. 40 °C: 158e^{−kt} = 18, t = ln(158/18)/0.0471 = 46.2 min.

  4. A radioactive tracer has a half-life of 6.0 hours. What fraction remains after 24 hours?

    Show answer

    Four half-lives: (1/2)⁴ = 1/16 = 6.25%.

  5. Solve y′ + y/t = 3 for t > 0 with y(1) = 2.

    Show answer

    μ = t. (ty)′ = 3t, ty = 1.5t² + C. C = 0.5: y = 1.5t + 0.5/t.

  6. An RC circuit has R = 4.7 kΩ and C = 220 μF. What is its time constant, and how long until the capacitor is 99% charged?

    Show answer

    τ = 1.034 s. 99% needs ln(100) = 4.6τ = 4.76 s.

  7. A capacitor charged to 10 V discharges through a resistor with τ = 0.5 s. What is its voltage after 1 s?

    Show answer

    v = 10e^{−2} = 1.35 V.

  8. A 500 L tank of water with 20 kg of dissolved salt is flushed with fresh water at 25 L/min (in and out). How long until only 2 kg remain?

    Show answer

    x′ = −x/20, x = 20e^{−t/20}. 2 = 20e^{−t/20}, t = 20 ln 10 = 46 min.

  9. Find the equilibrium and time constant of 0.2 v′ + 4v = 10 without solving.

    Show answer

    Standard form v′ + 20v = 50: equilibrium 2.5, τ = 1/20 = 0.05.

  10. In the draining tank example, how long does it take for the level to fall from 2.0 m to 0.5 m?

    Show answer

    2√h falls from 2.828 to 1.414, a change of 1.414 = (a√(2g)/A)t = 2.215 × 10⁻³ t. t = 639 s: half the emptying time, although only 75% of the water has gone.

Lesson quiz · 5 questions

Score 60% or more to complete this lesson.

Take the quiz