# First Order DE mixing problem

So for my homework I've gotten an incorrect answer on this problem 3 times in a row. Here's an overview of my work

A large tank holds 250 liters of water with a salt concentration of 7 grams per liter. A brine solution containing 3 grams per liter is added to the tank at a rate of 9 liters per minute. The well-mixed solution is pumped out of the tank at a rate of 5 liters per minute.

How much salt is in the tank after 15 minutes? Enter your answer to the nearest 0.0001 grams.

\begin{align*} S(t)&= \text{concentration of salt as a function of time.}\\ S'&=27-\left(\frac{5S}{250+4t}\right)\\ I&=(250+4t)^5\\ [S(250+4t)^5]'&=27(250+4t)^5\\ S(250+4t)^5&=\frac{9}{8}(250+4t)^6+C\\ S&=\frac{\frac{9}{8}(250+4t)+C}{(250+4t)^5}\\ S(0)&=1750=\frac{\frac{9}{8}(250)+C}{(250)^5}\\ C&=1468.75(250)^5\\ S(15)&=\frac{\frac{9}{8}(250+4(15))+1468.75(250)^5}{(250+4(15)^5}\\ S(15)&=849.7520 \end{align*}

-
Arturo, thanks for cleaning that up. In the future, how do I format in that style? –  Ocasta Eshu Apr 5 '11 at 3:02
@Andrin: what is $I$? –  picakhu Apr 5 '11 at 3:02
@Andrin: learn $\LaTeX$ –  picakhu Apr 5 '11 at 3:03
Your formula for $S'$ is incorrect: every minute, you add 9 liters and you drain 5 liters, so there is a net gain of 4 liters per minute. So at time $t$, the amount of liquid in the tank is 250+4t gallons, not 250-4t. –  Arturo Magidin Apr 5 '11 at 3:04
picakhu: I believe it stands for Identity function. It is e of the integral of the coefficient of Y [A in this case]. Then you multiply both sides of the equation by I so you get. IY'+ I'Y = CI which simplifies to (IY)'=CI. In this case e^5ln(250+4t) goes to (250+4t)^5 –  Ocasta Eshu Apr 5 '11 at 3:07

This is a pretty standard "mixing problem." You went wrong in a couple of places:

• Your set-up for $S'(t)$ has a wrong sign. (This get spontaneously "fixed" later on, which suggests and error in copying somewhere).
• But more seriously: Your integrating factor is incorrect.

You start pretty well: if we let $S(t)$ be the amount of salt (in grams) in the tank at time $t$ ($t$ measured in minutes). (Note, $S(t)$ is the amount, not the concentration; your formulas clearly view $S$ as the amount, not the concentration; see Pickahu's set-up if you want to use the concentration instead).

In these problems, the amount of salt at any given time is changing by the formula $$\frac{dS}{dt} = \binom{\text{rate}}{\text{in}} - \binom{\text{rate}}{\text{out}}.$$ And the initial condition $S(0)$ depends on the problem.

The initial condition is simple enough: you are told there are 250 liters of water, with a salt concentration of 7 grams per liter. So $$S(0) = \left(250\ \text{liters}\right)\left(7\ \frac{\text{grams}}{\text{liter}}\right) = 1750\ \text{grams of salt.}$$

What about the rates in and out? We are adding 9 liters per minute, each liter containing 3 grams of salt. That is, the rate in is: $$\text{rate in} = \left(3\frac{\text{grams}}{\text{liter}}\right)\left(9\frac{\text{liters}}{\text{minute}}\right) = 27\frac{\text{grams}}{\text{minute}};$$

What is the rate out? We are letting out 5 liters per minute; each liter will have as much salt as the concentration at time $t$. The concentration at time $t$ is given by the amount of salt at time $t$, which is $S(t)$, divided by the amount of liquid at time $t$.

From the moment we start with $250$ liters, each minute you add $9$ liters and you drain $5$ liters, for a net total addition of $4$ liters per minute. So at time $t$, the total amount of liquid in the tank is $250+4t$. So the concentration of salt at time $t$ is $$\frac{S(t)}{250+4t}\ \frac{\text{grams}}{\text{liter}}.$$

Since we are draining five liters at this concentration, we have that $$\text{rate out} = \left(5\ \frac{\text{liters}}{\text{minute}}\right)\left(\frac{S(t)}{250+4t}\ \frac{\text{grams}}{\text{liter}}\right) = \frac{5S(t)}{250+4t}\ \frac{\text{grams}}{\text{minute}}.$$

So the differential equation we need to solve is: $$\frac{dS}{dt} = 27 - \frac{5S}{250+4t}.$$

Writing this in the standard form, we have $$S' + \frac{5}{250+4t}S = 27.$$ We need an integrating factor. Letting $\mu(t)$ stand for this factor, multiplying through we have $$\mu(t)S' + \frac{5\mu(t)}{250+4t}S = 27\mu(t)$$ and we want to realize the left hand side as the derivative of a product; that is, we want $$\mu'(t) = \frac{5\mu(t)}{250+4t}.$$ Separating variables we have \begin{align*} \frac{\mu'(t)}{\mu(t)} &= \frac{5}{250+4t}\\ \int\frac{d\mu}{\mu} &= \int \frac{5\,dt}{250+4t}\\ \ln|\mu| &= \frac{5}{4}\ln|250+4t| + C\\ \mu(t) &= A(250+4t)^{5/4} \end{align*} Picking $A=1$, we can take $\mu(t) = (250+4t)^{5/4}$. (Another error in your computation).

That is, we have: $$(250+4t)^{5/4}S' + \frac{5(250+4t)^{5/4}}{250+4t}S = 27(250+4t)^{5/4}$$ or $$(250+4t)^{5/4}S' + 5(250+4t)^{1/4}S = 27(250+4t)^{5/4}$$ which can be written as $$\Bigl( (250+4t)^{5/4}S\Bigr)' = 27(250+4t)^{5/4}.$$

You might benefit from writing out the derivations very carefully (as I did above) rather than trying to rely on formulas (I assume that's how you tried to obtain your integrating factor $I$, which was mistakenly computed).

Can you take it from here? Careful with the integral on the right hand side.

-
I think for this problem, it is more meaningful to write the equation accumulation=in-out. And then explain the terms. That way it is not a mechanical calculation problem, but a concept problem. –  picakhu Apr 5 '11 at 3:54
@picakhu: Good point; edited to include that derivation. –  Arturo Magidin Apr 5 '11 at 4:08
thank you. in the examples we went over in class, t did not have a constant. that definitely did me in. I have a DE test tomorrow, so I appreciate your help. The TA's were stumped. –  Ocasta Eshu Apr 5 '11 at 4:44
@Andrin: I don't understand what you mean by "$t$ did not have a constant." $t$ is the variable, it stands for time. –  Arturo Magidin Apr 5 '11 at 4:49
in the examples worked in class. the difference between output and input was 1. so the problem looked like S'=27-5S/(250-t). This made the integration much simpler. –  Ocasta Eshu Apr 5 '11 at 14:54

I will attempt to give an alternative way to think about this problem, that will make it easier in the future for you. I will not finish the question.

First, note that the accumulation of salt is the amount of salt coming in minus the amount of salt leaving. So, we get that

$$\mathrm{Accumulation}=\mathrm{Salt \, in}-\mathrm{Salt \, out}$$

So, which this we try and formulate the equation

$$\mathrm{Volume} \frac{d}{dt} \mathrm{Concentration \, of \, Salt} = \mathrm{flowrate \, in \times concentration \, in} - \mathrm{flowrate \, out \times concentration \, out}$$

Then, we can get that $$\frac{d(250+4t)S}{dt} = 9 \times 3 - 5 \times S$$

The rest should be easy.

-
@picakhu: The OP is considering $S$ the amount of salt (though he calls it the "concentration"); you might want to specify explicitly that you are using $S$ for the concentration (in grams/liter), or use a different letter... –  Arturo Magidin Apr 5 '11 at 4:22
Thanks, changed. –  picakhu Apr 5 '11 at 4:41
@Arturo: the OP specifically said that S is concentration. –  picakhu Apr 5 '11 at 4:43
@picakhu: Yes, you'll notice I mentioned that, so it's not like I did not notice. And then, if you see his formula, you'll see that even though he calls it the "concentration", he is really using it as the amount, not the concentration. So either he misspoke when he called the "concentration", or else he set everything up completely wrongheadedly. Either way, I thought it would be good to point that out somehow, rather than simply go ahead and use $S$ to represent something other than what the OP actually used it for without a word to explain the radical difference in equation. –  Arturo Magidin Apr 5 '11 at 4:51
@picakhu: Also, since the volume is not fixed at $250$ liters, can you really set it up like this? The amount of salt at time $t$ is not $250S$, it's $(250+4t)S$. So shouldn't the way the amount of salt is changing be $\frac{d}{dt}((250+4t)S) = 9\times 3 - 5\times S$? –  Arturo Magidin Apr 5 '11 at 4:56