Many models are careful bookkeeping. A tank of brine, a lake with a pollutant, a bloodstream with a drug: in each, an amount changes because some flows in and some flows out. Writing that balance as an equation usually gives a linear first-order equation.
Key idea
Let $Q(t)$ be the amount of salt (grams), not its concentration. Then $$\frac{dQ}{dt} = \underbrace{c_{\text{in}}\,r_{\text{in}}}_{\text{rate in}} - \underbrace{\frac{Q}{V(t)}\,r_{\text{out}}}_{\text{rate out}},$$ where $c_{\text{in}}$ is the incoming concentration (g/L), $r_{\text{in}}, r_{\text{out}}$ are flow rates (L/min) and $V(t) = V_0 + (r_{\text{in}} - r_{\text{out}})t$ is the volume.
Why it works
In a short time $\Delta t$, about $r_{\text{in}}\Delta t$ liters enter, carrying $c_{\text{in}}r_{\text{in}}\Delta t$ grams. The tank is well mixed, so every liter inside holds $\frac{Q}{V}$ grams, and the $r_{\text{out}}\Delta t$ liters that leave carry $\frac{Q}{V}r_{\text{out}}\Delta t$ grams. So $\Delta Q \approx \left(c_{\text{in}}r_{\text{in}} - \frac{Q}{V}r_{\text{out}}\right)\Delta t$; divide by $\Delta t$ and let it shrink. Every term is in grams per minute, a useful check.
Worked example: Set up and solve
A 100 L tank holds water with 20 g of salt. Brine with 3 g/L flows in at 2 L/min, and the mixture drains at 2 L/min. Find $Q(t)$.
- Rate in: $3 \cdot 2 = 6$ g/min. The volume stays 100 L, so rate out: $\frac{Q}{100}\cdot 2 = \frac{Q}{50}$ g/min.
- $Q' = 6 - \frac{Q}{50}$, or $Q' + \frac{1}{50}Q = 6$. The equilibrium is $Q = 300$ g (that is, 3 g/L times 100 L).
- Integrating factor $e^{t/50}$: $(e^{t/50}Q)' = 6e^{t/50}$, so $Q = 300 + Ce^{-t/50}$.
- $Q(0) = 20$ gives $C = -280$.
Answer: $Q(t) = 300 - 280e^{-t/50}$ grams
Worked example: How long?
In the same tank, when does the amount reach 160 g?
- $300 - 280e^{-t/50} = 160$ gives $e^{-t/50} = \frac{1}{2}$.
- So $\frac{t}{50} = \ln 2$.
Answer: $t = 50\ln 2 \approx 34.7$ minutes
Worked example: A filling tank
A 100 L tank starts with 50 L of pure water. Brine with 2 g/L enters at 3 L/min, and the mixture leaves at 2 L/min. How much salt is in the tank when it is full?
- The volume grows by 1 L/min: $V = 50 + t$, full at $t = 50$.
- $Q' = 6 - \frac{2Q}{50 + t}$. Here $p = \frac{2}{50 + t}$, so $\mu = (50 + t)^{2}$.
- $\left[(50 + t)^{2}Q\right]' = 6(50 + t)^{2}$, so $(50 + t)^{2}Q = 2(50 + t)^{3} + C$; $Q(0) = 0$ gives $C = -2 \cdot 50^{3}$.
- $Q = 2(50 + t) - \frac{250000}{(50 + t)^{2}}$. At $t = 50$: $200 - 25 = 175$.
Answer: 175 g
Common mistake
Subtracting the outflow rate in liters, writing $Q' = 6 - 2$, mixes water with salt. The outflow of salt is (concentration in the tank) × (liters per minute), $\frac{Q}{V}r_{\text{out}}$, and it depends on $Q$. A units check catches it: grams per minute minus liters per minute does not make sense.