Solution (source code)

= Solution

The undisturbed gas has $u=0$, $c=c_0$, and hence $R_-=0$. The disturbance from the receding piston is a right-moving <simple wave>, so this invariant remains zero throughout it:
$$
c=c_0+\frac{\gamma-1}{2}u,
\qquad
\rho=\rho_0\left(1+\frac{\gamma-1}{2c_0}u\right)^{2/(\gamma-1)}.
$$

Let $s$ be the time at which the relevant $C_+$ characteristic leaves the piston. The boundary condition is $u=\dot X_p(s)$ there. Both $u$ and $c$ are constant along this characteristic, whose speed is
$$
u+c=c_0+\frac{\gamma+1}{2}\dot X_p(s).
$$
Hence $s=s(x,t)$ is determined implicitly by the <receding-piston rarefaction wave> equation
$$
\boxed{x=X_p(s)+\left[c_0+\frac{\gamma+1}{2}\dot X_p(s)\right](t-s).}
$$
Within $X_p(t)<x<c_0t$, the solution is therefore
$$
\boxed{u(x,t)=\dot X_p(s(x,t)),}
$$
$$
\boxed{\rho(x,t)=\rho_0
\left[1+\frac{\gamma-1}{2c_0}\dot X_p(s(x,t))\right]^{2/(\gamma-1)}.}
$$
For $x\geq c_0t$, the gas remains undisturbed: $u=0$ and $\rho=\rho_0$. The speed bound keeps $c$ and $\rho$ positive, and monotonic increase of $|\dot X_p|$ makes this an expanding <rarefaction wave> rather than a characteristic-crossing compression.