White light from the Sun is made up of all the various colours of visible light. Each of these colours has a different wavelength - red light (at one edge of the rainbow) has a wavelength of ~650 nm, whilst violet light (at the other edge) has a wavelength of ~400 nm.
When light travels from one medium (say air) to another (water), it changes speed, and if the light enters at an angle, it will bend. This is known as refraction. Shorter wavelength light (such as violet) refracts more than longer wavelength light (such as red). You can see white light splitting into its constituent colours in the image to the right.
NB: The Sun may not look white from here on Earth (it looks yellow), but if you were to observe it from space, it would look white. This is because the Earth's atmosphere scatters shorter wavelength light (like violet) more than longer wavelength light (red). See our story on the dust storm that turned Sydney red for more discussion of atmospheric scattering.
Primary Rainbow: …show more content…
The pictures below show the optics of how this works. The grey circles are water droplets. White light enters the droplet and is refracted, then reflected off the back of the droplet, before leaving the drop split into its constituent colours, again refracted. Some light will travel through the droplet - the reflection is not 100%. Red light leaves the droplet at a slightly higher angle than violet - this angle is independent of the size of the drop, but does depend on its refractive index. Seawater has a higher refractive index than rain water, so the radius of a rainbow in sea spray is smaller than a rainbow in the sky. The following picture shows the paths of red and violet light in the production of a rainbow - the other colours of a rainbow (for example green) travel somewhere between the two