Few people reflect on this question: why is the sky blue?
This phenomenon is due to the chemical and physical structure of the atmosphere, ie to its chemical composition and to the fact that the atmosphere has a stratified structure.
The spectrum of the Sun under the atmosphere compared with the spectrum of a black bodySolar radiation has a characteristic spectral distribution, determined by the temperature of the photosphere. The maximum energy emitted by the Sun is in the wavelengths of the visible and precisely in correspondence with the yellow color. But not all the energy that comes from the Sun reaches the Earth, because the atmosphere, through various processes of reflection and absorption, filters this radiation so that only a part of it reaches the earth’s surface.
For example, the dangerous tail towards the short wavelengths (the so-called g, X and UV rays) are effectively absorbed by the ozone layer, present at high altitude, while part of the infrared radiation is absorbed by carbon dioxide and vapor. water, so that the Earth does not cool down too much.
Finally, part of the incident solar radiation is absorbed and diffused by the atmosphere in all directions. The diffusion is more efficient in the short wavelengths, so when the incident radiation is almost perpendicular (in the middle of the day) the diffuse radiation is mainly the blue one, but at dawn and at sunset, when the layer of atmosphere to cross is much larger due to the inclination of the rays, also all the other radiations are diffused, and in particular the red radiation that colors the sunset sky.