Does it become harder to compress a gas beyond a certain point? While I was reading a book, I came across the following:

Real gases show deviations from ideal gas law because molecules interact with each other. At high pressure molecules interact with each other. At high pressure, molecules do not strike the walls of the container with full impact because they are dragged back by other molecules due to molecular attractive forces.

My question pertains to the last two lines; At high pressure, if molecules do not strike the walls of the container with full impact (this means that the gas is closer to being liquefied as the molecular interactions increase) how does the pressure increase when we further compress it? And if the pressure does increase, does it become harder to compress a gas beyond a certain point?
 A: Taking a step back to the postulates from which the ideal gas law is derived will be educational here.

*

*1: the molecules in the gas occupy a negligible fraction of the total
volume


*2: the molecules are in constant random motion such that any sample volume is indistinguishable from any other sample volume


*3: molecules collide perfectly elastically with each other and the walls of the container


*4: these elastic collisions are the only interactions
Note that 3 falsifies the quoted passage; the ideal gas law assumes intermolecular interactions, albeit limited to elastic collisions.
I would express the general ideas in the quoted passage like this:
Real gases exhibit a relationship between pressure, volume, temperature, and number that differs from the relationship predicted by the Ideal Gas Law. The reasons are as follows:

*

*At high pressure, the molecules in a gas occupy a nonnegligible fraction of the total volume, violating postulate 1.

*

*This contributes a term such that, with decreasing volume at constant temperature and number, pressure tends to increase more than predicted by the ideal gas law.



*Real gases have air currents such that sample volumes may be distinguishable from one another, violating postulate 2 (although we can still ignore this in most circumstances).


*At high pressure, intermolecular attractive forces are nonnegligible, violating postulates 3 and 4.

*

*This contributes a term such that, with decreasing volume at constant temperature and number, pressure tends to increase less than predicted by the ideal gas law.


*Furthermore this results in a bulk force imbalance near the walls of the container, where there are attractive intermolecular forces between the gas molecules on one side and (usually attractive but less-so) intermolecular forces between a particular gas molecule and the wall of the container on the other side. This is another violation of postulate 2.

To your direct question, "does it become harder to compress a gas beyond a certain point?"
Because a liquid has less energy of configuration than the same mass of a gas of the same molecules, it takes less work than that predicted by the ideal gas law to compress the volume of a gas-liquid mixture, as more gas precipitates with decreasing volume and increasing pressure.
A: For an ideal gas we assume the volume and the intermolecular forces are negligible.
For a simple model of a real gas, there are two things that are often added that have differing (often opposite) effects:

*

*Intermolecular forces that reduce the momentum interaction with the vessel (decrease pressure).

*Finite volume that reduces the space available for the molecule to move (increase pressure).

The passage above deals with the first effect, but not the second.  At high pressures, they can both be important. But at very high densities (liquification) the second will probably dominate.
See also: http://hyperphysics.phy-astr.gsu.edu/hbase/Kinetic/waal.html
