Alternatively, suppose we have a cylinder containing an ideal gas, with cross sectional area A and a variable height x. Suppose that a weight of mass m has been placed on top of the cylinder. It presses down on the top of the cylinder with a force of mg where g is the acceleration due to gravity.