First Order Equations: Modelling

Edmund Chiang
MATH2351 / 2352 — Boyce & DiPrima §2.3
February 5, 2026

1   Flow-in, Flow-out Example

Example (B&D). At $t=0$ a tank contains $Q_0$ lb of salt dissolved in 100 gal of water. Salted water with concentration $\tfrac{1}{4}$ lb/gal enters at rate $r$ gal/min; the well-stirred mixture drains at the same rate. Find:

  1. The amount of salt $Q(t)$ at any time.
  2. The limiting amount $Q_L$ after a very long time.
  3. If $r=3$ and $Q_0 = 2Q_L$, the time $T$ for salt to be within 2% of $Q_L$.
  4. The flow rate needed so that $T \leq 45$ min.

Since we are dealing with DEs, the key observation is to express every rate of change relevant to the tank flow:

$$\frac{dQ}{dt} = \text{(rate of salt in)} - \text{(rate of salt out)}.$$

We determine:

Hence the IVP is:

$$\frac{dQ}{dt} = \frac{r}{4} - \frac{rQ}{100} = \frac{25r - rQ}{100}, \qquad Q(0) = Q_0.$$

(i) Separation of variables.

$$\int \frac{dQ}{Q - 25} = \int \frac{-r}{100}\,dt.$$

Hence

$$\ln|Q - 25| = -\frac{rt}{100} + c.$$

So $Q - 25 = Ce^{-rt/100}$ where $C = e^{\pm c}$. Therefore

$$Q(t) = 25 + Ce^{-rt/100}.$$

The initial condition $Q(0) = Q_0$ gives $C = Q_0 - 25$:

$$Q(t) = 25 + (Q_0 - 25)\,e^{-rt/100}.$$

(ii) As $t \to \infty$, $\;Q(t) \to 25 = Q_L$.

(iii) With $Q_0 = 50 = 2Q_L$ and $r = 3$. We need $Q(T)$ within 2% of $Q_L = 25$, i.e. $Q(T) = 25.5$:

$$25.5 = 25 + (50 - 25)e^{-3T/100} = 25 + 25\,e^{-T/50}.$$

So $e^{-T/50} = 0.5/25 = 0.02$, giving

$$T = \frac{\ln 50}{0.03} \approx 130.4 \text{ min.}$$

(iv) For $T \leq 45$ min:

$$25.5 = 25 + 25\,e^{-45r/100} \implies r = \frac{100}{45}\ln 50 \approx 8.69 \text{ gal/min.}$$

1.1   Oscillating Concentration (B&D §2.3, Example 3)

If the salt concentration flowing into the tank varies as $\gamma(t) = 2 + \sin 2t$ g/L and drains at the same rate, the DE becomes

$$\frac{dq}{dt} + \frac{1}{2}q = 10 + 5\sin 2t,$$

which has the solution

$$q(t) = 20 - \frac{10}{17}\cos 2t + \frac{40}{17}\sin 2t + ce^{-t/2}.$$

Notice the solution also oscillates as the source that flows in. See Boyce & DiPrima for details.


Exercises (B&D)
  1. A tank contains 200 L of dye (1 g/L), rinsed with fresh water at 2 L/min. Time to reach 1% concentration. (Ans. $t = 100\ln 100 \approx 460.5$ min)
  2. 120 L pure water; salt enters at $\gamma$ g/L, 2 L/min. Find $Q(t)$ and limiting amount. (Ans. $Q(t) = 120\gamma[1 - e^{-t/60}] \to 120\gamma$)
  3. 100 gal fresh water; salt at $\frac{1}{2}$ lb/gal for 10 min then fresh water for 10 more min. (Ans. $Q \approx 7.42$ lb)
  4. 500 gal capacity, initially 200 gal with 100 lb salt; inflow 3 gal/min (1 lb/gal), outflow 2 gal/min. Find $Q(t)$ before overflow and concentration at overflow. (Ans. $Q(t) = 200 + t - 100(200)^2/(200+t)^2$; overflow concentration $= 121/125$ lb/gal; limiting $c = 1$ lb/gal)
Practice: Setting Up a Flow Problem

A tank holds 200 L of pure water. Brine with 3 g/L of salt flows in at 5 L/min. The well-stirred mixture drains at 5 L/min. Let $Q(t)$ be the grams of salt at time $t$.

Step 1

What is the rate of salt entering the tank (in g/min)?

Step 2

What is the rate of salt leaving the tank?

Step 3

Which DE describes $Q(t)$?

Step 4

Solving the DE with $Q(0)=0$, what is $Q(t)$?

All steps complete — well done!

