Solution (source code)

= Solution

For a simple homogeneous thermodynamic system, <internal energy> is extensive: $E(\lambda S,\lambda V,\lambda N)=\lambda E(S,V,N)$. <Euler theorem for homogeneous functions> and $dE=T\,dS-p\,dV+\mu\,dN$ give $E=TS-pV+\mu N$, hence
$$
\boxed{G=E+pV-TS=\mu N.}
$$
Also $dG=-S\,dT+V\,dp+\mu\,dN$, so at fixed $T,N$,
$$
\boxed{\left(\frac{\partial\mu}{\partial p}\right)_{T,N}=\frac VN=v.}
$$
At coexistence gas and liquid have the same <temperature>, <pressure> and <chemical potential>. Integrating $d\mu=v\,dp$ along the intervening isotherm gives $\int v\,dp=0$. <Integration by parts>, with endpoints at the same coexistence <pressure> $p_*$, gives the <Maxwell construction>
$$
\boxed{\int_{v_l}^{v_g}[p(v,T)-p_*]\,dv=0.}
$$
The horizontal line at $p_*$ replaces the mechanically unstable loop of the van der Waals isotherm. The extensivity argument presupposes the ordinary <thermodynamic limit> and neglects macroscopic interface contributions.