Differential EquationsModeling with First-Order Equations3 of 6
Modeling with First-Order Equations · 3

Mixing and Compartment Problems

When salt water flows into a tank and mixes with the water already inside, the concentration leaving through the drain changes every instant, so we need a differential equation to track how much salt is in the tank at any time tt.

1

Setting Up a Mixing Problem

Suppose a tank initially holds 100 L100\text{ L} of pure water. A pipe at the top pumps in salt water at a concentration of 2 g/L\ratein{2}\text{ g/L} and a flow rate of 5 L/min5\text{ L/min}, while a drain at the bottom lets the well-mixed water out at 5 L/min5\text{ L/min}. We want to set up a differential equation for the amount of salt S(t)\amount{S(t)} in grams inside the tank at time tt.

100 L100\text{ L}
S(t) g\htmlClass{lc-blue}{S(t)}\text{ g}
5 L/min at 2 g/L5\text{ L/min at }\htmlClass{lc-green}{2}\text{ g/L}
5 L/min5\text{ L/min}
at S100 g/L\text{at }\dfrac{\htmlClass{lc-blue}{S}}{100}\text{ g/L}
Setting Up a Mixing Problem
100 L100\text{ L}
t=12 minsalt=  ?\begin{aligned} t &= 12\text{ min}\\ \htmlClass{lc-blue}{\text{salt}} &= \;? \end{aligned}
Text solution
Find Rate In from the incoming pipeMultiply the incoming flow rate by the incoming concentration so the liters cancel and leave grams per minute.
Rate In=5 L/min×2 g/L=10 g/min\displaystyle \begin{aligned} \ratein{\text{Rate In}} &= 5\text{ L/min} \times \ratein{2}\text{ g/L} \\ &= \ratein{10}\text{ g/min} \end{aligned}
Find Rate Out from the current tank concentrationBecause 5 L/min5\text{ L/min} enters and 5 L/min5\text{ L/min} leaves, the volume stays at 100 L100\text{ L}, and the drain carries out water at the tank's current concentration of S100 g/L\frac{\amount{S}}{100}\text{ g/L}.
Rate Out=5 L/min×S100 g/L⏟tankconcentration=5S100=S20 g/min\displaystyle \begin{aligned} \rate{\text{Rate Out}} &= 5\text{ L/min} \times \underbrace{\frac{\amount{S}}{100}\text{ g/L}}_{\substack{\text{tank} \\ \text{concentration}}} \\ &= \frac{5\amount{S}}{100} = \rate{\frac{\amount{S}}{20}}\text{ g/min} \end{aligned}
Subtract Rate Out from Rate InCombine the two pipe rates with the pure-water starting condition to get the differential equation for S(t)\amount{S(t)}.
dSdt=10⏟Rate In−S20⏟Rate Out,S(0)=0\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} &= \ratein{\underbrace{10}_{\text{Rate In}}} - \rate{\underbrace{\frac{\amount{S}}{20}}_{\text{Rate Out}}}, \\ \amount{S(0)} &= \amount{0} \end{aligned}

So the salt in the tank builds up at 10 g/min\ratein{10}\text{ g/min} minus one-twentieth of the salt currently in the tank.

2

Equilibrium and Solving the Constant-Volume Tank

Now we want to find the equilibrium amount of salt where the amount in the tank stops changing, solve dSdt=10−S20\rate{\frac{dS}{dt}} = \ratein{10} - \rate{\frac{\amount{S}}{20}} for S(t)\amount{S(t)}, and find how much salt is in the tank at t=12t = 12 minutes.

