Why is the sky not purple?
This is from the Physics FAQ article that I wrote 15 years ago:
If shorter wavelengths are scattered most strongly, then there is a puzzle as to why the sky does not appear violet, the colour with the shortest visible wavelength. The spectrum of light emission from the sun is not constant at all wavelengths, and additionally is absorbed by the high atmosphere, so there is less violet in the light. Our eyes are also less sensitive to violet. That's part of the answer; yet a rainbow shows that there remains a significant amount of visible light coloured indigo and violet beyond the blue. The rest of the answer to this puzzle lies in the way our vision works. We have three types of colour receptors, or cones, in our retina. They are called red, blue and green because they respond most strongly to light at those wavelengths. As they are stimulated in different proportions, our visual system constructs the colours we see.
When we look up at the sky, the red cones respond to the small amount of scattered red light, but also less strongly to orange and yellow wavelengths. The green cones respond to yellow and the more strongly scattered green and green-blue wavelengths. The blue cones are stimulated by colours near blue wavelengths, which are very strongly scattered. If there were no indigo and violet in the spectrum, the sky would appear blue with a slight green tinge. However, the most strongly scattered indigo and violet wavelengths stimulate the red cones slightly as well as the blue, which is why these colours appear blue with an added red tinge. The net effect is that the red and green cones are stimulated about equally by the light from the sky, while the blue is stimulated more strongly. This combination accounts for the pale sky blue colour. It may not be a coincidence that our vision is adjusted to see the sky as a pure hue. We have evolved to fit in with our environment; and the ability to separate natural colours most clearly is probably a survival advantage.
The answer to this question is complicated, and one way to see that it can't be simple is that the sky isn't a single color. It's bluer near the zenith and whiter near the horizon. It's gray on a hazy day. It's red near the setting sun.
The figure below (Bohren, Atmospheric Optics, http://homepages.wmich.edu/%7Ekorista/atmospheric_optics.pdf ) below shows the result of multiplying the solar spectrum by the $1/f^4$ of Rayleigh scattering. This gives us a spectrum that is strongly peaked in the violet, but that still has quite a bit of light throughout the rest of the spectrum.
This is all assuming single scattering. Multiple scattering also occurs, and is most common near the horizon. Multiple scattering brightens the light and equalizes the intensities of the different wavelengths.
We also have haze and possibly other forms of particulate matter such as smog. This produces Mie scattering. Mie scattering on a cloud of particles with a range of sizes produces more uniform scattering as a function of wavelength than Rayleigh scattering.
The net result of multiple scattering and Mie scattering is to whiten the color of the sky considerably.
You can have particles in the atmosphere that are actually colored. This is not a major effect on earth, but it is the main factor responsible for the color of the Martian sky.
Next we hit the cone cells of the eye, which contain pigments that act as filters for three overlapping bands. Philip Gibbs' answer shows the curves for these filters. There is also the Purkinje effect here, which shifts the spectral response of the eye depending on the level of light, which will affect the color of the sky at dusk compared to its color at noon.
Finally we get to an additional layer of processing by the nervous system, as described by the opponent processing theory of Hering, Hurvich, and Jameson. This probably has a significant effect on the color of the sky. On these graphs, you can see that (1) the red-green function has a surprising rise near the short-wavelength end of the spectrum (which I don't think can be explained just based on the tiny secondary bump in the red cells' filtering function), and (2) we perceive a color to be blue when the red-green function is near zero. Examining the spectrum on the graph by Bohren, and then considering the whitening that would result from Mie scattering and multiple scattering, it looks like the final step of passing it through the red-green function would probably produce a net negative result, which would make the sky tend to appear blue or cyan -- as we observe. For the sky to appear violet, it would have to have a net positive value of the red-green function, and that seems impossible with this spectrum.
A good online article with links to several other, more detailed PDFs is here: http://www.orionsarm.com/xcms.php?r=oa-page&page=gen_skyonalienworlds
All light is Rayleigh scattered, it's just that short wavelength light is scattered more. The bluest light we can see has a wavelength of about 400nm while the reddest has a wavelength of about 700nm, so there is a roughly a factor of ten increase in the scattering going from the red to the blue end of the spectrum.
So the light we see from the sky isn't a pure wavelength, it's a mix of all the colours but weighted towards the blue end of the spectrum. For the sky to be purple we'd need the scattering of purple light to be much stronger than red light, not just a factor of ten.