2   Newton's Law of Cooling

Newton published his finding in a short article in the Philosophical Transactions of the Royal Society anonymously in 1701 (in Latin). It states that the temperature of an object changes at a rate proportional to the difference between the object's temperature and its surroundings.

Newton's Law of Cooling

The rate of heat loss of a body is directly proportional to the temperature difference with its surroundings. Let $T = T(t)$ denote the temperature of the body, $T_s$ the surrounding temperature. Then $$\frac{dT}{dt} \propto (T - T_s),$$ which as a DE reads $$\frac{dT}{dt} = k(T - T_s).$$

The "law" is valid provided the temperature difference is small — Newton was well aware of this limitation.

Theorem

With initial temperature $T_0$ and surrounding temperature $T_s$: $$T(t) = T_s + (T_0 - T_s)\,e^{kt}.$$

Proof.

Let $y(t) = T(t) - T_s$. Then $y' = T'$. By Newton's law of cooling the DE becomes

$$\frac{dy}{dt} = ky,$$

so that $y(t) = Ce^{kt}$ from the exponential growth/decay result. Express $y$ back in terms of $T$:

$$T(t) = T_s + Ce^{kt}.$$

But $T(0) = T_0$, so $C = T_0 - T_s$. Thus

$$T(t) = T_s + (T_0 - T_s)e^{kt}.$$
Exercise

Suppose the ambient temperature is $70°$F and the rate constant is $0.05$/min. Write a DE for the temperature $y$ of the object at any time. Note that the DE is the same whether the object is above or below ambient temperature.

