A mirage is caused by the refraction of light that forms an inverted image as perceived by a distant observer. Cold air, far from the ground, has a greater refractive index because it is denser than hot air. With layers of air at different temperatures, depending on the distance from the ground, light travels while bending its direction toward the observer from cooler to hotter and then hotter to cooler. Mirages occur more commonly in deserts in which the ground is very hot.