# Question regarding $Z$ (Compressibility factor)

Oh! This problem has been bugging me for a long time. According to Wikipedia, the Compressibility factor $$Z$$ is defined as the ratio of the volume occupied by a real gas to the volume occupied by an ideal gas at the same temperature and pressure.

$$Z=\frac{V_{real}}{V_{ideal}} \text{ ........(1)}$$

Now the Ideal Gas Equation is

$$P_{ideal}V_{ideal}=nRT \text{ ....(2)}$$ Now from here we can substitute the value of $$V_{ideal}$$ into the above expression $$(1 )$$ to get $$Z=\frac{PV_m}{RT}$$ Where $$V_m$$ is the molar volume of the gas and $$P$$ is the value of $$P_{ideal}$$ that was in the ideal gas equation $$(2)$$.

OK, So far so good!

Deriving the compressibility factor value from the van der Waals' gas equation:

We know for real gases the pressure exerted by them is always less than the pressure exerted by an ideal gas so we correct the pressure by the term $$a\frac{n^{2}}{V^{2}}$$, we get

$$P_{ideal}=P_{real}+a\frac{n^{2}}{V^{2}}$$ And the volume occupied by the gas molecules can be written as

$$V_{ideal}=V_{real}−nb$$ On substituting the above values of $$P_{ideal}$$ and $$V_{ideal}$$ in the ideal gas equation, we get our van der Waals' Gas Equation

$$(P+a\frac{n^{2}}{V^{2}})(V−nb)=nRT$$ Please note that in the above equation $$P$$ is $$P_{real}$$ and not $$P_{ideal}$$. Now I'm going a step further to calculate the value of Z from this equation by shifting the terms and I got this $$Z=\frac{PV_m}{RT}=\frac{V_m}{V_m−b}−\frac{a}{RTV_m}$$ Now here's the problem that I'm facing: In the above expression the value of $$P$$ is not the $$P_{ideal}$$ but it is the value of $$P_{real}$$ that we had in the van der Waals' gas equation.

Doesn't that contradict the whole definition of Compressibility factor that we had learned in the first place? How this expression for $$Z$$ can be correct?

Forget about the ideal gas. The definition of the compressibility factor is just $$Z=\frac{PV_m}{RT}$$