Pressure and Volume

If a sample of gas is compressed (the volume is decreased, without changing the amount of gas contained), the same amount of gas is confined in a smaller space. The gas particles do not travel as far or as long after a collision with the wall before colliding again. Therefore, the number of collisions (per unit time) with the walls from these gas particles increases, and the pressure will also increase.

This figure shows a pair of pistons and cylinders. The first, baseline cylinder shown is identical to the first cylinder in a. In the second cylinder, the piston has been moved, decreasing the volume available to the 6 purple spheres to half of the initial volume. The orange dashes indicating points of collision with the container walls has increased. This second cylinder is labeled, “Volume decreased.” A rectangle beneath the diagram states, “Volume decreased, Wall area decreased equals Increased pressure.”
When volume decreases, gas pressure increases due to increased frequency of particle collisions.

If the gas is expanded, the pressure will decrease since the particles will be able to travel farther between collisions, reducing the number of collisions per unit time on any part of the container.