A rainbow is an optical and meteorological phenomenon that causes a (nearly) continuous spectrum of light to be visable in the sky when the sun shines onto falling rain. It is a colored arc with red on the outside and violet on the inside: see color for the full sequence.
The rainbow effect can be observed whenever there are water drops in the air and sunlight shining from behind the observer. 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. The effect can also be artificially created by dispersing water-vapour into the air during a sunny day.
A double rainbow
In a very few cases, a moonbow, or night-time rainbow, can be seen on strongly-moonlit nights.
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 (color) 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 color 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. 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 colors 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.
Light being refracted to cause a rainbow-effect
Path of light rays in the formation of a primary rainbow
Path of light rays in the formation of a secondary rainbow
Isaac Newton was the first to demonstrate that white light was composed of the light of all the colors of the rainbow, which one glass prism could split into the full spectrum of colors, and another could recombine into a beam of white light.
The rainbow has a place in legend due to its beauty and the difficulty in explaining the phenomenon before Galileo's treatise on the properties of light. It is mentioned in the Bible, Genesis 9  , as a sign of God's covenant with mankind. In Greek mythology, it is a path made by a messenger (Iris) between Earth and Heaven. The Irish leprechaun's secret hiding place for his crock of gold is usually said to be at the end of the rainbow. In Chinese mythology, the rainbow was a slit in the sky sealed by a goddess using stones of seven different colors.
The rainbow has also been used in more contemporary settings, such as the song Over the Rainbow in the musical film of The Wizard of Oz, and in selling Lucky Charms by alluding heavily to leprechaun mythology.
Rainbow is also the name of a British pre-school children's television series made by Thames Television in the 1970s and 1980s.
Rainbow is also the name of a progressive-metal/hard rock band formed by former Deep Purple guitarist and co-founder Ritchie Blackmore, also called Ritchie Blackmore's Rainbow.