Final answer:
A rainbow is formed through a combination of refraction and reflection of light, which causes the dispersion of different colors. When sunlight enters a raindrop and is refracted and reflected, the index of refraction of water varies with wavelength, resulting in the formation of a rainbow.
Step-by-step explanation:
A rainbow is formed through a combination of refraction and reflection of light. When sunlight enters a raindrop, it is refracted as it enters and leaves the drop, and it is also reflected from the back of the drop. The index of refraction of water varies with wavelength, causing the light to disperse into different colors and creating a rainbow.