Please check my solution for this rate of change problem Problem: Suppose we have a rigid container of fixed volume, which is filled with air.  At one end of the container we insert a nozzle and start filling with helium, and the other end of the container has a hole where the mixed gases can exit (contents are not under pressure).  If the volume of the container is $V$ litres, and the rate of injecting helium is $r$ litres/second, what proportion of the total container gas is helium, after $t$ seconds?
Based on the assumption that gases mix uniformly upon entering the container, I came up with this:
At every time interval $dt$, if the current proportion of helium is $p$, then the total volume of helium is $pV$.  After $dt$ seconds, $rdt$ litres of helium enter, and $prdt$ litres exit.  So the new volume would be:
$pV + rdt - prdt$
And the new percentage would be:
${pV + rdt - prdt}\over{V}$
If we say $R = r/V$, we have:
$p' = p + Rdt - pRdt$
So we have:
${{dp}\over{dt}} = R-pR $
Integrating both sides, we get
$p = Rt - pRt + C$, and C=0 because at t=0, we know that p=0
$p  (1 + Rt) = Rt$
$p = { {Rt}\over{1+Rt} }$
Is that correct?  I'm not sure about the integration step, because we have dp on the left side of the equation and p on the right side.  Is that okay?
 A: Your answer is almost correct, though as you point out you can't easily integrate until the different variables $(p,t)$ are on different sides of the equation. The reason is that the proportion $p$ is actually a function of $t$, and so when we integrate
\begin{align*}
\int r[1- p(t)]dt &= r\int (1-p(t))dt & \neq r(1-p)t
\end{align*}
So the only adjustment I would make is in that step, grouping different variables on different sides of the equation to make it clearer. Here's one way to do it. 
Let $H$ represent the volume of helium. 
The volume of helium at one particular instant is $pV$. You correctly determine that the volume in the next instant will be $pV + r\,dt - pr\,dt$. Hence the change in volume of helium is
$$\begin{align*}
d H &= (pV +r\,dt - pr\,dt)-pV &= r(1-p)\,dt 
\end{align*}$$
so the change in proportion of helium is 
$$\begin{align*}
d p = \frac{d H}{V} &= \frac{r(1-p)\,dt}{V} = (1-p)R\,dt 
\end{align*}$$
which we can rearrange as
\begin{align*}
\frac{1}{1-p}dp &= R \cdot dt
\end{align*}
This is called a separable differential equation, because we can put the different variables $(p, t)$ on separate sides of the equation. To solve, we integrate each side separately:
\begin{align*}
\int \frac{1}{1-p}dp &=  \int R \cdot dt\\
-\log(1-p) &= Rt + C\\
1 - p &= \exp{(-C)} \exp{(-Rt)}\\
(p - 1) &= -A\exp(-Rt) & \{A \equiv \exp{(-C)}\}\\
p &= 1 - A\cdot \exp{(-Rt)}
\end{align*}
And from our initial condition that $p(t=0)=0$, we find that $A=1$ so
$$p(t) = 1-\exp{(-Rt)}$$
