When light goes through different transparent substances, it appears to bend or change direction, for example, when it goes from air to water or vice versa. This phenomenon is called refraction. Refraction happens at the interface of two substances, i.e. where the substances meet (their boundaries). However, if light passes through the interface vertically (at a 90 degree angle), refraction does not occur. The straw in the picture below looks broken because of refraction. Additionally, on sunny days, it looks like there is water on the road ahead when travelling by car. This is also due to refraction and it is called a mirage.
Water or glass are more dense materials than air, so light slows down when it travels from air into glass or water, and it speeds up when it enters air from glass or water. The diagram below is essential to understanding refraction of light, so study it carefully.
The green and red lines show the speed and direction of light in air and water, whereas the dotted line needs to be drawn on the diagram by us, so we can calculate the angles of incidence: A and C (when light hits the different medium) and the angles of refraction, B and D (when light comes out of the interface). In the first diagram, A is bigger than B (A > B), because water is more dense than air. In the second diagram, D is bigger than C (D > C), because air is less dense than water, so light speeds up when it enters air.
To sum up, refraction is the bending of light rays caused by the change in their speed as they pass from one transparent medium to another. This causes objects to appear bent or broken. The amount the light bends is determined by whether it is travelling from a more or less dense material and the angle of the bend can be calculated by measuring the angles of incidence and refraction as shown in the diagram above.