I think the title says pretty much. Last night I poured hot water in a half full bottle of water and closed the cap. The bottle immediately shrunk. Why? My girlfriend suggested that the hot water has less oxygen in it and thus consumes some of the oxygen in the bottle.
In an ideal gas
where P is the absolute pressure of the gas, V is the volume of the gas, n is the amount of substance of gas (measured in moles), T is the absolute temperature of the gas and R is the ideal, or universal, gas constant.
The capped gas in the bottle cools coming to a thermodynamic equilibrium , through conduction to the walls, and also according to the black body radiation # law everything cools at a certain rate. In the formula above the combined pressure times volume has to become smaller. If the walls are not rigid the imbalance of the inside pressure to the outside compresses the wall until pressure equilibrium is reached. The same is true if you put a capped half empty bottle in the freezer. - - - - - - -
#it has been pointed out in a comment air does not follow the black body radiation formula well , it has small emissivity and conduction has to be the main cooling mechanism.
When plastic bottles are made they start with something that looks like a test tube with the threaded top for the bottle cap. It's heated and air is blown into it while it sits in a bottle shaped mold. Then it's quickly cooled to lock the plastic into that shape.
The stretching creates residual stress in the plastic. It wants to un-stretch like a taught rubber band. When you heat it with boiling water that's what happens. Though of course it's been stretched too far to go back to it's original test tube shape.
You filled the hot water into the bottle, during this time it created steam inside the bottle, moving part of the air out. After closing, the steam cools down and condenses quickly. As some air was pushed out, that creates a vacuum, collapsing the bottle.
Another process, which probably has contributed, but would be the main effect when the water is not really hot, not producing steam: The hot water heats the air in the bottle. The air expands caused by increased temperature. After closing the bottle, the air cools down and decreases volume, creating a vacuum, which collapses the bottle.
if it was a plastic cola bottle it is because the plastic is a cross linked polymer, and is designed to be heated and then pressurized into a mold, and cooled under pressure to maintain its shape. this particular plastic was chosen because of its low failure rate in this process ( holes and deformities ) it is very much the same as heat shrink tubing or sheets.