Equilibrium and Solving the Constant-Volume Tank
dSdt=10−120S\dfrac{\htmlClass{lc-pink}{dS}}{\htmlClass{lc-pink}{dt}} = \htmlClass{lc-green}{10} - \htmlClass{lc-pink}{\tfrac{1}{20}\htmlClass{lc-blue}{S}}
20\htmlClass{lc-mute}{20}
40\htmlClass{lc-mute}{40}
60\htmlClass{lc-mute}{60}
80\htmlClass{lc-mute}{80}
100\htmlClass{lc-mute}{100}
min\htmlClass{lc-mute}{\text{min}}
grams\htmlClass{lc-mute}{\text{grams}}
S(0)=0\htmlClass{lc-blue}{S(0)} = 0
S(t)=  ?\htmlClass{lc-blue}{S(t)} = \;?
Text solution
Set the rate of change to zero to find equilibriumThe salt level stops changing at the amount where Rate Out equals Rate In.
10−S20=0  ⟹  S20=10  ⟹  S=200 g⏟equilibrium\displaystyle \begin{aligned} \ratein{10} - \rate{\frac{\amount{S}}{20}} = 0 &\implies \rate{\frac{\amount{S}}{20}} = \ratein{10} \\ &\implies \equilibrium{\underbrace{\amount{S} = \equilibrium{200}\text{ g}}_{\text{equilibrium}}} \end{aligned}
Factor out the coefficient of S\amount{S} to see the gap to equilibriumRewriting the right side shows that the distance between S\amount{S} and 200 g\equilibrium{200}\text{ g} shrinks at a rate proportional to that gap.
dSdt\displaystyle \rate{\frac{dS}{dt}} =−120(S−200)⏟gap toequilibrium\displaystyle = \rate{-\frac{1}{20}}\amount{\underbrace{(S - \equilibrium{200})}_{\substack{\text{gap to} \\ \text{equilibrium}}}}
Write the exponential decay of the gapBecause dSdt=−120(S−200)\rate{\frac{dS}{dt}} = \rate{-\frac{1}{20}}(\amount{S} - \equilibrium{200}) has the same separable form as Newton's Law of Cooling, the gap S−200\amount{S} - \equilibrium{200} decays exponentially.
S−200=Ae−t/20  ⟹  S(t)=200+Ae−t/20\displaystyle \begin{aligned} \amount{S} - \equilibrium{200} &= \amount{A}\multiplier{e^{-t/20}} \\ \implies \amount{S(t)} &= \equilibrium{200} + \amount{A}\multiplier{e^{-t/20}} \end{aligned}
Use S(0)=0\amount{S(0)} = \amount{0} to find A\amount{A} and evaluate at t=12t = 12Plugging in t=0t = 0 gives the starting gap of −200 g\amount{-200}\text{ g}, which we then use to find the amount of salt at 1212 minutes.
0=200+Ae0  ⟹  A=−200S(t)=200−200e−t/20S(12)=200−200e−0.6≈90 g\displaystyle \begin{aligned} \amount{0} &= \equilibrium{200} + \amount{A}\multiplier{e^0} \\ \implies \amount{A} &= \amount{-200} \\ \amount{S(t)} &= \equilibrium{200} - \amount{200}\multiplier{e^{-t/20}} \\ \amount{S(12)} &= \equilibrium{200} - \amount{200}\multiplier{e^{-0.6}} \approx 90\text{ g} \end{aligned}

So after 1212 minutes, the tank contains about 90 g90\text{ g} of salt on its way toward the 200 g\equilibrium{200}\text{ g} equilibrium. (You can go straight from dSdt=−120(S−200)\rate{\frac{dS}{dt}} = \rate{-\frac{1}{20}}(\amount{S} - \equilibrium{200}) to S(t)=200+Ae−t/20\amount{S(t)} = \equilibrium{200} + \amount{A}\multiplier{e^{-t/20}}, or separate variables and write ∫1S−200 dS=∫−120 dt\int \frac{1}{\amount{S} - \equilibrium{200}}\,dS = \int \rate{-\frac{1}{20}}\,dt first if you want to show every integration step.)

Because Rate Out is S20\rate{\frac{\amount{S}}{20}} while Rate In stays fixed at 10 g/min\ratein{10}\text{ g/min}, any starting amount below 200 g\equilibrium{200}\text{ g} makes Rate Out smaller than Rate In so S(t)\amount{S(t)} rises, any starting amount above 200 g\equilibrium{200}\text{ g} makes Rate Out larger than Rate In so S(t)\amount{S(t)} drops toward 200 g\equilibrium{200}\text{ g}, and starting right at 200 g\equilibrium{200}\text{ g} balances the two pipes so S(t)\amount{S(t)} stays constant.

Because the drain carries out whatever salt mix is currently in the tank, every starting amount settles toward 200 g, where Rate Out matches Rate In.
3

Mixing When Volume Changes

When the incoming and outgoing flow rates do not match, the volume of water in the tank changes with time, which puts tt into the denominator of Rate Out, and with salt still flowing in, that makes the differential equation non-separable. Suppose our 100 L100\text{ L} tank still starts with pure water (S(0)=0\amount{S(0)} = \amount{0}), but the top pipe now pumps in 2 g/L\ratein{2}\text{ g/L} salt water at 6 L/min6\text{ L/min} while the bottom drain lets water out at 4 L/min4\text{ L/min}. We want to find the formula for S(t)\amount{S(t)} at any time tt before the tank overflows.

Mixing When Volume Changes
6 L/min at 2 g/L6\text{ L/min at }\htmlClass{lc-green}{2}\text{ g/L}
4 L/min4\text{ L/min}
100 L100\text{ L}
S(0)=0S(t)=  ?\begin{aligned} \htmlClass{lc-blue}{S(0)} &= 0\\ \htmlClass{lc-blue}{S(t)} &= \;? \end{aligned}

