evan's notes
cal 3discreteode

On this page

  • A constant-volume mixing model
  • Solving the mixing equation
  • How fast does the tank approach equilibrium?
  • Newton's law of cooling
  • Example: cooling coffee

Ordinary Differential Equations

§4 Mixing and Cooling Models

Evan Luo · Sep 14, 2026

Ordinary Differential Equations

§4 Mixing and Cooling Models

Evan LuoYesterday

5 min read

Mixing and cooling look like different physical processes, but their equations have the same shape: the current state moves toward a stable equilibrium, and the distance from that equilibrium decays exponentially.

A constant-volume mixing model

Suppose a tank initially contains 100100100 gallons of well-stirred solution and Q0Q_0Q0​ pounds of dissolved salt. To track the salt over time, define:

  • Q(t)Q(t)Q(t) as the amount of salt, in pounds, after ttt minutes;
  • r>0r>0r>0 as both the inflow and outflow rate, in gallons per minute;
  • 14\frac1441​ lb/gal as the salt concentration of the incoming solution.

Because liquid enters and leaves at the same rate, the volume stays fixed at 100100100 gallons. The amount of salt changes according to

rate of change=rate in−rate out.\text{rate of change}=\text{rate in}-\text{rate out}. rate of change=rate in−rate out.

The incoming salt rate is concentration times flow rate:

(14lbgal)(rgalmin)=r4lbmin.\left(\frac14\frac{\mathrm{lb}}{\mathrm{gal}}\right) \left(r\frac{\mathrm{gal}}{\mathrm{min}}\right) =\frac r4\frac{\mathrm{lb}}{\mathrm{min}}. (41​gallb​)(rmingal​)=4r​minlb​.

Because the mixture is continuously stirred, the concentration is uniform throughout the tank at any instant. The outgoing fluid therefore carries salt at that same concentration:

Q(t)100lbgal.\frac{Q(t)}{100}\frac{\mathrm{lb}}{\mathrm{gal}}. 100Q(t)​gallb​.

Thus the outgoing salt rate is

(Q(t)100lbgal)(rgalmin)=r100Q(t)lbmin.\left(\frac{Q(t)}{100}\frac{\mathrm{lb}}{\mathrm{gal}}\right) \left(r\frac{\mathrm{gal}}{\mathrm{min}}\right) =\frac r{100}Q(t)\frac{\mathrm{lb}}{\mathrm{min}}. (100Q(t)​gallb​)(rmingal​)=100r​Q(t)minlb​.

Subtracting the two rates gives the initial-value problem

