Solution (source code)

= Solution

For the <angularly resolved molecular arrival flux>, let $f(v)$ be normalized by $\int_0^\infty f(v)\,dv=1$. Isotropic velocity directions have probability $d\Omega/(4\pi)$. Integrating over azimuth gives $(1/2)\sin\theta\,d\theta$, while the speed normal to a stationary piston is $v\cos\theta$. For incident directions $0\leq\theta\leq\pi/2$, the arrival flux is therefore
$$
\boxed{d\Gamma=\frac12nf(v)v\cos\theta\sin\theta\,d\theta\,dv.}
$$
An elastic collision transfers normal momentum $2mv\cos\theta$ to the piston. Integrating the momentum flux gives
$$
p=nm\int_0^\infty v^2f(v)\,dv\int_0^{\pi/2}\cos^2\theta\sin\theta\,d\theta=\boxed{\frac13nm\langle v^2\rangle}.
$$
No specific Maxwellian speed distribution was needed for this isotropic kinetic-<pressure> identity.

Use the figure's $+x$ direction toward the piston and let its inward speed $u>0$ mean piston velocity $-u\hat{\mathbf x}$. For <reflection from a translating planar piston>, in the piston frame the incoming normal velocity is $v_x+u$. Elastic reflection reverses it, and transforming back gives
$$
\boxed{(v_x,v_y,v_z)\longmapsto(-v_x-2u,v_y,v_z).}
$$
The exact kinetic-energy change in this ideal massive-piston model is $\Delta K=2muv_x+2mu^2$. Thus, to first order in the small piston speed,
$$
\boxed{K_{\rm after}=K_{\rm before}+2muv_x+O(u^2).}
$$
The <first-order collision-flux approximation for a slow piston> applies: the incident collision flux changes at order $u$, but its product with the order-$u$ energy increment changes the energy rate only at order $u^2$. Hence one may use the stationary flux at leading order. For piston area $S$,
$$
\frac{dU}{dt}=S\int(2muv\cos\theta)\,d\Gamma=\frac13Snmu\langle v^2\rangle=\boxed{pSu=-p\frac{dV}{dt}.}
$$
Here $dV/dt=-Su$. This <compression work from molecular impacts>, with no <heat> flow, is the first law for work done on the gas by compression. The derivation assumes $u$ small compared with thermal speeds and an approximately isotropic distribution at the piston; rapid compression can produce nonequilibrium <pressure> and higher-order corrections.