Since different colours of light travel at different speeds, the refractive index is different for each colour. As a result, when light passes through the refracting surface of the prism,its components bend into different angles, causing the single beam of light to separate