One tank, one balance law
Picture a tank holding salt water — brine. A pipe pours fresh brine in at the top; a pipe at the bottom drains the well-stirred mixture out. We do not track the messy molecular detail; we track one number, the amount of salt S(t) in the tank, measured in grams. Everything in a mixing problem hangs on a single sentence you already met in the first guide of this rung: the rate of change of the amount equals the rate in minus the rate out. In symbols, dS/dt = (rate salt enters) - (rate salt leaves). The entire craft is filling in those two rates correctly.
Each rate is always a flow of liquid times a concentration — that product is the key. The inflow brings liquid at some flow rate (say 5 litres per minute) carrying salt at some concentration (say 2 grams per litre), so salt enters at 5 times 2 = 10 grams per minute. The outflow is subtler, and it is where beginners stumble: the draining liquid carries whatever concentration the tank currently has, which is the amount of salt divided by the current volume, S/V. So salt leaves at (outflow rate) times (S/V). Notice S appears on the right — the equation feeds back on itself, which is exactly what makes it a differential equation rather than a plain formula.
Watching the volume first
The volume obeys its own tiny balance: dV/dt = (inflow rate) - (outflow rate), counting litres, not grams. The friendliest case — and the one to master first — is when inflow and outflow rates are equal, say both 5 litres per minute. Then dV/dt = 0, the volume sits constant at its starting value V_0, and S/V has a constant denominator. The salt balance becomes dS/dt = 10 - 5·(S/V_0), a clean equation with constant coefficients.
If the rates differ, the volume drifts and the equation gets a variable coefficient. Suppose 6 litres flow in but only 4 drain out: the tank gains 2 litres every minute, so V(t) = V_0 + 2t. Now the outflow term is 4·S/(V_0 + 2t), whose coefficient changes with time, and the tank will eventually overflow — a built-in reminder to track the limits of the model. The honest move is to write V(t) explicitly before touching the salt, so you always know exactly what divides S.
Volume balance: dV/dt = q_in - q_out (litres/min) Salt balance: dS/dt = q_in*c_in - q_out*(S/V) q_in = inflow rate of liquid (litres/min) c_in = concentration coming in (grams/litre) q_out = outflow rate of liquid (litres/min) S/V = current tank concentration (grams/litre) Equal rates (q_in = q_out = q, so V = V_0 constant): dS/dt = q*c_in - (q/V_0)*S -- first-order linear, constant coeffs
It is a first-order linear equation in disguise
Rearrange the equal-rate case: dS/dt + (q/V_0) S = q·c_in. This is exactly the first-order linear equation y' + p(t) y = q(t) you learned to solve earlier in this ladder — here p is the constant q/V_0 and the right side is the constant inflow rate of salt. So you already own the tool: multiply by the integrating factor mu(t) = e^(∫p dt) = e^((q/V_0) t), recognise the left side as a single derivative, and integrate. No new technique is needed; the mixing story merely hands you a particular linear equation to feed into a recipe you have already mastered.
The solution has the shape you should now expect from any forced linear equation: a steady part plus a fading part. Solving dS/dt + (q/V_0) S = q·c_in with S(0) = S_0 gives S(t) = V_0·c_in + (S_0 - V_0·c_in)·e^(-(q/V_0) t). Read it as a story. The first piece, V_0·c_in, is the salt the tank settles to — its steady state. The second piece is the transient: a memory of the initial amount that decays exponentially and is gone after a few multiples of the time constant V_0/q.
From one tank to many: compartment models
The real power arrives when you chain tanks together. Drain tank 1 into tank 2, tank 2 into tank 3, and the outflow of one becomes the inflow of the next. Each tank gets its own balance law, and now the equations are coupled: tank 2's inflow concentration is tank 1's current concentration, so S_2's equation contains S_1. This is the heart of a compartment model — a system where each 'compartment' is a well-mixed pool and arrows between them carry substance at rates proportional to how much is present.
Written together, two coupled tanks give two equations — dS_1/dt and dS_2/dt — that must be solved as a first-order system, not one at a time, because each depends on the other. You have not learned to solve such systems yet (that is a whole later rung, with eigenvalues and matrix methods), but you can already build them correctly, and that modeling step is the valuable half. The same compartment picture, recall from the first guide, is just the modeling cycle applied to several connected pools at once.
The same idea, far from any tank
What makes tanks worth your time is that almost nothing in the application is really about brine. Swap the words and the very same equations describe a lake taking in pollutant from a river and flushing it downstream; heat moving between two adjacent rooms; a charge spreading across coupled capacitors. The mathematics does not care whether the 'amount' is grams of salt, kilograms of pollutant, or joules of heat — the balance law in equals out plus change is universal. Learning tanks is learning a portable pattern.
The most consequential relabelling is in medicine. A drug injected into the bloodstream is salt; the body is the tank; the liver and kidneys are the outflow pipe clearing the drug at a rate proportional to its concentration. This is the foundation of pharmacokinetics, and the two-tank version — blood compartment exchanging with a tissue compartment — is exactly the coupled system above. The exponential clearance you derived for brine is the very curve that tells a clinician how a dose fades and when the next one is due.
- Decide what 'amount' you track in each compartment (grams, kilograms, joules, milligrams of drug) and name it S_i(t) with units.
- Settle every volume first: write each V_i(t) from its own inflow-minus-outflow balance, so the concentrations S_i/V_i are well defined.
- Write one balance per compartment: dS_i/dt = sum of (flow times source concentration) coming in, minus (flow times S_i/V_i) going out.
- For a single tank, recognise the first-order linear form and solve with the integrating factor; for several, assemble the coupled system and check each equilibrium for sanity.