Consider a ray of light incident obliquely at a boundary separating two media.
(1) If the refractive index of the second medium is greater than that of the first medium, the ray bends towards the normal at the point of incidence as it travels from the first medium (optically rarer medium) to the second medium (optically denser medium). The angle of refraction (r) is less than the angle of incidence (i).

Fig. A ray of light travelling from a rarer medium to a denser medium (Schematic diagram)

Fig. A ray of light travelling from a denser medium to a rarer medium (Schematic diagram)
(2) If the refractive index of the first medium is greater than that of the second medium, the ray bends away from the normal at the point of incidence as it travels from the first medium (optically denser medium), to the second medium (optically rarer medium). The angle of refraction (r) is greater than the angle of incidence (i).
[Note In this chapter, a rarer medium means an optically rarer medium and a denser medium means optically denser medium unless stated otherwise.]