Temperature of ideal gas after volume increases in piston

A three part question, all related

Part 1.

My question is about an ideal gas in a rigid container with two (equal volume) compartments separated by a rigid wall. One compartment has an ideal gas at some P, V, T. The other side is vacuum. If suddenly the wall is removed, what happens to temperature?

Would this be any different if it were a piston, where we pulled the piston to double the volume?

Part 2.

I found a similar question that had already been asked. From John Rennie's answer there it appears that the temperature should not change in both cases, but I am not sure.

What is most surprising to me is that everyone seems to be happily agreeing that this can be understood by $PV=nRT$ with $P$ and $N$ constant, and that somehow this equation implies that if you decrease $V$ then $T$ must increase!

Isn't that just the opposite of what the formula says? $V$ and $T$ are directly proportional, so if $V$ increases, $T$ must increase, at least according to the ideal gas law.

Part 3.

Finally, cooling and air-conditioning seems to work on the principle of expanding volume (going from a thin pipe to a wider one) causing a decrease in pressure, and hence temperature. But $V$ increased, and $P$ decreased, so why did $T$ change?

My question is about an ideal gas in a rigid container with two (equal volume) compartments separated by a rigid wall. One compartment has an ideal gas at some P, V, T. The other side is vacuum. If suddenly the wall is removed, what happens to temperature?

Temperature change upon expansion into a vacuum is the Joule Thompson Effect. In a real gas the temperature can increase or decrease depending upon the particular gas and conditions. For an ideal gas there is no change in temperature. The Joule-Thompson coefficient is zero. See this reference for derivation and further explanation.

Isn't that just the opposite of what the formula says? V and T are directly proportional, so if V increases, T must increase, at least according to the ideal gas law.

No, the direct proportionality of V and T assumes pressure is constant, but pressure is not constant for expansion into a vacuum.

Finally, cooling and air-conditioning seems to work on the principle of expanding volume (going from a thin pipe to a wider one) causing a decrease in pressure, and hence temperature. But V increased, and P decreased, so why did T change?

Three effects need to be considered, expansion against a non-zero pressure, the Joule Thompson effect, and evaporative cooling (latent heat of vaporization) any one of which can cause the temperature to decrease.

The key here is that you are expanding "into a vacuum" - in other words, you are not doing any work (assuming for a moment that the piston is massless, so that accelerating it takes no work; that is of course not the case...)

The statistical mechanics view of the temperature of a gas is related to the mean kinetic energy of the molecules - if the molecules don't change velocity, then the temperature doesn't change.

A real gas that is expanding into a vacuum can change temperature (because of intramolecular forces), but for the gas you are considering there is no such thing. The molecules that were "about to hit the wall" will suddenly fly a lot further before they hit the wall - but as long as the only wall they hit is a stationary wall, their energy doesn't change. This assumes that the piston expands "instantaneously" to the new position (the partition disappears). If the position is moving slowly, then it (the piston) will be experiencing a force (from the pressure of the gas) and this must mean work is done (by the gas, on the piston). In that case the molecules do work, lose kinetic energy, and the temperature will drop.

Again, in an air conditioner, you are doing work (compression -> gas heat up; lose the heat through conduction; expand the gas, it cools down -> gain heat (from the house air) through conduction; repeat).

Simply said Temperature is a measure of average kinetic energy. An ideal gas has only kinetic energy and when you pull the piston you might do work on the piston if it has mass but you do not do any work on the gas itself i.e. you do not add energy to the system either by heat or by work. Net energy is same, no. of particles remains same therefore the average kinetic energy and thus the temperature stay constant.

For a real gas there are potential energy terms that could change when you expand the gas resulting in change of kinetic energy which would change the average kinetic energy and thus the temperature.

I am not sure about this but i think that for many real gases the temperature might increase. Cheers!