$$\frac{d\vec{p}}{dt}=m_r\frac{d\vec{v}_r}{dt}+\vec{v}_r\frac{d\vec{m}_r}{dt}+m_g\frac{d\vec{v}_g}{dt}+\vec{v}_g\frac{d\vec{m}_g}{dt}$$
The total momentum of the system is constant. The change in mass of the gas is equal and opposite to the change in the mass of the rocket. Also, the velocity of the exhaust gas does not change:
$$0=m_r\frac{d\vec{v}_r}{dt}+\vec{v}_r\frac{d\vec{m}_r}{dt}+0-\vec{v}_g\frac{d\vec{m}_g}{dt}$$
Why doesn't the velocity of the gas change? i know that when the gas has left the nozzle it remains at ##v_r##, but what confuses me is whether we use an inertial frame or not, because in respect to the laboratory, the inertial frame, every second the gas has a different velocity (in respect to the rocket it has a constant, ##v_r##, velocity).
And from when do we start counting when we consider ##\frac{d\vec{m}_g}{dt}## and ##m_g##? do we weigh all the gas that was shot from the beginning or do we look at a short interval of time?