Moving the S\amount{S} term to the left side puts the equation into the first-order linear form dSdt+P(t)S=Q(t)\rate{\frac{dS}{dt}} + \rate{P(t)}\amount{S} = \ratein{Q(t)}, which we can solve using an integrating factor.

Text solution
Write the volume V(t)V(t) at time ttWith 6 L/min6\text{ L/min} entering and 4 L/min4\text{ L/min} leaving, the tank gains 2 L/min2\text{ L/min} on top of its starting 100 L100\text{ L}.
V(t)\displaystyle V(t) =100+(6−4)t\displaystyle = 100 + (6 - 4)t =100+2t\displaystyle = 100 + 2t
Set up Rate In and Rate Out using V(t)V(t) in the denominatorDividing the current salt S\amount{S} by the changing volume 100+2t100 + 2t gives the concentration leaving the drain at time tt.
dSdt=6×2⏟Rate In−4×S100+2t⏟Rate Out=12−4100+2tS=12−250+tS\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} &= \ratein{\underbrace{6 \times 2}_{\text{Rate In}}} - \rate{\underbrace{4 \times \frac{\amount{S}}{100 + 2t}}_{\text{Rate Out}}} \\ &= \ratein{12} - \rate{\frac{4}{100 + 2t}}\amount{S} \\ &= \ratein{12} - \rate{\frac{2}{50 + t}}\amount{S} \end{aligned}
Move the S\amount{S} term to the left and find the integrating factor M(t)\multiplier{M(t)}Writing the equation in linear form dSdt+P(t)S=Q(t)\rate{\frac{dS}{dt}} + \rate{P(t)}\amount{S} = \ratein{Q(t)} gives P(t)=250+t\rate{P(t)} = \rate{\frac{2}{50 + t}}.
dSdt+250+t⏟P(t)S=12M(t)=e∫250+t dt=e2ln⁡(50+t)=eln⁡((50+t)2)=(50+t)2\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} + \rate{\underbrace{\frac{2}{50 + t}}_{P(t)}}\amount{S} &= \ratein{12} \\ \multiplier{M(t)} &= e^{\int \rate{\frac{2}{50 + t}}\,dt} \\ &= e^{2\ln(50 + t)} \\ &= e^{\ln((50 + t)^2)} \\ &= \multiplier{(50 + t)^2} \end{aligned}
Multiply by (50+t)2\multiplier{(50 + t)^2} and integrate both sidesThe integrating factor turns the left side into the derivative of (50+t)2S\multiplier{(50 + t)^2} \amount{S}, which we integrate and divide by (50+t)2\multiplier{(50 + t)^2}.
(50+t)2dSdt+2(50+t)S=12(50+t)2ddt[(50+t)2S]=12(50+t)2(50+t)2S=∫12(50+t)2 dt=4(50+t)3+CS(t)=4(50+t)+C(50+t)2\displaystyle \begin{aligned} \multiplier{(50 + t)^2}\rate{\frac{dS}{dt}} \\ {} + 2(50 + t)\amount{S} &= \ratein{12}\multiplier{(50 + t)^2} \\ \rate{\frac{d}{dt}}\left[\multiplier{(50 + t)^2} \amount{S}\right] &= \ratein{12}\multiplier{(50 + t)^2} \\ \multiplier{(50 + t)^2} \amount{S} &= \int \ratein{12}\multiplier{(50 + t)^2}\,dt \\ &= 4(50 + t)^3 + C \\ \amount{S(t)} &= 4(50 + t) \\ &\quad {} + \frac{C}{(50 + t)^2} \end{aligned}
Plug in S(0)=0\amount{S(0)} = \amount{0} to find CCSubstituting t=0t = 0 and S=0\amount{S} = \amount{0} gives CC for a tank starting with pure water.
0=4(50)+C502=200+C2500  ⟹  C=−500,000S(t)=4(50+t)−500,000(50+t)2\displaystyle \begin{aligned} \amount{0} &= 4(50) + \frac{C}{50^2} \\ &= 200 + \frac{C}{2500} \\ \implies C &= -500{,}000 \\ \amount{S(t)} &= 4(50 + t) - \frac{500{,}000}{(50 + t)^2} \end{aligned}

If the tank has a maximum capacity of 200 L200\text{ L}, this formula gives the grams of salt in the tank for 0≤t≤500 \le t \le 50 minutes, right up to the moment V(50)=100+2(50)=200 LV(50) = 100 + 2(50) = 200\text{ L} when the tank begins to overflow.

