Mixing Problems (Tank Problems)

April 14, 2026

Problem

A 100-litre tank initially contains pure water. Brine at 5 g/L flows in at 2 L/min; the well-stirred mixture drains at 2 L/min. Find the salt amount S(t) at time t.

Explanation

Why mixing problems are the canonical applied first-order ODE

A tank of liquid with something dissolved in it — salt, pollutant, drug, dye — receives inflow of one concentration and loses outflow of current concentration. The "current concentration" part is what makes it a first-order linear ODE instead of plain algebra: the rate of change depends on how much is in the tank right now.

The template is dSdt  =  (rate in)    (rate out)\frac{dS}{dt} \;=\; (\text{rate in}) \;-\; (\text{rate out}) =(cinrin)    (S(t)V(t)rout)= \bigl(c_{\text{in}} \cdot r_{\text{in}}\bigr) \;-\; \bigl(\tfrac{S(t)}{V(t)} \cdot r_{\text{out}}\bigr)

where SS is the amount of salt (grams), VV is the volume of liquid, cinc_{\text{in}} is inflow concentration (g/L), and rin,routr_{\text{in}}, r_{\text{out}} are flow rates (L/min).

When inflow and outflow rates are equal, VV stays constant and you get a clean first-order linear ODE in SS.

The given problem

  • Tank holds V=100V = 100 L of pure water → S(0)=0S(0) = 0 g.
  • Inflow: rin=2r_{\text{in}} = 2 L/min of brine at cin=5c_{\text{in}} = 5 g/L.
  • Outflow: rout=2r_{\text{out}} = 2 L/min of well-stirred mixture.

Because flows match, V(t)100V(t) \equiv 100 forever. Perfect.

Step-by-step

Step 1 — Set up the ODE.

Rate in: cinrin=52=10c_{\text{in}} \cdot r_{\text{in}} = 5 \cdot 2 = 10 g/min.

Rate out: S(t)Vrout=S(t)1002=S(t)50\dfrac{S(t)}{V} \cdot r_{\text{out}} = \dfrac{S(t)}{100} \cdot 2 = \dfrac{S(t)}{50} g/min.

dSdt=10S50\frac{dS}{dt} = 10 - \frac{S}{50}

Rearrange into standard first-order linear form (#174): dSdt+150S=10\frac{dS}{dt} + \frac{1}{50} S = 10

Step 2 — Solve via equilibrium + transient.

For S+PS=QS' + P S = Q with constants, the equilibrium is Seq=Q/P=10/(1/50)=500S_{\text{eq}} = Q/P = 10 / (1/50) = 500 g.

General solution: S(t)=Seq+(S0Seq)ePt=500+(0500)et/50S(t) = S_{\text{eq}} + (S_0 - S_{\text{eq}})\, e^{-P t} = 500 + (0 - 500)\, e^{-t/50} S(t)=500(1et/50) g\boxed{\, S(t) = 500 \bigl(1 - e^{-t/50}\bigr) \text{ g} \,}

Step 3 — Interpret the two pieces.

  • Seq=500S_{\text{eq}} = 500 g is the equilibrium. At that level, in-rate exactly cancels out-rate. Reachable only asymptotically.
  • Time constant τ=1/P=50\tau = 1/P = 50 minutes. After one τ\tau, the gap to equilibrium has shrunk to 1/e37%1/e \approx 37\%. After 5τ=2505\tau = 250 min, the gap is under 1%.

Equilibrium concentration: 500 g/100 L=5 g/L500 \text{ g} / 100 \text{ L} = 5 \text{ g/L} — exactly the inflow concentration. Makes physical sense: given infinite time, the tank becomes indistinguishable from the inflow.

Verification

S(0)=500(11)=0S(0) = 500 (1 - 1) = 0 ✓. S(t)=500150et/50=10et/50S'(t) = 500 \cdot \dfrac{1}{50} e^{-t/50} = 10 e^{-t/50}. Plug in: S+S/50=10et/50+10(1et/50)/1=10S' + S/50 = 10 e^{-t/50} + 10(1 - e^{-t/50})/1 = 10. ✓

When inflow ≠ outflow — changing tank volume

If rinroutr_{\text{in}} \ne r_{\text{out}}, the volume becomes V(t)=V0+(rinrout)tV(t) = V_0 + (r_{\text{in}} - r_{\text{out}}) \, t and the ODE gets messier — still linear in SS, but with time-varying coefficient: dSdt+routV(t)S=cinrin.\frac{dS}{dt} + \frac{r_{\text{out}}}{V(t)} S = c_{\text{in}} r_{\text{in}}. Solve using the integrating factor μ(t)=exp ⁣(rout/V(t)dt)\mu(t) = \exp\!\left(\int r_{\text{out}} / V(t) \, dt\right).

Also, watch for the tank overflowing (filling case) or emptying (draining case); those impose natural stopping times.

Where mixing ODEs actually show up

  • Pharmacokinetics: drug concentration in the bloodstream under continuous IV infusion + renal clearance.
  • Pollution in lakes/rivers: pollutant mass in a well-mixed body of water with inflow and outflow streams.
  • HVAC / indoor air: contaminant concentration with ventilation.
  • Chemical reactors: CSTR (continuous stirred-tank reactor) — the bread and butter of chemical engineering.

Same ODE, different units. The story of "well-mixed" is everywhere in process engineering.

Common mistakes

  • Wrong concentration in the out-rate. It's the current concentration S(t)/V(t)S(t) / V(t), not the inflow concentration cinc_{\text{in}}.
  • Forgetting the initial condition. The ODE alone has infinitely many solutions; S(0)S(0) picks one.
  • Units. If you mix L and gallons or minutes and hours, your time constant will be off. Pick one system.
  • Assuming equal flow rates without checking. Keep the V(t)V(t) tracker alive until you know the tank stays filled.

Try it in the visualization

Animate the tank filling with coloured fluid proportional to S(t)S(t). Slide cinc_{\text{in}} to change the equilibrium concentration; slide the flow rate to see the time constant τ=V/r\tau = V / r shrink or grow. Overlay the S(t)S(t) curve next to the tank so you can read off how close you are to equilibrium.

Interactive Visualization

Parameters

100.00
5.00
2.00
0.00
200.00
40.00
Your turn

Got your own math or physics problem?

Turn any problem into an interactive visualization like this one — powered by AI, generated in seconds. Free to try, no credit card required.

Sign Up Free to Try It30 free visualizations every day
Mixing Problems (Tank Problems) | MathSpin