Why is the Earth’s sky blue?
First it is helpful to know that white light consists of many different colors put together. The reason there are rainbows is because the conditions are just right to see all the different colors of light, that come from our sun broken down into its component parts. For more about how rainbows form, go to: https://scijinks.gov/rainbow/
You could draw a rainbow with the colors in any order, but rainbow colors only exist in one order in nature, unless a second rainbow shows up with the primary rainbow. In that case the order of the colors is reversed. A memory aid that many people use to remember the order of the colors is ROY G BIV, which stands for Red, Orange, Yellow, Green, Blue, Indigo, Violet.
A triangular prism can also show you how white light is made up of the colors of the rainbow. The grouping of these colors make up the visible spectrum.
One of the reasons that an object is a certain color is because some parts of the visible spectrum are absorbed by that object and some bounce off or are reflected by it. For instance, green leaves have a substance in them called chlorophyll, so that red, orange, blue, indigo, and violet are absorbed in the form of heat energy (not very hot), while green and yellow are reflected making the leaves appear different shades of green. The background of this web page is a kind of deep blue, so red, orange, yellow, green and violet are absorbed, and blue is reflected from the screen, perhaps with a touch of indigo.
Another thing that is good to know from the start is that clear objects that light passes through change the direction of the light slightly. This is called refraction. This is one reason that in the picture below, the purple flowers look like they have different shapes through the water than they have when you look at them without the water in front.
Also handy to know is that light travels in waves and particles. Each color of the rainbow transmits in a different frequency of wave peaks. Red has less waves measured in the same amount of horizontal space like on the chart below, and its frequency is the lowest in the visible spectrum. Violet has the most waves, and its frequency is the highest. If violet was shown in the diagram below, more violet waves would fit within the same horizontal space than blue or red. Blue’s waves are just a little less frequent than violet’s. Blue light and violet light can be said to carry more energy than red’s light.
Resonance is another term that is helpful. Different molecules have different wavelengths. Nitrogen and oxygen, although clear in their gaseous state, have electrons that vibrate in a similar wavelength to blue light. Therefore, when the blue part of white light adds energy to nitrogen, and oxygen molecules, their electrons resonate and tend to scatter the blue part of light in several different directions through transmission of photons.
The sky is blue because many of the molecules that the white light passes through in the upper atmosphere have a close wavelength to the wavelength of blue, and blue light is sent in many different directions or scattered because of that resonance. Blue light is also refracted, sending it in more directions so that all the blue light that is transmitted and refracted makes the sky blue.