This is a simulation of the processes involved in the formation of a rainbow. The 3D image on the right shows the location of a rainbow as seen by an observer on the ground. The green plane represents the ground. The blue dot on the green plane represents the position of the person viewing the rainbow. Change the angle of the sun above the horizontal and watch how the position of the rainbow changes.
On the right in the 2D view you can see the actual refraction and reflection that occurs in each raindrop. The white light enters the spherical raindrop, and it undergoes refraction (bending) and dispersion (different wavelengths/colors bending by slightly different amounts). Only the extreme red and violet rays are shown. On the right side of the raindrop reflection occurs. Near the bottom of the raindrop the light leaves the drop, again refracting and dispersing. The light from the red end of the spectrum comes out of the drop below the light from the violet end of the spectrum. This confuses some, as red is the color located at the top of a rainbow and violet is on the bottom. You can zoom in on the raindrops in the 3D view (by clicking the button). This view may help people understand this apparent contradiction. The drop that sends the red light to the viewer needs to be higher in the sky than the drop that sends the violet ray to the viewer (with all the other colors in between, of course).