What is a rigorous definition of gas volume, and how is the Van der Waals equation derived? I am confused about the justification for the corrections to the ideal gas law in the Van der Waals equation: $$p=\frac{nRT}{V-nb}-a\left(\frac{n}{V}\right)^2$$

I understand that the equation attempts to correct for attractive and repulsive forces between molecules, and that at high volumes the corrections are negligible, at intermediate volumes the $V-nb$ correction dominates (since attractions are dominant and this shrinks the volume, as should occur for attractions), and at low volumes the $a(n/V)^2$ correction dominates, since repulsions are dominant.  However, the 7th edition of Atkins' and de Paula's Physical Chemistry justifies part of this equation as follows:


  The repulsive interactions are taken into account by supposing that they cause the molecules to behave as small but impenetrable spheres.  The nonzero volume of the molecules implies that instead of moving in a volume $V$ they are restricted to a smaller volume $V-nb$.  This argument suggests that the perfect gas law $p=nRT/V$ should be replaced by $$p=\frac{nRT}{V-nb}$$ when repulsions are significant.


I am confused by this argument-- what exactly is the definition of 'volume' here?  They seem to be saying that it is the empty space around the gas molecules, but it seems to me that volume should be defined as the space 'taken up' by the gas.  Why should the space taken up by the particles themselves be subtracted?  This isn't done for solids or liquids as far as I know.  

These thoughts have also made me realize that I'm not quite sure what it means for a gas to 'take up' space.  Does anyone have a rigorous definition of gas volume?

EDIT: The exchange with Chris in comments has raised further questions.  It now seems to me that the $V-nb$ correction actually accounts for repulsions rather than attractions.  I think I was incorrect in thinking that the $V-nb$ correction dominated at intermediate volumes and $a(n/V)^2$ at low volumes.  If $V-nb$ is for repulsions, then it should dominate at low volumes, but I can't tell from the equation which correction will actually be dominant.  Also I am now wondering whether it even makes sense to connect one correction with repulsions and one with attractions.

EDIT: Follow-up questions for F'x:
- I thought that 'density' meant mass/volume.  Is the use of it to represent the inverse of molar volume (as you have used it) common?
- Where is the phase-transition in the red van der Waals curve?
- I am still a little unclear on gas volume.  Are the 'volume available to the gas' and 'volume of the gas' the same?  You say it's the same as the shape of the container, but aren't we subtracting the volume of the actual gas particles from that?  The $V$ term represents the volume of the gas, correct?  And $V-nb$ represents the 'volume available to the gas'.
I edited the first van der Waals equations in your question, because it was incorrect.



First, the volume available to the gas is pretty much was you think: it's the space left for it to occupy, i.e. the volume delimited by the container. If you think of a gas tank, it's the interior volume of the tank. For systems of macroscopic dimensions, there is no real ambiguity as to its definition, which can be purely geometrical. For nanoscale systems, such as accessible volume in porous media, the definition is much harder: it is typically done by constructing a Gibbs dividing surface between the two phases considered (here, a solid and a gas).



Second, importance of both terms in a real-life example. Let's write the van der Waals equation in terms of density, rather than volume and quantity:

$$ \left(P+a\rho^2\right)\left(\frac{1}{\rho}-b\right)=RT $$

Let's take a practical example of a gas with a large quadrupolar moment, CO2. We have $a$ and $b$ parameters for it from this source, and we can plot $\rho(P)$ at $T=300$ K:



(black: ideal gas; red: van der Waals gas; green: only $b$; blue: only $a$). We see that excluded-volume correction by itself is not much of a gain, but it's actually crucial once you include the attraction, because otherwise the phase transition (the cusp in the blue curve) occurs at much too low pressure.



Finally, regarding the derivation of the van der Waals equation, this is typically a topic of statistical thermodynamics and there are many such demonstrations. My favorite is the classical one by Hill, but it may not use the notations in modern textbooks. I'm also partial to that in McQuarrie’s book. All statistical physics derivation introduce the excluded volume in a very natural fashion, but they show more variation on the way they arrive at the $a$ term (so of them find the exact analytical form of the equation, while in some derivations you find a series expansion whose first term is the van der Waals equation).