Solution (source code)

= Solution

Use $x^\mu=(ct,x,y,z)$ and metric signature $(+,-,-,-)$. Since $d\tau=dt/\gamma$, the <four-velocity> and <four-momentum> are
$$
U^\mu=\gamma(c,\mathbf v),\qquad p^\mu=M U^\mu=(\gamma Mc,\gamma M\mathbf v)=(E/c,\mathbf p),\qquad \gamma=(1-v^2/c^2)^{-1/2}.
$$
These use the <proper time> and <Lorentz factor>; the <mass shell> identity is $E^2-c^2|\mathbf p|^2=M^2c^4$.

Initially the parent <four-momentum> is $(Mc,\mathbf0)$. By <four-momentum conservation>, the remaining single particle has energy $Mc^2-E$ and three-momentum $-\mathbf p$. Applying its <mass shell> identity gives $m^2c^4=(Mc^2-E)^2-c^2|\mathbf p|^2$, hence
$$
\boxed{m=\sqrt{\left(M-\frac{E}{c^2}\right)^2-\frac{|\mathbf p|^2}{c^2}}.}
$$
The positive root is selected for the rest mass; physically admissible decay data also give nonnegative remaining energy.