Suppose that we have a system consisting of two interconnected tanks, each containing a brine solution. Tank A contains

x(t) pounds of salt in 200 gallons of brine, and tank B contains

y(t) pounds of salt in 300 gallons of brine. The mixture in each tank is kept uniform by constant stirring. When t = 0, brine is pumped from tank A to tank B at 20 gallons/minute and from tank B to tank A at 20 gallons/minute. Find the amount of salt in each tank at time t if x(0) = 10 and y(0) = 40.

Verified Answer :

First notice that neither tank will change in total gallons at any time.
The pump is just mixing the water among the 2 tanks continuously. So eventually the concentration in each tank will be the same as concentration of both tanks put together.
Total gallons = 500,  Total Salt = 50
Concentration = 50/500 = 1/10
If tank A has this concentration , then salt = 20
For tank B the salt amount is then 30.
This gives us 2 points, an initial amount and a finishing amount as t -> infinity.

To find functions for x(t) and y(t) , we need to look at the rate of change.
\(Rate = R_{in} - R_{out}\)
For tank A, 20/300 or 1/15 of tank B salt is coming in. While 20/200 or 1/10 of its own salt is leaving.
For tank B its just the other way around.
This will give a system of 2 differential equations:
\(\frac{dx}{dt} = \frac{y}{15} - \frac{x}{10}\)
\(\frac{dy}{dt} = \frac{x}{10} - \frac{y}{15}\)
From this we can say:
\(\frac{dy}{dt} = -\frac{dx}{dt}\)
\(y = -x+C\)
Plug this in for y in the dx/dt equation: 
\(\frac{dx}{dt} = \frac{-x+C}{15} -\frac{x}{10} = -\frac{x+C}{6}\)
Solving this differential equation gives:
\(\int \frac{dx}{x+C} = \int -\frac{dt}{6}\)
\(\ln (x+C) = -\frac{t}{6} +k\)
\(x = k e^{-t/6} +C\)
The dy/dt equation is solved exactly the same way, so you have:
\(y = k e^{-t/6} +C\)
All thats left is to apply initial and final conditions to get constants.
The final solution is:
\(x(t) = -10e^{-t/6}+20\)
\(y(t) = 10e^{-t/6}+30\)