Rainbows occur when the light radiated from the sun. comes into contact with water droplets in the atmosphere. So, how dose the light travel through the water droplets and create seven-colored rainbows?
Rainbows appear in seven colors because water droplets break sunlight into the seven colors of the spectrum. You get the same result when sunlight passes through a prism. The water droplets in the atmosphere act as prisms, though the traces of light are very complex.
When light meets a water droplet, it is refracted at the boundary of air and water, and enters the droplet, where the light is dispersed into the seven colors. The rainbow effect occurs because the light is then reflected inside the droplet and finally refracted out again into the air.
A rainbow has seven colors because water droplets in the atmosphere break sunlight into seven colors. A prism similarly divides light into seven colors. When light leaves one medium and enters another, the light changes its propagation direction and bends. This is called refraction. However, because of differences of refractive index, this refraction angle varies for each color or according to the wavelength of the light. This change of the angle of refraction, or refractive index, in accordance with the wavelength of light is called dispersion. In conventional media, the shorter the wavelength (or the bluer the light), the larger the refractive index.
The angle of refraction depends on the speed at which light travels through a medium. People have noticed the phenomenon of refraction throughout history. But the first to discover the law of refraction was Willebrord Snell (1580-1626), a Dutch mathematician. The refractive index of water to the orange sodium-vapor light emitted by streetlamps on highways is 1.33. The refractive index of water to violet, which has a short wavelength, is nearly 1.34. To red light, which has a long wavelength, the refractive index of water is almost 1.32.
Sunlight hitting a water droplet (sphere) in the atmosphere will be refracted on the surface of the droplet, and enters the droplet. When the refraction process occurs, the light breaks up into seven colors inside the water droplet, and is next reflected at the other surface of the droplet after traveling inside it. Note that in reflection the angle of reflection is the same as the angle of incidence, which means that reflected light travels in a predetermined path while maintaining the difference of angle of refraction. The light is refracted again when it exits the droplet, further emphasizing the dispersion. The primary reflection of a main rainbow and the secondary reflection from a slightly darker auxiliary rainbow disperse the light into the seven colors our eyes see.
You can see rainbows when the sun is located right behind you. The main rainbow becomes visible at an angle of around 40" from the horizon. You can see the auxiliary rainbow at about 53". The orders of the colors reflected from the water droplets in the main rainbow and in the auxiliary rainbow are reversed, as shown in the illustration.