When the white light rays of the sun fall on the rain drops they act as a tiny prism and reflect the light. Then the light splits into the seven colours: red, orange ,yellow ,green ,blue indigo and violet. This is also called the dispersion of light, first defined by Sir Isaac Newton.
Hope this helps.....
 : )
Rainbow is formed due to the dispersion of light. it means splitting up of white light ie sunlight into its component colours.its usally formed after the rain if there is sunlight. after the rain,atmosphere will contain water droplets. these drops will act as small prisms.when sunlight passed through it light will get dispersed .but it seems as one drop is in one colour which is due to the the difference in the frequency of light.colours are inthe order of makinng an angle between 40.8deg to 42.8deg with the eyeline to centre of the arc so its in the form of an arc of a circle