During the day, the sky is blue and the sun appears a bright yellow. As the sun sets, it dims and reddens while the sky turns pink and orange. What causes that?
You may have heard before that the sky’s blue color is due to something called Rayleigh scattering. As it turns out, the way scattering’s effects change depending on the angle of sunlight are responsible for the color changes.
What is scattering?
Light is made of photons. When a photon collides with matter, one of three basic things can happen: it can pass through, it can bounce off, or it can be absorbed. However, because light is electromagnetic radiation, more complicated things can happen when the matter in question is electrically charged. Of course, ordinary matter is made up of charged particles (protons and electrons) and so light can interact electromagnetically with molecules that are electrically neutral.
Light is an electromagnetic wave or oscillation. When light interacts with a particle that is much smaller than the wavelength of the light, it causes a corresponding oscillation in the particle’s electrons. This oscillation in turn re-radiates the light in all directions without changing its wavelength. Note that the light is not being absorbed by the particle in this case. The earth’s atmosphere is over 98% nitrogen and oxygen (N2 and O2) molecules of which are responsible for most light scattering.
Whether light gets scattered or not depends on the light’s wavelength (color), with shorter wavelengths scattering more easily.


As a result, we see blue light (apparently) coming from all over the sky, while direct sunlight has a slightly warm color.

Twilight
So Rayleigh scattering explains why the midday sky is blue, but it also explains why sunsets are reddish. The later it is in the day, the oblique the angle of sunlight is. At midday, the light from the sun makes its shortest trip through the atmosphere. When the sun is lower, it has more atmosphere to pass through, meaning the light has been scattered more prior to reaching your eye. Looking at the sun through a lot of air means the majority of the blue light has been scattered in other directions before reaching you, and only the longer wavelength (redder) light makes it from the sun to your eye.

Notice that the most direct sunlight during a sunset is the most reddish, while the diffuse light from the upper sky is still blue.