Whether the tank is filling, holding steady, or draining, the concentration S(t)V(t)\frac{\amount{S(t)}}{V(t)} approaches the incoming pipe's 2 g/L\ratein{2}\text{ g/L}. The total salt S(t)\amount{S(t)}, however, only levels off when the flow rates match: it keeps climbing toward a slanted line as a filling tank rises toward overflow, and it rises and then drops back to zero as a draining tank runs dry.

No matter how fast the tank drains, the water inside still approaches the incoming pipe’s 2 g/L, while the total amount of salt only levels off when the two pipes match.
4

Chaining Compartments Together

When one tank or organ drains directly into a second one, we want to track the amount in both compartments at the same time. For a 500 mg\amount{500}\text{ mg} pill swallowed into the stomach, where x(t)\amount{x(t)} is the medicine in the stomach and y(t)\secondamount{y(t)} is the medicine in the bloodstream, we write a balance equation for each compartment.

Rate In=0\htmlClass{lc-green}{\text{Rate In} = 0}
Stomach\text{Stomach}
x(t)\htmlClass{lc-blue}{x(t)}
x(0)=500 mg\htmlClass{lc-blue}{x(0)} = \htmlClass{lc-blue}{500}\text{ mg}
k1x\htmlClass{lc-pink}{k_1}\htmlClass{lc-blue}{x}
Bloodstream\text{Bloodstream}
y(t)\htmlClass{lc-orange}{y(t)}
k2y\htmlClass{lc-pink}{k_2}\htmlClass{lc-orange}{y}
kidneys\text{kidneys}
Chaining Compartments Together
Tank A\text{Tank A}
Tank B\text{Tank B}
Text solution
Write the balance equation for the first compartment x(t)\amount{x(t)}After the pill is swallowed, no new medicine enters the stomach, and medicine leaves into the blood at rate k1x\rate{k_1 \amount{x}}.
dxdt=0⏟Rate In−k1x⏟Rate Out=−k1x,x(0)=500 mg\displaystyle \begin{aligned} \rate{\frac{dx}{dt}} &= \ratein{\underbrace{0}_{\text{Rate In}}} - \rate{\underbrace{k_1 \amount{x}}_{\text{Rate Out}}} \\ &= \rate{-k_1 \amount{x}}, \\ \amount{x(0)} &= \amount{500}\text{ mg} \end{aligned}
Use the first compartment's Rate Out as the second compartment's Rate InEvery milligram leaving the stomach enters the bloodstream at rate k1x\rate{k_1 \amount{x}}, while the kidneys filter medicine out of the blood at rate k2y\rate{k_2 \secondamount{y}}.
dydt=k1x⏟Rate Outfrom x−k2y⏟Rate Outfrom y,y(0)=0 mg\displaystyle \begin{aligned} \rate{\frac{dy}{dt}} &= \rate{\underbrace{k_1 \amount{x}}_{\substack{\text{Rate Out} \\ \text{from } x}}} - \rate{\underbrace{k_2 \secondamount{y}}_{\substack{\text{Rate Out} \\ \text{from } y}}}, \\ \secondamount{y(0)} &= \secondamount{0}\text{ mg} \end{aligned}

Because dxdt=−k1x\rate{\frac{dx}{dt}} = \rate{-k_1 \amount{x}} depends only on x\amount{x}, we always solve the first compartment for x(t)\amount{x(t)} first and plug that function into the second compartment's equation for dydt\rate{\frac{dy}{dt}}.

The stomach amount x(t)\amount{x(t)} decays exponentially at the exact same rate regardless of how fast the kidneys work, whereas the bloodstream amount y(t)\secondamount{y(t)} rises whenever stomach inflow k1x\rate{k_1 \amount{x}} is greater than kidney removal k2y\rate{k_2 \secondamount{y}}, peaks at the moment those two rates match, and then drains back to zero.

Because medicine only flows one way from the stomach into the blood, changing how fast the kidneys clear the blood never changes what's in the stomach, while the amount in the blood rises as long as stomach inflow tops kidney outflow, peaks the moment the two rates match, and then drains to zero.

Key concepts

Every mixing or compartment problem starts from the same balance equation for the total amount S(t)\amount{S(t)} inside the tank:

dSdt\displaystyle \rate{\frac{dS}{dt}} =Flowin×Cin⏟Rate In−Flowout×SV(t)⏟Rate Out\displaystyle = \ratein{\underbrace{\text{Flow}_{\text{in}} \times C_{\text{in}}}_{\text{Rate In}}} - \rate{\underbrace{\text{Flow}_{\text{out}} \times \frac{\amount{S}}{V(t)}}_{\text{Rate Out}}}

