Solution (source code)

= Solution

Let $u_e>0$ be the constant rearward <rocket exhaust speed>, and let $\mathcal M$ denote the rocket's instantaneous <mass>. Apply <momentum conservation> over a short ejection interval: the remaining rocket gains $\mathcal M\,dv$, while the expelled positive mass $-d\mathcal M$ carries backward relative momentum $u_e\,d\mathcal M$. To first order,
$$
\mathcal M\,dv=-u_e\,d\mathcal M.
$$
Integrating gives the <rocket equation>
$$
\boxed{\Delta v=u_e\ln\frac{M}{M-m}.}
$$
This is a <velocity> increment, measured along the thrust direction, for motion in free space without external <forces>.

For the two-stage vehicle, take $M_1$ and $M_2$ to be the initial masses of the respective stages, each including its fuel $m$. The first burn changes the total mass from $M_1+M_2$ to $M_1+M_2-m$. Discarding the empty first-stage shell of mass $M_1-m$ leaves mass $M_2$; ideal jettison without a relative impulse does not change the <velocity>. The second burn then changes $M_2$ to $M_2-m$. Adding the two <rocket equation> increments gives
$$
\boxed{\Delta v_{\mathrm{two}}=u_e\ln\frac{M_1+M_2}{M_1+M_2-m}+u_e\ln\frac{M_2}{M_2-m}.}
$$
Here $M_1>m$ and $M_2>m$ leave positive dry masses. Different stage exhaust speeds would multiply their respective logarithms. A <multistage rocket> gains its advantage by avoiding acceleration of the spent first-stage shell during the second burn.