Historical Context & Motivation
For centuries, scientists and engineers have needed to understand how substances move through connected systems. Whether it's salt dissolving in a series of water tanks, medicine distributing through the human body, or pollutants cycling through lakes and rivers, the core question is always the same: how much of a substance is in each part of the system at any given time? Compartment models were developed precisely to answer this question by treating each part of a system as a separate "compartment" and tracking the flow of material between them using differential equations.
The central challenge that compartment models address is this: when you have multiple interconnected containers and material is constantly flowing in and out, how do you predict the amount in each container over time? A single differential equation can describe one tank, but the moment you connect tanks together, you need a system of differential equations — and that's exactly what this lesson is about.
Core Principles & Definitions
Before diving into the math, you need to understand the building blocks of every compartment model. The basic idea is surprisingly simple: divide your system into boxes, track what goes in and what goes out of each box, and write a rate equation for each one. These rate equations form a system that you can solve to find how each compartment changes over time.
Compartment
Flow Rate
Concentration
Balance Law
System Coupling
Visual Explanation
A Two-Tank Mixing System
The diagram below shows the classic two-compartment mixing problem. An external source pumps a salt solution into Tank 1, and fluid flows between the two tanks and out of the system. Each arrow is labeled with its flow rate, and the concentration of the outflow depends on the current amount of salt divided by the volume in that tank.
Notice how the equation for Tank 1 includes a term involving x₂ (the amount in Tank 2), and the equation for Tank 2 includes a term involving x₁. This is the coupling that makes this a system rather than two independent equations. You must solve both equations together because the rate of change in each tank depends on what's happening in the other.
Mathematical Framework
Let's formalize the mathematics behind compartment models. The key step is translating the physical setup — tanks, pipes, flow rates — into a precise system of differential equations. We'll start with the general balance law and then see how it applies to a standard two-tank problem.
The key insight is that each equation has a negative term proportional to its own variable (substance leaving that tank) and a positive term proportional to the other tank's variable (substance arriving from the other tank). This cross-dependency is what couples the equations together and makes the system interesting to solve.
Types of Compartment Models
Compartment models come in several varieties depending on the structure of the system and the nature of the flows. Understanding these types helps you recognize which model to use for a given real-world problem.
In a series model, substance flows in one direction — like food moving through stages of digestion. A parallel model has compartments that receive input from the same source but don't interact with each other. The closed-loop model is the most fully coupled: substance circulates back and forth, as in the two-tank mixing problem we saw earlier. Finally, the SIR model tracks people rather than chemicals, modeling how individuals transition from susceptible to infected to recovered — the flow rate depends nonlinearly on the product of S and I.
Worked Example: Two-Tank Salt Problem
Let's work through a classic problem step by step. Tank 1 holds 100 liters of pure water and Tank 2 holds 100 liters of pure water. A brine solution with a concentration of 2 g/L flows into Tank 1 at 5 L/min. Fluid flows from Tank 1 to Tank 2 at 5 L/min, and fluid flows from Tank 2 out of the system at 5 L/min. The volumes stay constant since every inflow rate equals every outflow rate. Find the system of differential equations and the amount of salt in each tank as t → ∞.
Strengths & Limitations
Compartment models are one of the most widely used tools in applied mathematics, but they have both powerful advantages and important limitations. Understanding these will help you decide when a compartment model is the right tool — and when you might need something more sophisticated.
| Aspect | Strengths | Limitations |
|---|---|---|
| Simplicity | Easy to set up: just apply the balance law to each compartment. The physical intuition is very clear — you can draw the system as boxes and arrows. | Oversimplifies reality: real systems (oceans, human bodies) aren't perfectly mixed. Spatial variation within a compartment is ignored. |
| Scalability | Adding more compartments is straightforward: just add another equation to the system. Works for 2 tanks or 200 tanks. | Large systems become hard to solve by hand. Computer methods (numerical ODE solvers) are needed for more than 3–4 compartments. |
| Versatility | Applicable across fields: chemistry, biology, medicine, ecology, epidemiology, economics, and engineering. | Not suitable for problems where diffusion, spatial gradients, or wave-like behavior matter — those require partial differential equations. |
| Constant volumes | When inflow rate equals outflow rate, tank volumes remain constant, keeping the equations linear and solvable. | If volumes change over time (e.g., a tank filling up), the equations become nonlinear and much harder to solve analytically. |
Connection to Advanced Theory
Compartment models sit at the crossroads of several advanced mathematical topics. If you continue studying math and science in college, you'll see these ideas expanded in exciting ways. Here's a preview of how compartment models connect to the bigger picture.
| Compartment Models (This Lesson) | Advanced Extension |
|---|---|
| Two or three tanks with constant flow rates → linear system of ODEs | Eigenvalue methods: the matrix A from the system x' = Ax + b has eigenvalues that determine how fast the system approaches steady state. |
| Well-mixed assumption: concentration is uniform within each compartment | Partial differential equations (PDEs): when mixing isn't perfect, you need PDEs that track concentration as a function of both position and time. |
| SIR model with constant infection/recovery rates | Nonlinear dynamics and chaos: real epidemic models (SEIR, SIS) have variable rates and can exhibit complex behaviors like periodic outbreaks. |
| Exact analytical solutions for small systems | Numerical methods: Euler's method, Runge-Kutta, and other algorithms approximate solutions for large or nonlinear systems on computers. |
The beauty of compartment models is that they give you a concrete, visual entry point into systems of differential equations. The skills you're building now — setting up balance laws, recognizing coupling between equations, and interpreting steady-state behavior — are exactly the skills you'll use in college-level courses on linear algebra, dynamical systems, and mathematical modeling. If you master the two-tank problem today, you're well on your way to modeling everything from ocean currents to financial markets.
Practice Problems
Summary
Compartment models divide a system into well-mixed regions and use the balance law (Rate of change = Rate in − Rate out) to write a differential equation for each region. When compartments are connected by flows, their equations become coupled, forming a system of differential equations that must be solved together. The outflow rate from each compartment depends on the concentration (amount divided by volume) in that compartment, which changes over time.
Common types include series (cascade) models with one-way flow, closed-loop models with recirculation, and the SIR epidemic model for disease spread. At steady state, all derivatives equal zero and the system reaches equilibrium. The skills you've built here — setting up balance laws, recognizing coupling, and interpreting long-term behavior — form the foundation for advanced work in linear algebra, dynamical systems, and mathematical modeling.