Help setting up a differential equation with rate in - rate out I'm in a differential equations class and I am not getting it. It's been over a year since any calculus classes and I am struggling to set up the following problem. If some one can explain to me the process of setting it up I would appreciate it. 
Problem:
A 400-gal tank initially contains 100 gallons of brine containing 50 lbs of salt. Brine containing 1 lb of salt per gallon enters the tank at a rate of 5 gal/s, and the well-mixed brine in the tank flows out at the rate of 3 gal/s. How much salt will be in the tank when it is full of brine? 
My set-up so far:
I know that Q(t) = rate in - rate out. I set up the problem to be:
 (dQ/dt) = 5 - 3(Q(t))

But when I solved it I got for the general solution:
 My integrating factor: u = e^(3t)
 50 - (5/3) = C

That doesn't look right. 
If someone can tell me how to set up the problem correctly and explain why that would be awesome. Thank you!
 A: I would split the problem into two parts, since the salt in the tank is independent of the water in the tank. Call the total liquid in the tank $L$, and the total salt in the tank $S$. We are given that $L(t) = 100 + 2t$, and we are trying to find $S$. We are given that the tank is well-mixed, so the proportion $\frac{S(t)}{L(t)}$ will tell us the salt content at any point in time. Since $5$ gallons exit the tank, $5\frac{S(t)}{L(t)}$ lbs of salt exit the tank, and we are given that $1$ lb of salt enters the tank every second. Therefore, we have the following relation:
$$S'(t) = 1 - 5\frac{S(t)}{L(t)} = 1-5\frac{S(t)}{100+2t}$$
And now we can solve normally, using $S(0)=50$ to find $S(V^{-1}(400))=S(\frac{400-100}{2})=S(150)$.
As a problem solving tip, it always helps to define functions explicitly; not doing so can lead to mistakes. Take, for example, your $Q(t)$ function. What exactly is that function a measure of with respect to time? It cannot be salt content, as $5$ units of it is considered the "rate-in", rather than $1$. Could it represent the volume? No, since the "rate-out" is $3Q(t)$ instead of $3$. Make sure you understand what every function you define really is, so you can check that relations you build from it make logical sense.
A: You have 100 gal of brine with 50 lbs of salt, so V0 = 100 gal, Q0 = 50 lbs.
We know that 5 gal is entering per second, and 3 gal is exiting, so to find the total volume in the tank: 
$V=100+\left( V_{in}-V_{out} \right)t=100+\left( 3-2 \right)t$ 
where t is time in seconds, so at any time t:
$$V=100+2t$$
concentration = C = $\frac{Q}{V}$
$Q=\mbox{C}\cdot V$ and we can also take this as a rate:
$$\frac{dQ}{dt}=\mbox{C}\cdot \frac{dV}{dt}$$
So basically if $V_{in}=$ 5 gal flows in every second, with a concentration of 1 lb per gallon, then $Q_{in}=$ 5 lb flows in every second.
And if we also have a $V_{out}=$ 3 gal that flows out from the tank every second, with a concentration of Q/V (we don’t know the concentration here, but it’s the concentration of the tank), where Q is the total salt in the tank and V is the total volume (since we’re flushing out solution from the tank), then
$Q_{out}=\mbox{C}\cdot V_{out}=\frac{Q}{V}\cdot 3=\frac{3Q}{100+2t}$ lbs of salt flows out every second.
Now we subtract the two rates:
$$\frac{dQ}{dt}=5-\frac{3Q}{100+2t}$$
I think many people get confused with the Qout part, you need to know that Qout≠Q and Vout≠V (in context). Here we don't know the concentration as with Qin, but we do know that the concentration is that of the tank (since we ARE taking out volume from the tank), so we can take the concentration as Q/V, and then we multiply that by how much volume is going out (Vout) to get Qout every second.
