# interconverting Van Der Waal's equation for real gases from number of molecules to density

I want to ask a question about Van Der Waal's equation for real gases.

I was shown the following formula for real gases (VDW) which accounts for the liquification of water vapour which is not possible with an ideal gas model.

$$P = \frac{NkT}{V-Nb} - \frac{aN^2}{V^2} = \frac{\rho RT}{1-\rho b} - a \rho^2$$

which can be expressed using densities by making the denominators equal first:

$$P = \frac{NkT}{V-Nb} - \frac{aN^2}{V^2} = \frac{NkT}{V-Nb}\left(\frac{V}{V}\right) - \frac{aN^2}{V^2} = \frac{\frac{NkT}{V}}{\frac{V-Nb}{V}} - \frac{aN^2}{V^2}$$

but I appear to yield the result

$$P = \frac{\rho kT}{1-\rho b} - a \rho^2$$

where Boltzmann's constant $$k$$ has been switched for the gas constant, $$R$$. I can't find any sources that explain this derivation apart from "Molecular Driving Forces" by Dill, and he doesn't do a thorough conversion either.

How do I convert the numerator with Boltzmann's constant $$k$$ to the gas constant, $$\rho$$ which expresses VDW's equation involving densities?

Let n be the number of moles and A be Avagadro's number. Then N=nA. If we substitute this into your first equation, then I get $$P=\frac{n(Ak)T}{V-nAb}-\frac{aA^2n^2}{V^2}$$But, since Ak=R, we obtain:$$P=\frac{nRT}{V-nb'}-\frac{a'n^2}{V^2}$$where $$a'=aA^2$$ $$b'=bA$$. In terms of molar density $$\rho=n/A$$, this becomes:$$P=\frac{\rho RT}{1-\rho b'}-a'\rho^2$$