Ideal Gas Derivation

Consider a gas molecule in space with kinetic energy 3kbT/2 = 1/2 mvavg2.  If a wall is placed normal to the path of the gas molecule of size R2, and the gas molecule elastically interacts with the wall so that the molecular momentum, mvx, becomes -mvx, then the change in momentum is 2mvx defining the x axis as normal to the wall. 

Consider a box of size R so that the previous wall makes up one side.  The time required for the gas molecule to cross the box is R/vx and the time between impacts on the previous wall is 2R/vx.  The force imparted to the wall is given by F = ma = change in momentum/change in time = 2mvx2/(2R) = mvx2/R.  The pressure is this force divided by R2, and R3 = V so, P = mvx2/V where V is the enclosing volume.  The average velocity is given by the root mean square value of the Cartesian velocities, vavg2 = vx2 + vy2 + vz2 = 3vx2 where the last equality arises because the x, y and z directions are indistinguishable for a gas molecule that moves randomly.  If there are n gas molecules that do not interact with each other in the box, that is gas molecules with mass but occupying no volume and having no enthalpic interaction (charge or reaction) with each other and having only elastic interactions with the walls of the chamber then we can simply multiply the pressure by n to obtain the ideal gas law,
P = n mvavg2/(3V) = nkbT/V
If n is the number of moles rather than the number of molecules we have,
P = nRT/V.

n/V is the concentration or density of the gas, φ, and V/n is the specific volume Vsp so we can write,
P = RT/Vsp = φ RT.
Non-ideal conditions can be considered in the context of a power series expansion in φ since we expect non-ideal conditions on increasing concentration given the assumptions involved in the ideal gas law.  A Taylor series expansion is achieved by using the derivatives of a function at the zero limit so,
P(φ) = RT(0 + φ + P"(φ => 0)/2! + P'''(φ => 0)/3! + P''''(φ => 0)/4! + P'''''(φ => 0)/5! + ...
or, in the common terms of the virial expansion,
P/RT = φ + B φ2 +C φ3 + ...
where B is called the second virial coefficient and represents the enthalpy associated with binary interactions in the gas.  This same method is used to discuss solution theory where enthalpic interactions are important to understanding miscibilty.

A second approach to describing non-ideal behavior is to simply allow a modification of the pressure (to account for enthalpic interactions) and the volume (to account for finite excluded volume of the gas molecules) through the van der Waals equation of state,
(P + a/Vsp2)(Vsp - b) = RT
where the modification of pressure follows the dependence of the second virial term, i.e. it depends on φ2.
A third approach is to simply find a correction factor for non-ideal behavior using the compressiblity, z,
z = PV/nRT
Typically, we use the critical point to reduce the pressure and temperature to obtain a more universal compressiblity function.  The critical point is the point at which the density of a liquid and a vapor become the same on increasing temperature and pressure.  Above the critical point liquid and vapor are not distinguishable and there is no surface tension for fluids.  For CO2 this occurs as 31ºC and 72.8 atm, for propane at 97ºC and 42 atm. 
Critical Point P vs T
The reduced compressiblity is given by,
zr = PrV/nRTr,
where Pr = P/Pc and Tr = T/Tc and Pc and Tc are the critical pressure and temperatures.