Always track the total grams S(t)\amount{S(t)} rather than concentration. If a problem gives or asks for a concentration CC, convert between them using S=C×V(t)\amount{S} = C \times V(t). When pure water flows into a tank, Cin=0\ratein{C_{\text{in}}} = \ratein{0}, so Rate In\ratein{\text{Rate In}} is 0\ratein{0} (flushing a 400 L400\text{ L} tank with pure water at 8 L/min8\text{ L/min} gives dSdt=0−8(S400)=−S50\rate{\frac{dS}{dt}} = \ratein{0} - \rate{8\left(\frac{\amount{S}}{400}\right)} = \rate{-\frac{\amount{S}}{50}}).

How you solve the differential equation depends on whether the volume changes:

Constant volume (Flowin=Flowout\text{Flow}_{\text{in}} = \text{Flow}_{\text{out}}), close the gap to equilibrium

You do not need an integrating factor when the two flow rates match and V(t)=V0V(t) = V_0 is constant. Set dSdt=0\rate{\frac{dS}{dt}} = 0 to find the equilibrium Seq\equilibrium{S_{\text{eq}}}, and the gap decays exponentially: for dSdt=10−S20\rate{\frac{dS}{dt}} = \ratein{10} - \rate{\frac{\amount{S}}{20}}, Seq=200\equilibrium{S_{\text{eq}}} = \equilibrium{200} and S(t)=200+Ae−t/20\amount{S(t)} = \equilibrium{200} + \amount{A}\multiplier{e^{-t/20}}.

Changing volume (Flowin≠Flowout\text{Flow}_{\text{in}} \ne \text{Flow}_{\text{out}}), integrating factor

Write V(t)=V0+(Flowin−Flowout)tV(t) = V_0 + (\text{Flow}_{\text{in}} - \text{Flow}_{\text{out}})t first, move the S\amount{S} term to the left side to get dSdt+P(t)S=Q(t)\rate{\frac{dS}{dt}} + \rate{P(t)}\amount{S} = \ratein{Q(t)}, and multiply by M(t)=e∫P(t) dt\multiplier{M(t)} = \multiplier{e^{\int P(t)\,dt}}. For dSdt+250+tS=12\rate{\frac{dS}{dt}} + \rate{\frac{2}{50 + t}}\amount{S} = \ratein{12}, multiplying by M(t)=(50+t)2\multiplier{M(t)} = \multiplier{(50 + t)^2} turns the left side into ddt[(50+t)2S]=12(50+t)2\rate{\frac{d}{dt}}\left[\multiplier{(50 + t)^2} \amount{S}\right] = \ratein{12}\multiplier{(50 + t)^2}. Keep in mind that the equation only holds until the tank overflows (V(t)=Vmax⁡V(t) = V_{\max}) or runs dry (V(t)=0V(t) = 0).

Chained compartments, solve the first compartment first

Set Rate In\ratein{\text{Rate In}} of the second compartment equal to Rate Out\rate{\text{Rate Out}} of the first. Solve the first compartment's equation for x(t)\amount{x(t)} first, then substitute that formula for x(t)\amount{x(t)} into the second compartment's equation dydt+P(t)y=Q(t)\rate{\frac{dy}{dt}} + \rate{P(t)}\secondamount{y} = Q(t) and solve it as a first-order linear equation using an integrating factor.

5

Practice

1

A 200 L200\text{ L} tank initially contains 500 g500\text{ g} of salt dissolved in water. Salt water with a concentration of 1 g/L1\text{ g/L} is pumped in at 4 L/min4\text{ L/min}, and the well-mixed water drains out at 4 L/min4\text{ L/min}. Write the differential equation for the amount of salt S(t)\amount{S(t)} in grams, find the equilibrium amount of salt, and solve for S(t)\amount{S(t)}.

Compare the incoming and outgoing flow rates to see whether the 200 L200\text{ L} volume changes, then express each pipe's rate in g/min\text{g/min}.

