A ray of light starting from diamond is incident on the interface separating diamond and water is as shown in the figure.
When a light is going from medium 1 to medium 2. The refractive index is defined as a ratio of velocity of light in medium 1 to velocity of light in medium 2. Refractive index is the factor which deals with the amount of bending of light. More refractive index means more it will bend in the medium 2. When it is 1 we can say that light has not been bent.
By Snell's law, Refractive index is given by,
sin (i) ÷ sin (r) = μ₂ ÷ μ₁
where i is the the angle of incidence
r is the angle of refraction
μ₂ & μ₁ are refractive index of medium 2 and 1 respectively.
Light bends as it passes from diamond to water at an angle due to Refractive index between air and glass.
white light consist of number of colors, each color has its own wavelength. Refractive index of an optical medium changes with the wavelength, therefore each color of white light get splitted from white light this phenomenon is know as dispersion of the light.