$$\require{cancel}$$
We already know that a wave which moves from one medium to another can change speed. In many cases this causes a bending of the wave called refraction. A second effect also occurs when a wave goes from one medium to another. There is usually a partial reflection of the wave, depending on how different the two mediums are. Reflection can be of two types, depending on whether the boundary is 'soft' or 'rigid'. If the wave is going from a more rigid medium into a softer medium the reflected wave will have the same phase as the incoming wave. Waves in a soft medium reflecting from a boundary with a stiff medium will change phase by $$180\text{ degrees}$$. The simulation below shows this effect.