Set up Rate In and Rate OutBecause 4 L/min4\text{ L/min} enters and 4 L/min4\text{ L/min} leaves, the volume stays constant at 200 L200\text{ L}.
dSdt=4×1⏟Rate In−4×S200⏟Rate Out=4−S50,S(0)=500\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} &= \ratein{\underbrace{4 \times 1}_{\text{Rate In}}} - \rate{\underbrace{4 \times \frac{\amount{S}}{200}}_{\text{Rate Out}}} \\ &= \ratein{4} - \rate{\frac{\amount{S}}{50}}, \\ \amount{S(0)} &= \amount{500} \end{aligned}
Find the equilibrium amountSet dSdt=0\rate{\frac{dS}{dt}} = 0 to find where Rate Out matches Rate In.
4−S50=0  ⟹  S50=4  ⟹  S=200 g\displaystyle \begin{aligned} \ratein{4} - \rate{\frac{\amount{S}}{50}} = 0 &\implies \rate{\frac{\amount{S}}{50}} = \ratein{4} \\ &\implies \amount{S} = \equilibrium{200}\text{ g} \end{aligned}
Solve for S(t)\amount{S(t)} using the initial condition S(0)=500\amount{S(0)} = \amount{500}Factoring out −150\rate{-\frac{1}{50}} gives dSdt=−150(S−200)\rate{\frac{dS}{dt}} = \rate{-\frac{1}{50}}(\amount{S} - \equilibrium{200}), so the gap to 200 g\equilibrium{200}\text{ g} decays exponentially. (Be careful to solve 500=200+Ae0\amount{500} = \equilibrium{200} + \amount{A}\multiplier{e^0} for A=300\amount{A} = \amount{300}; simply placing the initial 500 g\amount{500}\text{ g} in front of the exponential without subtracting the 200 g\equilibrium{200}\text{ g} equilibrium gives the wrong answer 200+500e−t/50200 + 500e^{-t/50}.)
S(t)=200+Ae−t/50500=200+Ae0  ⟹  A=300S(t)=200+300e−t/50 g\displaystyle \begin{aligned} \amount{S(t)} &= \equilibrium{200} + \amount{A}\multiplier{e^{-t/50}} \\ \amount{500} &= \equilibrium{200} + \amount{A}\multiplier{e^0} \implies \amount{A} = \amount{300} \\ \amount{S(t)} &= \equilibrium{200} + \amount{300}\multiplier{e^{-t/50}}\text{ g} \end{aligned}
2

A 400 L400\text{ L} tank holds water with an initial pollutant concentration of 0.5 g/L0.5\text{ g/L}. To flush the tank, pure water is pumped in at 8 L/min8\text{ L/min} while the well-mixed water drains out at 8 L/min8\text{ L/min}. How long does it take to reduce the pollutant concentration in the tank to 0.05 g/L0.05\text{ g/L}?

Convert the starting and target concentrations into total grams of pollutant in the 400 L400\text{ L} tank, and notice how much pollutant enters through a pure-water pipe.

Convert concentrations into grams of pollutantMultiply each concentration by the constant 400 L400\text{ L} volume to get the starting amount S(0)\amount{S(0)} and target amount.
S(0)=0.5 g/L×400 L=200 g,Starget=0.05 g/L×400 L=20 g\displaystyle \begin{aligned} \amount{S(0)} &= 0.5\text{ g/L} \times 400\text{ L} = \amount{200}\text{ g}, \\ S_{\text{target}} &= 0.05\text{ g/L} \times 400\text{ L} = 20\text{ g} \end{aligned}
Set up and solve the differential equationPure water has concentration 0 g/L\ratein{0}\text{ g/L}, so Rate In=8×0=0 g/min\ratein{\text{Rate In}} = 8 \times \ratein{0} = \ratein{0}\text{ g/min}. (Watch out: using the water flow rate 8 L/min8\text{ L/min} as Rate In\ratein{\text{Rate In}} gives dSdt=8−S50\rate{\frac{dS}{dt}} = 8 - \frac{\amount{S}}{50}, which makes the pollutant climb toward 400 g400\text{ g} instead of flushing out.)
dSdt=0−8×S400=−S50S(t)=200e−t/50\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} &= \ratein{0} - \rate{8 \times \frac{\amount{S}}{400}} = \rate{-\frac{\amount{S}}{50}} \\ \amount{S(t)} &= \amount{200}\multiplier{e^{-t/50}} \end{aligned}
Solve for tt when S(t)=20\amount{S(t)} = 20Set the pollutant equal to 20 g20\text{ g} and take the natural logarithm. (Be sure to use ln⁡(10)≈2.303\ln(10) \approx 2.303 rather than base-10 log⁡10(10)=1\log_{10}(10) = 1, which would give 50 minutes50\text{ minutes}.)
200e−t/50=20  ⟹  e−t/50=110  ⟹  −t50=−ln⁡(10)  ⟹  t=50ln⁡(10)≈115.1 minutes\displaystyle \begin{aligned} \amount{200}\multiplier{e^{-t/50}} &= 20 \\ \implies \multiplier{e^{-t/50}} &= \frac{1}{10} \\ \implies -\frac{t}{50} &= -\ln(10) \\ \implies t &= 50\ln(10) \\ &\approx 115.1\text{ minutes} \end{aligned}
3

