Fact 1: a rainbow is formed by refraction of light by separating light into all different colors. 
Fact 2: Light passing through a prism is refracted or divided into the colors of the spectrum.
A rainbow is formed by passing light through a prism.