[Math] 3 tank mixing problem

linear algebraordinary differential equations

There are 3 tanks filled to capacity with fresh water, all with a 100 liter capacity. At t=0, brine with .5 kg/l salt concentration flows into tank 1 at a 3 l/min rate. The other flows are:
tank 1 -> tank 2 at 4 l/min,
tank 1 -> tank 3 at 3 l/min,
tank 2 -> tank 1 at 2 l/min,
tank 2 -> tank 3 at 2 l/min,
tank 3 -> tank 1 at 2 l/min,
tank 3 -> tank 2 at 0 l/min,
and excess water leaves tank 3 -> ocean at 3 l/min.

I am supposed to write the system of equations in matrix form and I have figured it all out except how to place the constant brine flow into the matrix format. So far my matrix looks like this:

$\begin {bmatrix}-.07&.02&.02\\ .04&-.04&0\\ .03&.02&-.05\end {bmatrix}$ $\begin {bmatrix}x1\\ x2\\ x3\end {bmatrix}$

Any help on placing that constant brine flow is much appreciated.

Best Answer

You can add a fourth line to your matrix, representing "tank 4" which is really the outside world. Why are the values in your matrix so small instead of being the single digit whole numbers of the problem?

Added: OK, I see that. So presumably you start with pure water in the tanks and are trying to calculate the salt concentration as a function of time. Now the matrix multiply is making sense-let $x_1,x_2,x_3$ be kg of salt in each tank. One equation would be $x_1'=1.5-0.07x_1+0.02x_2+0.02x_3$ so putting the outflows on the diagonal is correct. You should just add a column vector which is the input from the outside world, getting $$\begin {bmatrix} x_1'\\x_2'\\x_3'\end {bmatrix}= \begin {bmatrix}-.07&.02&.02\\ .04&-.04&0\\ .03&.02&-.05\end {bmatrix}\begin {bmatrix}x1\\ x2\\ x3\end {bmatrix}+\begin {bmatrix}1.5\\ 0\\ 0\end {bmatrix}$$