A tank with a maximum capacity of 150 L150\text{ L} initially holds 50 L50\text{ L} of pure water. Salt water containing 3 g/L3\text{ g/L} of salt flows in at 4 L/min4\text{ L/min}, and the well-mixed solution drains out at 2 L/min2\text{ L/min}. Find the formula for the amount of salt S(t)\amount{S(t)} in the tank at time tt, and find how much salt is in the tank at the exact moment it begins to overflow.

Write the changing volume V(t)V(t) first to set up the linear differential equation, and find the time tt when V(t)V(t) reaches the 150 L150\text{ L} capacity.

Write the volume V(t)V(t) and set up the linear differential equationThe tank starts at 50 L50\text{ L} and gains 4−2=2 L/min4 - 2 = 2\text{ L/min}, so V(t)=50+2tV(t) = 50 + 2t.
dSdt=4×3−2×S50+2t=12−125+tSdSdt+125+tS=12\displaystyle \begin{aligned} \rate{\frac{dS}{dt}} &= \ratein{4 \times 3} - \rate{2 \times \frac{\amount{S}}{50 + 2t}} \\ &= \ratein{12} - \rate{\frac{1}{25 + t}}\amount{S} \\ \rate{\frac{dS}{dt}} + \rate{\frac{1}{25 + t}}\amount{S} &= \ratein{12} \end{aligned}
Find the integrating factor and integrateWith P(t)=125+t\rate{P(t)} = \rate{\frac{1}{25 + t}}, the integrating factor is M(t)=e∫125+t dt=25+t\multiplier{M(t)} = e^{\int \rate{\frac{1}{25 + t}}\,dt} = \multiplier{25 + t}.
(25+t)dSdt+S=12(25+t)  ⟹  ddt[(25+t)S]=12(25+t)(25+t)S=∫12(25+t) dt=6(25+t)2+C  ⟹  S(t)=6(25+t)+C25+t\displaystyle \begin{aligned} \multiplier{(25 + t)}\rate{\frac{dS}{dt}} + \amount{S} &= \ratein{12}\multiplier{(25 + t)} \\ \implies \rate{\frac{d}{dt}}\left[\multiplier{(25 + t)}\amount{S}\right] &= \ratein{12}\multiplier{(25 + t)} \\ \multiplier{(25 + t)}\amount{S} &= \int \ratein{12}\multiplier{(25 + t)}\,dt \\ &= 6(25 + t)^2 + C \\ \implies \amount{S(t)} &= 6(25 + t) \\ &\quad {} + \frac{C}{25 + t} \end{aligned}
Use S(0)=0\amount{S(0)} = \amount{0} to find CCPlugging in t=0t = 0 and S=0\amount{S} = \amount{0} gives CC. (With the antiderivative 6(25+t)26(25 + t)^2, S(0)=0\amount{S(0)} = \amount{0} does not make C=0C = 0; dropping the CC term leaves S(t)=6(25+t)\amount{S(t)} = 6(25 + t) and gives the wrong overflow amount of 450 g450\text{ g}. If you multiply out 12(25+t)=300+12t\ratein{12}\multiplier{(25 + t)} = 300 + 12t before integrating, as the solution film does, the antiderivative is 300t+6t2+C300t + 6t^2 + C instead, and then C=0C = 0 is right.)
0=6(25)+C25=150+C25  ⟹  C=−3750S(t)=6(25+t)−375025+t=300t+6t225+t g\displaystyle \begin{aligned} \amount{0} &= 6(25) + \frac{C}{25} \\ &= 150 + \frac{C}{25} \\ \implies C &= -3750 \\ \amount{S(t)} &= 6(25 + t) - \frac{3750}{25 + t} \\ &= \frac{300t + 6t^2}{25 + t}\text{ g} \end{aligned}
Find the overflow time and evaluate S(t)\amount{S(t)}The tank reaches 150 L150\text{ L} when V(t)=50+2t=150V(t) = 50 + 2t = 150, which is at t=50 minutest = 50\text{ minutes} (dividing the full 150 L150\text{ L} capacity by 2 L/min2\text{ L/min} without subtracting the initial 50 L50\text{ L} gives t=75 minutest = 75\text{ minutes} and 562.5 g562.5\text{ g}).
S(50)=6(25+50)−375025+50=450−50=400 g\displaystyle \begin{aligned} \amount{S(50)} &= 6(25 + 50) - \frac{3750}{25 + 50} \\ &= 450 - 50 = 400\text{ g} \end{aligned}
4

