If there is container with a moveable piston. If heat is supplied to it the gas in container expands right raising the volume. The gas expands raises the piston against gravity (the gas does positive work on the weight). according to Newton's third law the gas exerts force PA on the piston but the piston also exerts and equal and opposite force. My question is how will piston even move if they exerts equal and opposite forces on one another.
The second question is that in above case if we calculate work done on the gas it comes out to be $W=\int( -PA)\;dx$. How? In my physics book they are saying that minus sign is due to the fact that force exerted by the piston on the gas is in opposite direction to displacement. But in many other places i have seen that work done formula is given by $W = \int(PA)\;dx$. How?