Q′+r100Q=r4,Q(0)=Q0.\boxed{ Q'+\frac r{100}Q=\frac r4, \qquad Q(0)=Q_0 }. Q′+100r​Q=4r​,Q(0)=Q0​​.

Keeping the units visible is a useful error check: every term in the differential equation must have units of pounds per minute.

Solving the mixing equation

Because this is a first-order linear differential equation, begin with the integrating factor:

μ(t)=e∫r/100 dt=ert/100.\mu(t)=e^{\int r/100\,dt}=e^{rt/100}. μ(t)=e∫r/100dt=ert/100.

After multiplying the equation by μ(t)\mu(t)μ(t), the left side becomes a product derivative:

ddt(ert/100Q(t))=r4ert/100.\frac d{dt}\left(e^{rt/100}Q(t)\right) =\frac r4e^{rt/100}. dtd​(ert/100Q(t))=4r​ert/100.

Integrating both sides gives

ert/100Q(t)=r4∫ert/100 dt+C=25ert/100+C.\begin{aligned} e^{rt/100}Q(t) &=\frac r4\int e^{rt/100}\,dt+C\\ &=25e^{rt/100}+C. \end{aligned} ert/100Q(t)​=4r​∫ert/100dt+C=25ert/100+C.​

Dividing by the integrating factor,

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

The initial condition determines the constant:

Q0=Q(0)=25+C,C=Q0−25.Q_0=Q(0)=25+C, \qquad C=Q_0-25. Q0​=Q(0)=25+C,C=Q0​−25.

Therefore,

Q(t)=25+(Q0−25)e−rt/100.\boxed{ Q(t)=25+(Q_0-25)e^{-rt/100} }. Q(t)=25+(Q0​−25)e−rt/100​.

The number 252525 is not an arbitrary constant. At equilibrium, the tank has the same concentration as the incoming solution, so

100 gal(14lbgal)=25 lb.100\,\mathrm{gal}\left(\frac14\frac{\mathrm{lb}}{\mathrm{gal}}\right) =25\,\mathrm{lb}. 100gal(41​gallb​)=25lb.

For r>0r>0r>0, the exponential factor tends to zero. If Q0<25Q_0<25Q0​<25, the amount rises toward 252525; if Q0>25Q_0>25Q0​>25, it falls toward 252525; and if Q0=25Q_0=25Q0​=25, it stays there.

Stable salt equilibrium at 25 pounds

Stable salt equilibrium at 25 poundsFor a positive flow rate, solutions beginning with 10, 25, and 50 pounds of salt all approach the equilibrium Q of t equals 25 pounds. Solutions below the equilibrium rise, solutions above it fall, and the equilibrium solution stays constant.050100150200010202530405025 lb equilibriumt (min)Q(t) (lb)
  • Q(0) = 50 lb
  • Q(0) = 25 lb
  • Q(0) = 10 lb
The exponential term keeps the initial deviation's sign while making its size decay. A solution approaches 25 lb from its own side and never crosses the equilibrium.

How fast does the tank approach equilibrium?

Take Q0=50Q_0=50Q0​=50 lb and r=3r=3r=3 gal/min. Then

Q(t)=25+25e−3t/100.Q(t)=25+25e^{-3t/100}. Q(t)=25+25e−3t/100.

Being within 2%2\%2% of the 252525-lb equilibrium means

∣Q(t)−25∣≤0.02(25)=0.5.|Q(t)-25|\le0.02(25)=0.5. ∣Q(t)−25∣≤0.02(25)=0.5.

Since this solution approaches equilibrium from above, it first enters the tolerance band when Q(T)=25.5Q(T)=25.5Q(T)=25.5. Solving,

25+25e−3T/100=25.5e−3T/100=150T=1003ln⁡50≈130.4 min.\begin{aligned} 25+25e^{-3T/100}&=25.5\\ e^{-3T/100}&=\frac1{50}\\ T&=\frac{100}{3}\ln50\\ &\approx130.4\ \mathrm{min}. \end{aligned} 25+25e−3T/100e−3T/100T​=25.5=501​=3100​ln50≈130.4 min.​

Now consider the inverse design problem: what flow rate is needed to reach the same tolerance within 454545 minutes? The threshold case satisfies

25+25e−45r/100=25.5.25+25e^{-45r/100}=25.5. 25+25e−45r/100=25.5.

Therefore,

rmin⁡=10045ln⁡50≈8.69 gal/min.\boxed{ r_{\min}=\frac{100}{45}\ln50 \approx8.69\ \mathrm{gal/min} }. rmin​=45100​ln50≈8.69 gal/min​.

Any r≥rmin⁡r\ge r_{\min}r≥rmin​ reaches the tolerance band no later than 454545 minutes.

Newton's law of cooling

Thermal transfer follows the same stable-equilibrium pattern. Let T(t)T(t)T(t) be an object's temperature and let TroomT_{\mathrm{room}}Troom​ be the constant temperature of its surroundings. Newton's law of cooling states that the rate of temperature change is proportional to the temperature difference:

dTdt=−k(T−Troom),k>0.\boxed{ \frac{dT}{dt}=-k\left(T-T_{\mathrm{room}}\right), \qquad k>0 }. dtdT​=−k(T−Troom​),k>0​.

The minus sign makes the model move toward room temperature:

  • If T>TroomT>T_{\mathrm{room}}T>Troom​, then T′<0T'<0T′<0, so the object cools.
  • If T<TroomT<T_{\mathrm{room}}T<Troom​, then T′>0T'>0T′>0, so the object warms.
  • If T=TroomT=T_{\mathrm{room}}T=Troom​, then T′=0T'=0T′=0, so the temperature is at equilibrium.

The equation is both separable and linear. Separating variables gives

∫dTT−Troom=∫−k dt,\int\frac{dT}{T-T_{\mathrm{room}}} =\int-k\,dt, ∫T−Troom​dT​=∫−kdt,

so

ln⁡∣T−Troom∣=−kt+C.\ln|T-T_{\mathrm{room}}|=-kt+C. ln∣T−Troom​∣=−kt+C.

After exponentiating and absorbing the sign into the arbitrary constant,

T(t)=Troom+C1e−kt.T(t)=T_{\mathrm{room}}+C_1e^{-kt}. T(t)=Troom​+C1​e−kt.

If T(0)=T0T(0)=T_0T(0)=T0​, then C1=T0−TroomC_1=T_0-T_{\mathrm{room}}C1​=T0​−Troom​. Hence

T(t)=Troom+(T0−Troom)e−kt.\boxed{ T(t)=T_{\mathrm{room}} +\left(T_0-T_{\mathrm{room}}\right)e^{-kt} }. T(t)=Troom​+(T0​−Troom​)e−kt​.

The temperature difference T(t)−TroomT(t)-T_{\mathrm{room}}T(t)−Troom​ decays exponentially, so T(t)T(t)T(t) approaches TroomT_{\mathrm{room}}Troom​ without crossing it under this model.

Example: cooling coffee

A cup of coffee is poured at 90∘C90^\circ\mathrm C90∘C into a room at 20∘C20^\circ\mathrm C20∘C. After one minute, its temperature is 85∘C85^\circ\mathrm C85∘C. The model is

T(t)=20+70e−kt.T(t)=20+70e^{-kt}. T(t)=20+70e−kt.

Using T(1)=85T(1)=85T(1)=85,

85=20+70e−k,e−k=6570,85=20+70e^{-k}, \qquad e^{-k}=\frac{65}{70}, 85=20+70e−k,e−k=7065​,

so

k=−ln⁡(6570)≈0.0741 min−1.k=-\ln\left(\frac{65}{70}\right) \approx0.0741\ \mathrm{min}^{-1}. k=−ln(7065​)≈0.0741 min−1.

To find when the coffee reaches 60∘C60^\circ\mathrm C60∘C, solve

60=20+70e−kt.60=20+70e^{-kt}. 60=20+70e−kt.

This gives

t=−1kln⁡(4070)≈7.55 min.\boxed{ t=-\frac1k\ln\left(\frac{40}{70}\right) \approx7.55\ \mathrm{min} }. t=−k1​ln(7040​)≈7.55 min​.

Source: https://notes.ohevan.com/notes/ode/04-mixing-and-cooling

© 2026 Evan Luo. All rights reserved.

Back to Ordinary Differential Equations

0 reads

·Last edited Today
  • stay up to date

  • about me

  • coffee

© 2026 Evan Luo. All rights reserved.