Tank A and Tank B each hold 100 L100\text{ L} of water. Tank A starts with 50 g50\text{ g} of dissolved salt, and Tank B starts with pure water. Pure water is pumped into Tank A at 5 L/min5\text{ L/min}; well-mixed water flows from Tank A into Tank B at 5 L/min5\text{ L/min}, and well-mixed water drains from Tank B at 5 L/min5\text{ L/min}. Let x(t)\amount{x(t)} and y(t)\secondamount{y(t)} be the grams of salt in Tank A and Tank B at time tt. Write the system of differential equations for dxdt\rate{\frac{dx}{dt}} and dydt\rate{\frac{dy}{dt}}, and solve for both x(t)\amount{x(t)} and y(t)\secondamount{y(t)}.

Set up each tank with Rate In−Rate Out\ratein{\text{Rate In}} - \rate{\text{Rate Out}}, solve Tank A's equation for x(t)\amount{x(t)} first, and substitute that function into Tank B's equation to get a first-order linear differential equation for y(t)\secondamount{y(t)}.

Write the differential equations for Tank A and Tank BBoth tanks stay at a constant 100 L100\text{ L}, and Tank A's Rate Out (5×x100=x20\rate{5 \times \frac{\amount{x}}{100}} = \rate{\frac{\amount{x}}{20}}) becomes Tank B's Rate In.
dxdt=0−5×x100=−x20,x(0)=50dydt=x20−5×y100=x20−y20,y(0)=0\displaystyle \begin{aligned} \rate{\frac{dx}{dt}} &= \ratein{0} - \rate{5 \times \frac{\amount{x}}{100}} \\ &= \rate{-\frac{\amount{x}}{20}}, &\quad \amount{x(0)} &= \amount{50} \\ \rate{\frac{dy}{dt}} &= \rate{\frac{\amount{x}}{20}} - \rate{5 \times \frac{\secondamount{y}}{100}} \\ &= \rate{\frac{\amount{x}}{20}} - \rate{\frac{\secondamount{y}}{20}}, &\quad \secondamount{y(0)} &= \secondamount{0} \end{aligned}
Solve Tank A for x(t)\amount{x(t)} and substitute into Tank BTank A is a simple exponential decay with x(0)=50\amount{x(0)} = \amount{50}.
x(t)=50e−t/20 gdydt=50e−t/2020−y20  ⟹  dydt+120y=52e−t/20\displaystyle \begin{aligned} \amount{x(t)} &= \amount{50}\multiplier{e^{-t/20}}\text{ g} \\ \rate{\frac{dy}{dt}} &= \rate{\frac{\amount{50e^{-t/20}}}{20}} - \rate{\frac{\secondamount{y}}{20}} \\ \implies \rate{\frac{dy}{dt}} + \rate{\frac{1}{20}}\secondamount{y} &= \rate{\frac{5}{2}e^{-t/20}} \end{aligned}
Solve Tank B's linear equation with the integrating factor M(t)=et/20\multiplier{M(t)} = \multiplier{e^{t/20}}Multiply every term by et/20\multiplier{e^{t/20}}. (Notice that on the right side, et/20⋅e−t/20=e0=1\multiplier{e^{t/20}} \cdot e^{-t/20} = e^0 = 1; adding the exponents with the wrong sign to get e−t/10e^{-t/10} leads to the wrong answer 25e−t/20−25e−3t/2025e^{-t/20} - 25e^{-3t/20}.)
et/20dydt+120et/20y=et/20⋅52e−t/20=52ddt[et/20y]=52  ⟹  et/20y=52t+C  ⟹  y(t)=52te−t/20+Ce−t/20\displaystyle \begin{aligned} \multiplier{e^{t/20}}\rate{\frac{dy}{dt}} + \rate{\frac{1}{20}}\multiplier{e^{t/20}}\secondamount{y} &= \multiplier{e^{t/20}} \cdot \rate{\frac{5}{2}e^{-t/20}} \\ &= \frac{5}{2} \\ \rate{\frac{d}{dt}}\left[\multiplier{e^{t/20}}\secondamount{y}\right] &= \frac{5}{2} \\ \implies \multiplier{e^{t/20}}\secondamount{y} &= \frac{5}{2}t + C \\ \implies \secondamount{y(t)} &= \frac{5}{2}te^{-t/20} \\ &\quad {} + Ce^{-t/20} \end{aligned}
Use y(0)=0\secondamount{y(0)} = \secondamount{0} to find CCSubstituting t=0t = 0 and y=0\secondamount{y} = \secondamount{0} gives C=0C = 0.
y(t)\displaystyle \secondamount{y(t)} =52te−t/20 g\displaystyle = \frac{5}{2}te^{-t/20}\text{ g}