When you refer to the "air shaking" when it's hot, it's likely that you are observing a phenomenon called heat shimmer or heat haze. Heat shimmer is a visual distortion that occurs in the air due to variations in temperature and density. Here's how it works:
When sunlight or any other source of heat radiates onto a surface, it heats up the air directly above it. Hot air is less dense than cold air, so it rises. As the hot air rises, it creates a vertical column or pocket of varying temperatures and densities.
When light passes through these columns of hot and cold air, it experiences refraction, which means the direction of the light waves changes. The varying density of the air causes the light waves to bend and scatter. This bending of light waves creates a distorted image of objects that are viewed through the heated air.
The rapid movement of air pockets with different temperatures and densities creates the illusion of the air "shaking" or shimmering. This effect is more noticeable when you are looking at objects in the distance, such as a road or a landscape on a hot day.
Heat shimmer is a result of the interaction between light and the dynamic properties of the atmosphere. It can occur over any surface where there is a significant temperature difference between the air and the ground, such as hot asphalt or sandy deserts.
It's important to note that this phenomenon is purely a visual effect and doesn't actually indicate any physical shaking or movement of the air molecules. It's simply the way our eyes perceive the distorted light waves as they pass through the varying temperature layers.