Simply one equation can be used to distinguish between ideal gas from real gas and this is,
PV = nRT 

The gas which obeys this equation under all conditions of temperature and pressure is called ideal gas and the gas which does not obey this equation under all conditions of temperature and pressure is called real gases. A number of points can be discussed to compare the two types of gases.
Ideal Gas:
 The Ideal Gas can not be liquefied since it has no intermolecular attraction and so that molecule will not condense.
 The coefficient of thermal expansion(ɑ) depends on temperature(T) of the gas and does not depends on the nature of the gas.
 The coefficient of compressibility(β) similarly depends on the Pressure(P) of the gas and will be same for all gases.
 When P is plotted against V, at constant temperature(T) a rectangular hyperbola curve is obtained as demanded by Boyle's Low,
 When PV is plotted against P , at constant T a straight line parallel to Paxis is obtained. At different temperature there will be different parallel lines.
 When an ideal gas passes through a porous plug from higher pressure to lower pressure within insulated enclosure, there will be no change of temperature of the gas . This confirms that the ideal gas has no intermolecular attraction.
PV = Constant 
The hyperbola Curve at each temperature is called one isotherm and at different temperature we have different isotherms. Two isotherms will never intersect.
Graphical Representation of Boyle's Low 
 Problem 1:

Show that coefficient of thermal expansion of Ideal Gas depends on the temperature of the gas.
 Answer:

Coefficient of thermal expansion(α) is defined as,
α = (1/V)[dV/dT]_{P}
Ideal Gas Equation for 1 mole gas is,
PV = RT
Hence [dV/dT]_{P} = R/P
Thus α = (1/V) × (R/P) = (R/PV) = 1/T
This means all the gases have the same coefficient of thermal expansion.
 Problem 2:

Show that coefficient of Compressibility of Ideal Gas depends on the Pressure of the gas.
 Answer:

Coefficient of Compressibility(β) is defined as,
β =  (1/V)[dV/dP]_{T}
Ideal Gas Equation for 1 mole gas is,
PV = RT
Hence [dV/dP]_{T} =  (RT/P^{2})
Thus β = (1/V) × (RT/P^{2})
= (RT/P^{2}V)
= (RT/PV) × (1/P)
= (1/P)
This means coefficient of Compressibility depends on the Pressure(P) of the gas.
Real Gas:
 This gas could be liquefied since it has inter molecular attraction which helps to coalesce the gas molecules.
 The coefficient of thermal expansion (ɑ) is found to vary from gas to gas that is α depends on the nature of the gas.
 The coefficient of compressibility (β) also is found to depend on the nature of the gas.
 When P is plotted against V, a rectangular hyperbola is obtained only at high temperature (above the critical temperature).
 When PV is plotted against P for real gas, following plots, called Amagat Curve are obtained.
 When real gases pass through porous plug from higher pressure to lower pressure within insulated enclosure, there occurs a change of temperature. This is due to the fact that real gases have intermolecular attraction and when the gas expands, the molecules have to spend energy to overcome intermolecular attraction and so the temperature of the gas drops down.
But a temperature below the critical temperature(C), the gas is liquefied after certain pressure depends on temperature. The point C is the critical point where he liquid and gas can be indistinguishable.

It shows that for most gases, value of Z decreases, attain minimum and then increases with the increase of P.

Only Hydrogen(H₂) and Helium(He) baffle this trend and the curve rises with increase of Pressure(P) from the very beginning.

For CO₂, there is a large dip in the beginning, In fact, for gases which are easily liquefied, Z dips sharply below the ideal line in the low pressure region.
Boyle Temperature(T_{B}):

At some intermediate temperature TB called Boyle temperature, the initial slope is zero.

At the Boyle temperature, the Z versus P line of an ideal gas is tangent to that of a real gas when P approaches zero. The latter rises above the ideal gas line only very slowly.

Thus, at the Boyle temperature, the real gas behaves ideally over a wide range of pressure, because the effect of size of molecules and intermolecular forces roughly compensate each other. Boyle Temperature(T_{B}) is give by,
[d(PV)/dP]_{T} when P → 0 

The Boyle temperature of Some gases are given below:
Gases  T_{B} 
Hydrogen (H_{2})  156^{0}C 
Helium (He)  249^{0}C 
Nitrogen (N_{2})  59^{0}C 
Methane (CH_{4})  224^{0}C 
Ammonia (NH_{3})  587^{0}C 

Thus we can see that for H₂ and He, the temperature of 0⁰C is above their respective Boyle temperature and so they have Z values greater than unity.

The other gases at 0⁰C are below their respective Boyle temperature and so hay have Z values less than unity in the low pressure region.
Compressibility Factor(Z):

An important single parameter, called Compressibility factor (Z) is used to measure the extent of deviation of the real gases from ideal behavior. It is defined as,
Z = PV/RT 

When Z=1, the gas is ideal or there is no deviation from ideal behavior.

When Z ≠ 1, the gas is nonideal and departure of the value of Z from unity is measure of the extent of nonideality of the gas.

When Zく1, the gas is more compressible then ideal gas and When Z 〉1, the gas is less compressible then ideal gas.
 Problem 3:

At 273 K and under pressure of 100 atm the compressibility factor of O_{2} is 0.97. Calculate the mass of O_{2} necessary to fill a gas cylinder of 108.5 lit capacity under the given conditions.
 Answer:

Mass of O_{2} = 1600 gm = 1.6 Kg

See Question Answers Physical Chemistry Problem 8.