A rainbow is an optical or meteorological phenomenon that causes a (nearly) continuous spectrum of light to appear in the sky when the sun shines onto falling rain. It is a multicoloured arc with red on the outside and violet on the inside; the full sequence is red, orange, yellow, green, blue, indigo and violet. See also the Colour article for information on the rainbow spectrum of colour.
The rainbow effect can be observed whenever there are water drops in the air and sunlight shining from behind the observer at a low altitude or angle. The most spectacular rainbow displays when half of the sky is still dark with draining clouds and the observer is at a spot with clear sky overhead. Another common place to see the rainbow effect is near waterfalls. Rainbow fringes can sometimes be seen at the edges of backlit clouds and as vertical bands in distant rain or virga. The effect can also be artificially created by dispersing water-vapour into the air during a sunny day.
In a very few cases, a moonbow, or night-time rainbow, can be seen on strongly-moonlit nights. As human visual perception for colour in low light is poor, moonbows are perceived to be white.
Physics of rainbows
The rainbow's appearance is caused by dispersion of sunlight as it is refracted by (approximately spherical) raindrops. The light is first refracted as it enters the surface of the raindrop, undergoes total internal reflection from the back of the drop, and is again refracted as it leaves the drop. The overall effect is that the incoming light is reflected back at an angle of about 40-42°, regardless of the size of the drop. Since the water of the raindrops is dispersive, the amount that the sunlight is bent depends upon the wavelength (colour) of the light's constituent parts. Blue light is refracted at a greater angle than red light, but because of the reflection from the back of the raindrop, the red light appears higher in the sky, and forms the outer colour of the rainbow.
The rainbow does not actually exist as a location in the sky, but is an optical illusion whose apparent position depends on the observer's location. All raindrops refract and reflect the sunlight in the same way, but only the light from some raindrops reaches the observer's eye. These raindrops are perceived to constitute the rainbow by that observer. Its position is always in the opposite direction of the sun with respect to the observer, and the interior is actually a magnified image of the sun, which can be seen to be slightly brighter than the exterior. The bow is centered on the shadow of the observer's head, appearing at an angle of approximately 40-42° to the line between the observer's head and its shadow (this means that if the sun is higher than 42° the rainbow is below the horizon and cannot be seen unless the observer is at the top of a mountain or a similar vantage point). Similarly it is difficult to photograph the complete arc of a rainbow, which would require an angle of view of 84°. For a 35mm camera, a lens with a focal length of 19mm or less would be required, whilst most photographers are only likely to have a 28mm wide-angle lens.
Sometimes, a second, dimmer rainbow is seen outside the primary bow, caused by a double reflection of the sunlight inside the raindrops, and appears at an angle of 50-53°. Because of the extra reflection, the colours of the bow are inverted compared to the primary bow, with blue on the outside and red on the inside. From an aeroplane one has the opportunity to see the whole circle of the rainbow, with the plane's shadow in the centre.
The first accurate theoretical explanation of a rainbow came from Descartes in 1637. Knowing that the size of raindrops didn't appear to affect the observed rainbow, he experimented with passing rays of light through a large glass sphere filled with water. By measuring the angles that the rays emerged, he concluded that the primary bow was caused by a single internal reflection inside the raindrop and that a secondary bow could be caused by two internal reflections. He was able to back this up with a derivation of the law of refraction (subsequently, but independently of Snell) and correctly calculated the angles for both bows. However, he was unable to explain the colours.
Isaac Newton was the first to demonstrate that white light was composed
of the light of all the colours of the rainbow, which one glass prism
could split into the full spectrum of colours, and another could recombine
into a beam of white light. He also showed that red light gets refracted
less than blue light which led to an essentially complete explanation
of a rainbows optical effect