Theory:

Consider the case of a pencil that appears to be displaced while partially submerged in water. The light that reaches you from the part of the pencil that is submerged appears to come from a different direction than the light that reaches you from the part of the pencil that is above water. The pencil seems to be displaced at the interface as a result of this.

pencil-gab3b7db7c_1920.jpg
Pencil submerged in water
 
When a light ray travels obliquely from one transparent medium to another, it deviates from its original path. Refraction is the term for the deviation of a light ray. The difference in the velocity of light in different media causes refraction. In a rarer medium, light travels faster, while in a denser medium, it travels slower. The refraction of light is governed by two refraction laws.
 
First law of refraction: The incident ray, the refracted ray of light and the normal to the refracting surface all lie in the same plane.
 
Second law of refraction: The ratio of the sine of the angle of incidence and sine of the angle of refraction is equal to the ratio of refractive indices of the two media. This law is also known as Snell’s law.
 
SiniSinr=μ2μ1
 
The refractive index tells us how fast or slow light travels through a medium. The ratio of the speed of light in vacuum (\(c\)) to the speed of light in a medium (\(v\)) is defined as the refractive index ‘\(µ\)’ of that medium.
 
μ=cv
 
The speed of light in a medium with a high refractive index is slower than in a medium with a low refractive index, and vice versa. When light travels from a denser medium to a rarer medium, the refracted ray is bent away from the normal drawn to the interface. When light travels from a rarer medium to a denser medium, the refracted ray is bent towards the normal drawn to the interface.