Final answer:
Rainbows are produced by the combination of refraction and reflection of light in raindrops. The colors of the rainbow are formed when light is refracted and reflected towards the observer's eyes. A secondary rainbow can sometimes occur if there are two reflections of light within a water drop.
Step-by-step explanation:
Rainbows are produced by a combination of refraction and reflection. When light enters a raindrop, it is reflected from the back of the drop and refracted as it enters and leaves the drop. The index of refraction of water varies with wavelength, causing the light to be dispersed and forming a rainbow of colors.
The colors of the rainbow are observed when the myriad rays of light are refracted and reflected toward the observer's eyes from numerous drops of water. The angle at which the observer sees the rainbow is determined by the angle between the Sun and the observer, which is why rainbows are most visible when the background is dark.
In some cases, when there are two reflections of light within a water drop, a secondary rainbow can be produced. This rare event creates an arc that lies above the primary rainbow arc and produces colors in the reverse order.