Why is the sky blue and why is the sunset red and orange?

When I was a kid I heard that the sky was blue because it was the reflection off the ocean. The light from the Sun, which appears white, is actually made up of all colors of the rainbow, when the light enters the atmosphere the colors can become separated (Imagine looking at light through a prism). We know that bluer light travels in short, tight waves while redder light travels in longer waves. The shorter the wavelength, the more likely the light is to bounce off of an air molecule and become scattered. Blue light is scattered most in our atmosphere.

I also heard, when I was a kid, that when you observe a sunset and you see the shift in color from blue to red that you’re actually seeing the sun’s rays being filtered through the pollution. Well, that sounds dismal. It’s also not entirely true.

One of the main factors in determining a sunset’s color is the Earth’s atmosphere. The atmosphere is made up mostly of gases as well as some other molecules and particles thrown in for good measure. The most common gasses in our atmosphere are nitrogen (78%) and oxygen (21%). The remaining single percent is made up of water vapor and lots of tiny solid particles like dust, soot & ash, pollen, and salt from the oceans. There are also trace gasses like argon present. Also, depending on where you live, you’ll have to factor in that volcanoes can put large amounts of dust particles high into the atmosphere and pollution can add different gases or dust and soot to the air as well.

The atmosphere of the Earth can be thought of like a filter on a camera lens.

Light from a light bulb or the Sun may look white, but it is actually a combination of many colors. When you see light filtered through a prism you’ll see this white light split up into its separate colors, i.e. wavelengths. White light is the colors of the spectrum blended into each other. And a rainbow that you see in the sky is actually a natural prism effect as rain drops split those different colors up. The colors have different wavelengths, frequencies, and energies. Violet has the shortest wavelength. Red has the longest wavelength. The shorter the wavelength means the more powerful the frequency.

So let’s put it all together in how light acts in the air surrounding our planet. Light moves in a straight line until it is messed with (be it gas, dust, ash, etc.). Once something interferes and gets in the way of the light wave it’ll scatter that light in different directions. The probability of light to be scattered by a molecule is proportional its wavelength, so shorter wavelengths of light are scattered much more often than longer wavelengths. In the case of air molecules, the molecules are much smaller than the wavelength of the scattered light, this is called Rayleigh scattering.

As the Sun sets later in the day, the light becomes less and less direct, think of what causes your shadow to be longer in the afternoon than during mid day. During mid day, sunlight is shining almost directly down through the atmosphere, while at the end of the day it is shining through more atmosphere. As the white sunlight travels through more atmosphere, more of the shorter wavelength colors are scattered away from our line of sight. Until finally as the Sun is about to set below the horizon, only red (the visible light with the longest wavelength) remains.

You’re saying that blue light, having shorter wavelength, is scattered more by our atmosphere than red light, with its longer wavelength. And that the sun being low increases this effect, because instead of viewing it directly overhead there’s more atmosphere for the light to travel through when the sun is observed obliquely at the horizon. If that were the whole story we’d expect the same thing to happen on Mars, wouldn’t we? But sunsets on Mars are blue, not red or orange.