# Equation for dye in pool

I recently began my first course in intro do ordinary differential equations. The textbook recommended for the class is "Elementary Differential Equations and Boundary Value problems, 10th edition" by Boyce and DiPrima.

I also have the solutions manual, but not all questions are worked in it.

There is one question near the start that I decided the work, and it wasn't in the back so I thought people here could share their input.

I will write the problem, then explain what I have done so far. I am not sure if it is correct however, or if I am making some mistakes.

Your pool containing $60\,000$ gallons of water is contaminated by $5\,\rm kg$ of a non-toxic dye. The filtering system can take water from the pool, remove the dye and return the clean water at a rate of $200\,\rm gal/min$.

It then asks a variety of questions, such as, write an initial value problem, is the system capable of removing enough dye such that the concentration is less than $0.02\,\rm g/gal$ within $4$ hours, find the time $T$ at which is first is $0.02\,\rm g/gal$, and lastly the flow sufficient to achieve the concentration of $0.02\,\rm g/gal$ in $4$ hours.

What I did so far;

Let $q(t)$ be the amount of dye present at time $t$.

The original concentration of the dye is

$$q(0)=\frac{5\,\rm kg}{60\,000\,\rm gal}\quad\text{or}\quad q(0)=8.33\cdot 10^{-2}\,\rm g/gal$$

The filter is capable of removing the dye at $t=0$ of a rate calculated by the product of this initial concentration by $200\,\rm gal/min$, that is,

$$16\frac{\rm g}{\rm min}$$

But after this I know I need to calculate it as

$$\frac{dq}{dt}$$

I am not sure the best way, I'm thinking along the lines of, the volume of the pool is not changing so the flow of chemical out at time $t$ would be equal to $200\,\rm gal/min$ $(q(t)/60\,000\,\rm gal)$

I was thinking also that since no new dye is being added, it may just be something like

$$8.33\cdot 10^{-2}-\left[\left(200\frac{\rm gal}{\rm min}\right)\left(\frac{q(t)}{60\,000\,\rm gal}\right)\right]$$

But I am having a bit of trouble formulating this. Is it on the right track at least? Thank you for reading and taking any time to help or respond.

• For future reference, use \times or \cdot for multiplication. If you use "x" it can be confused for a variable as opposed to an operation. $8.33\times 10^{-2}$ or $8.33\cdot 10^{-2}$ rather than $8.33x10^{-2}$. May 4, 2015 at 22:12

This is a classic example of the Brine-Solution problem (where instead of salt and water, it is colored dye and water).

Let $A(t)$ be the amount (in terms of weight) of the dye in the water, and $q(t)$ be the concentration (in terms of weight/volume) of the dye in the water.

The common equation to lean towards in a system like this is:

$$\frac{dA(t)}{dt} = \text{DyeRate}_{in} - \text{DyeRate}_{out}$$

Looking more carefully at what it means for the rate at which dye enters or leaves the system, this continues to expand to:

$$\frac{dA(t)}{dt} = \text{MixRate}_{in}\cdot\text{MixConc}_{in} - \text{MixRate}_{out}\cdot\text{MixConc}_{out}$$

where $\text{MixRate}_{in}$ is the rate at which the dye-water mixture flows into the system and $\text{MixConc}_{in}$ is the concentration of the dye-water mixture on its way into the system. (In your specific example, the water entering the system is pure). From here out I will simplify notation, referring to $R_{in}, C_{in}, R_{out}, C_{out}$, where these are referring to the water+dye rates.

In more complicated problems, the volume need not stay constant, so we need to account for that when coming up with a generalized formula. Looking at the term $C_{out}$ more carefully, the concentration going out depends on how much weight of dye (or salt) there is compared to the current volume. The volume varies based on how much is going in compared to how much is going out. Letting $V(t)$ represent volume, you find $V(t) = V(0)+R_{in}t - R_{out}t$.

The final version of the formula then would be (assuming inflow/outflow rates are constant and inflow concentration is constant):

$$\frac{dA(t)}{dt} = R_{in}C_{in} - R_{out}\frac{A(t)}{V(0)+R_{in}t-R_{out}t}$$

To convert this to a differential equation in terms of concentration with variable volume, it would be $$\frac{dq(t)}{dt}=\frac{d}{dt}\left[\frac{A(t)}{V(t)}\right]$$ which can be simplified via the quotient rule of calculus. In our case, $V(t)$ remains constant, so it can be pulled out as a scalar.

For your specific example, let us parse the word problem for the important information: $R_{in}=200\frac{gal}{min}, R_{out}=200\frac{gal}{min}, C_{in}=0g, V(0)=60000gal, A(0)=5kg$ for the equation:

$$\frac{dA(t)}{dt} = 200\cdot 0 - 200\cdot\frac{A(t)}{60000+200t-200t} = -200\frac{A(t)}{60000}$$

Converting to a differential equation about concentration then:

$$\frac{dq(t)}{dt} = \frac{d}{dt}\left[\frac{A(t)}{V(t)}\right] = -200\frac{A(t)}{60000^2}=-200\frac{q(t)}{60000}$$

with initial value: $A(0) = 5kg, q(0) = \frac{5kg}{60000gal}$

To complete the problem, note that this is a separable first order differential equation of the form $\frac{df}{dt} = \alpha f$ which (loosely) becomes $\frac{1}{f}df = \alpha dt$ and by integrating $\ln (f) = \alpha t + C$, simplifying to $f = e^{\alpha t}\cdot K$ where $K=e^C$ is some arbitrary constant determined by the initial value.

It should just be

$$\frac{dq}{dt}=-\frac{200}{60000}q$$

since as you said, no dye is added. That $8.33\times 10^{-2}$ is already included in the initial condition. Also notice your $q$ is the amount of dye, so you don't need to calculate its concentration for the initial condition. The initial condition is $q=$ "the original amount of dye".

Assume the concentration is uniformly distributed, and remains uniformly distributed as the pool is filtered. Write a DE for the change (reduction) in the concentration C(t) over time $$\frac {dC} {dt}=-fC$$ where $f$ is the amount filtered out each minute ($f$ = 200/60000 = 1/300). The solution to this DE is $$C(t)=Ae^{-ft}$$ where A is a constant determined by the initial conditions; i.e. A is the initial concentration (A = 5000 g/60000 gal = 0.0825 g/gal).

After four hours (240 minutes) the concentration is $$C(t)=0.0825e^{-240/300}=0.037 g/gal$$ Time to achieve 0.02 g/gal is $$0.02=0.0825e^{-t/300}$$ and solving for $t$ gives 425 minutes.

Finally, what is the flow rate required to give a 0.02 g/gal concentration after 240 minutes (4 hours)? Again, use $$0.02=0.0825e^{-f240}$$ which yields for $f$ a value of 0.0059 grams/gallon removed per minute. Recall, that removal rate is f = N gal/min divided by 60,000 gallons so the flow rate N needs to be 354 gallon/minute to achieve desired concentration in 240 minutes.