1.After a rain when the sun rays are making  angle of 40 to 42 degrees with the horizontal then we have a possibility of  primary rainbow.
2.First the Sun rays are refracted in to water drops suspended in air some hundreds of meters in to the sky.
3.Then those light rays are totally internally reflected and then refracted to reach the human eye at a cone angle of 40 to 42 degrees.
4.Red color is visible on top and violet is on the bottom.
5.The dispersion of light takes place at the last refracting surface of water drops.
6.A secondary rain bow is also formed with violet on top and red below other colors.
7.It is fainter than the primary rainbow. It is due to two total internal reflections before the light emerges out of the water drops.
8.The pattern of rainbow appears as VIBGYOR--violet,indigo,blue,green,yellow,orange and finally red from bottom to top.
1 5 1
Formation of rainbow occurs due to dispersion of sunlight through raindrops. When sunlight enters a raindrop it gets split into its seven constituent colours-that is violet, indigo, blue, green, yellow, orange and red and this is what appears in the form of a rainbow. 
1 3 1