(Ans. $y' = -0.05(y - 70)$ where $y$ is in °F and $t$ in minutes.)

Practice: Newton's Law of Cooling

A cup of coffee at $90°$C is placed in a $20°$C room. After 5 minutes, the coffee is at $70°$C.

Step 1

Using $T(t) = T_s + (T_0 - T_s)e^{kt}$, what are $T_s$ and $T_0$?

Step 2

Using $T(5) = 70$, what equation do you get for $k$?

Step 3

Solving for $k$:

Step 4

Since $k < 0$, the coffee temperature as $t \to \infty$:

All steps complete — well done!

3   Continuous Compounding with Deposit/Withdrawal

Discrete compounding $m$ times over time $t$ at rate $r$: $\;S_0\!\left(1 + \dfrac{r}{m}\right)^{mt}$. Taking $m \to \infty$:

$$S(t) = \lim_{m\to\infty} S_0\left(1 + \frac{r}{m}\right)^{mt} = S_0\,e^{rt}.$$

Example. Continuous compounding means the IVP $\;dS/dt = rS,\; S(0) = S_0$, with unique solution $S(t) = S_0 e^{rt}$.

Theorem

With constant deposit/withdrawal rate $k$ and $S(0) = S_0$: $$\frac{dS}{dt} = rS + k \implies S(t) = S_0\,e^{rt} + \frac{k}{r}(e^{rt} - 1).$$ ($k > 0$: deposit; $k < 0$: withdrawal.)

Exercises (B&D)
  1. $S_0$ invested at rate $r$ continuously. (a) Doubling time $T$. (b) $T$ for $r = 7\%$. (c) Rate to double in 8 years. (Ans. $T = \ln 2/r$; 9.90 yr; 8.66%)
  2. Invest $k$/year at return $r$. (a) $S(t)$. (b) $k$ for \$1M in 40 yr at 7.5%. (c) $r$ for \$1M in 40 yr at $k = \$2000$/yr. (Ans. $S(t) = k(e^{rt}-1)/r$; $k \approx \$3930$; $r \approx 9.77\%$)

4   Autonomous (Logistic) Equations

An autonomous DE has the form $\dfrac{dy}{dt} = f(y)$, where $f$ depends on $y$ only — no $t$ appears explicitly. The simplest case $y' = ry$ describes exponential growth, but this is not realistic. In population growth, although initial behaviour is exponential, growth is restricted by physical conditions (food, space, etc.).

A more realistic model assumes $f(y) = y\,h(y)$ where $h(y) \approx r$ when $y$ is small. The simplest such example is $h(y) = r - ay$, giving:

Definition — Logistic Equation $$\frac{dy}{dt} = r\left(1 - \frac{y}{K}\right)y,$$

where $K = r/a$ is the carrying capacity (intrinsic growth rate constant).

This equation is nonlinear but separable. Sign analysis:

$$\frac{dy}{dt} \begin{cases} > 0 & \text{if } 0 < y < K, \\ = 0 & \text{if } y = 0 \text{ or } y = K, \\ < 0 & \text{if } y > K. \end{cases}$$

The solutions $y(t) = 0$ and $y(t) = K$ are equilibrium solutions.

4.1   Case Analysis

Example (Logistic equation). By separation of variables and partial fractions:

$$rt + c = \int r\,dt = \int \frac{dy}{(1 - y/K)\,y} = \int \frac{1}{y}\,dy + \int \frac{1/K}{1 - y/K}\,dy = \ln|y| - \ln|1 - y/K|.$$

Case I: $0 < y_0 < K$.

$$rt + c = \ln\frac{y}{1 - y/K}, \qquad\text{so}\qquad \frac{y}{1 - y/K} = Ce^{rt}, \quad C = e^c.$$

The initial condition $y(0) = y_0$ gives $C = \dfrac{y_0}{1 - y_0/K}$. Solving for $y$:

$$y(t) = \frac{y_0 K}{y_0 + (K - y_0)\,e^{-rt}} \;\to\; K \quad\text{as } t\to\infty \text{ (from below).}$$

Case II: $y_0 = 0$ or $K$. These are the equilibrium solutions.

Case III: $y_0 > K$. The same formula from Case I remains valid. The only difference is that now $y(t) \to K$ from above as $t \to \infty$ (since $K - y_0 < 0$, the exponential term is negative and decaying).

4.2   Concavity

Using the chain rule:

$$\frac{d^2y}{dt^2} = \frac{d}{dt}f(y) = f'(y)\frac{dy}{dt} = f(y)\,f'(y).$$

Computing explicitly:

$$\frac{d^2y}{dt^2} = r^2 y\!\left(1 - \frac{y}{K}\right)\!\left(1 - \frac{2y}{K}\right).$$

Hence:

$$\frac{d^2y}{dt^2} \begin{cases} > 0 & \text{if } 0 < y < K/2 \text{ (concave up)}, \\ = 0 & \text{if } y = K/2 \text{ (inflection point)}, \\ < 0 & \text{if } K/2 < y < K \text{ (concave down)}. \end{cases}$$

The solution $y = K$ is stable and $y = 0$ is unstable. The inflection point occurs at $y = K/2$.

4.3   Modified Logistic Equation

Consider the equation with the opposite sign:

$$\frac{dy}{dt} = -r\left(1 - \frac{y}{T}\right)y.$$

The sign analysis is reversed:

$$\frac{dy}{dt} \begin{cases} < 0 & \text{if } 0 < y < T, \\ = 0 & \text{if } y = 0 \text{ or } y = T, \\ > 0 & \text{if } y > T. \end{cases}$$

A similar procedure gives for $y_0 < T$:

$$y(t) = \frac{y_0 T}{y_0 + (T - y_0)e^{rt}} \to 0 \quad\text{as } t\to\infty.$$

If $y_0 > T$, then there exists a finite time $t^*$ at which the solution blows up:

$$y_0 + (T - y_0)e^{rt^*} = 0 \implies t^* = \frac{1}{r}\ln\frac{y_0}{y_0 - T} > 0.$$

In fact $y(t^*) = +\infty$. The concavity analysis gives the same structure as the original logistic:

$$\frac{d^2y}{dt^2} = r^2 y\!\left(1 - \frac{y}{T}\right)\!\left(1 - \frac{2y}{T}\right).$$
Exercises (B&D)
  1. Logistic equation $dy/dt = ry[1-(y/K)]$ with $y_0 = K/3$:
    1. Doubling time $\tau$ for $r = 0.025$/yr. (Ans. $\tau = (\ln 4)/r = 55.452$ yr)
    2. Time $T$ for $y(T)/K = \beta$ given $y_0/K = \alpha$, where $0 < \alpha, \beta < 1$. (Ans. $T = \frac{1}{r}\ln\!\left[\frac{\beta(1-\alpha)}{(1-\beta)\alpha}\right]$; for $\alpha=0.1$, $\beta=0.9$: $T = 175.78$ yr)
  2. Gompertz equation $dy/dt = ry\ln(K/y)$:
    1. Critical points and stability. (Ans. $y=0$ unstable, $y=K$ asymptotically stable)
    2. Concavity for $0 \leq y \leq K$. (Ans. Concave up for $0 < y \leq K/e$, concave down for $K/e \leq y < K$)
    3. Show Gompertz $dy/dt \geq$ logistic $dy/dt$ for $0 < y \leq K$.
Practice: Logistic Equation Analysis

Consider $\dfrac{dy}{dt} = 0.5\!\left(1 - \dfrac{y}{100}\right)y$ with $y(0) = 20$.

Step 1

What are the equilibrium solutions?

Step 2

Since $0 < y_0 = 20 < K = 100$, is $dy/dt$ positive or negative?

Step 3

What is $y(t)$ as $t \to \infty$?

Step 4

At what value of $y$ does the solution have an inflection point (change concavity)?

All steps complete — well done!

5   Existence and Uniqueness

We have seen solution curves with different initial values that do not intersect. The following theorem justifies this.

Theorem (Existence & Uniqueness)

Let $f$ and $\partial f/\partial y$ be continuous in a rectangle $\alpha < t < \beta$, $\gamma < y < \delta$ containing $(t_0, y_0)$. Then in some interval $t_0 - h < t < t_0 + h$ there is a unique solution $y = \phi(t)$ for $$\frac{dy}{dt} = f(t,y), \qquad y(t_0) = y_0.$$

5.1   Example

Consider the IVP

$$\frac{dy}{dx} = \frac{3x^2 + 4x + 2}{2(y-1)}, \qquad y(0) = -1.$$

We identify

$$f(x,y) = \frac{3x^2 + 4x + 2}{2(y-1)}, \qquad \frac{\partial f}{\partial y} = -\frac{3x^2 + 4x + 2}{2(y-1)^2}.$$

The $\partial f/\partial y$ is continuous everywhere except $y = 1$. Since our initial condition is $y_0 = -1 \neq 1$, there is an interval about $y = -1$ (away from $y=1$) in which the IVP has a unique solution:

$$y = 1 - \sqrt{x^3 + 2x^2 + 2x}.$$

5.2   Counter-example

Consider the IVP

$$\frac{dy}{dx} = y^{1/3}, \qquad y(0) = 0.$$

Here $f(x,y) = y^{1/3}$ and $\dfrac{\partial f}{\partial y} = \dfrac{1}{3}y^{-2/3}$. Although $f$ is continuous everywhere, $\partial f/\partial y$ is not continuous at $y = 0$ — which is exactly where the initial condition lies. So no conclusion can be drawn about uniqueness.

The DE is separable:

$$\frac{3}{2}y^{2/3} = x + c.$$

The condition $y(0) = 0$ gives $c = 0$. So

$$\phi_1(x) = \left(\frac{2}{3}x\right)^{3/2}, \qquad x \geq 0$$

is a solution. But so is

$$\phi_2(x) = -\left(\frac{2}{3}x\right)^{3/2}, \qquad x \geq 0$$

and even $\psi(x) \equiv 0$. One can construct infinitely many solutions:

$$\chi(x) = \begin{cases} 0, & 0 \leq x < x_0, \\ \pm\!\left(\frac{2}{3}(x - x_0)\right)^{3/2}, & x \geq x_0. \end{cases}$$

One can verify that $\chi$ is continuous and differentiable even at $x_0$.

Exercises (B&D)
  1. Determine intervals of existence (without solving):
    • $(t-3)y' + (\ln t)y = 2$, $y(1) = 2$ (Ans. $0 < t < 3$)
    • $t(t-4)y' + y = 0$, $y(2) = 1$ (Ans. $0 < t < 4$)
    • $y' + (\tan t)y = \sin t$, $y(\pi) = 0$ (Ans. $\pi/2 < t < 3\pi/2$)
  2. Where are the hypotheses of the theorem satisfied?
    • $y' = (t-y)/(2t+5y)$ (Ans. $2t + 5y \neq 0$)
    • $y' = (1-t^2-y^2)^{1/2}$ (Ans. $t^2+y^2 < 1$)
    • $y' = (1+t^2)/(3y-y^2)$ (Ans. $y \neq 0,\; y \neq 3$)
  3. Solve and find dependence on $y_0$:
    • $y' = -4t/y$, $y(0) = y_0$ (Ans. $y = \pm\sqrt{y_0^2 - 4t^2}$; $|t| < |y_0|/2$)
    • $y' = 2ty^2$, $y(0) = y_0$ (Ans. $y = 1/[(1/y_0)-t^2]$ if $y_0 \neq 0$; interval $|t| < 1/\sqrt{y_0}$ if $y_0 > 0$)
Practice: Checking Existence & Uniqueness

Consider the IVP $\;\dfrac{dy}{dt} = \dfrac{t}{y-2},\; y(0) = 1.$

Step 1

What is $f(t,y)$?

Step 2

What is $\partial f/\partial y$?

Step 3

Where is $\partial f/\partial y$ discontinuous?

Step 4

Since $y_0 = 1 \neq 2$, does the theorem guarantee a unique solution?

All steps complete — well done!

— End of Modelling Notes —