A ray of light bends from one medium to another when it travels because there is a change in the speed of the light.