Reflection phase change
A phase change sometimes occurs when a wave is reflected, specifically from a medium with faster wave speed to the boundary of a medium with slower wave speed. Such reflections occur for many types of wave, including light waves, sound waves, and waves on vibrating strings. General theory 
For an incident wave traveling from one medium (where the wave speed is ) to another medium (where the wave speed is ), one part of the wave will transmit into the second medium, while another part reflects back into the other direction and stays in the first medium. The amplitude of the transmitted wave and the reflected wave can be calculated by using the continuity condition at the boundary. Consider the component of the incident wave with an angular frequency of , which has the waveformAt t=0, the incident reaches the boundary between the two mediums at x=0. Therefore, the corresponding reflected wave and the transmitted wave will have the waveformsThe continuity condition at the boundary isThis gives the equationsAnd we have the reflectivity and transmissivityWhen , the reflected wave has a reflection phase change of 180°, since . The energy conservation can be verified byThe above discussion holds true for any component, regardless of its angular frequency of . The limiting case of  corresponds to a "fixed end" that doesn't move, whereas the limiting case of  corresponds to a "free end". Optics
Light waves change phase by 180° when they reflect from the surface of a medium with higher refractive index than that of the medium in which they are travelling. A light wave travelling in air that is reflected by a glass barrier will undergo a 180° phase change, while light travelling in glass will not undergo a phase change if it is reflected by a boundary with air. For this reason, optical boundaries are normally specified as an ordered pair (air-glass, glass-air); indicating which material the light is moving out of, and in to, respectively. "Phase" here is the phase of the electric field oscillations, not the magnetic field oscillations (while the electric field will undergo 180° phase change, the magnetic field will undergo 0° phase change. Vice versa is true when reflection occurs at lower refractive index interface.) Also, this is referring to near-normal incidence—for p-polarized light reflecting off glass at glancing angle, beyond the Brewster angle, the phase change is 0°. The phase changes that take place upon reflection play an important part in thin film interference. Sound waves

Sound waves in a solid experience a phase reversal (a 180° change) when they reflect from a boundary with air. Sound waves in air do not experience a phase change when they reflect from a solid, but they do exhibit a 180° change when reflecting from a region with lower acoustic impedance. An example of this is when a sound wave in a hollow tube encounters the open end of the tube. The phase change on reflection is important in the physics of wind instruments. Strings

A wave on a string experiences a 180° phase change when it reflects from a point where the string is fixed. Reflections from the free end of a string exhibit no phase change. The phase change when reflecting from a fixed point contributes to the formation of standing waves on strings, which produce the sound from stringed instruments. The same 180° phase change happens when the wave traveling in a lighter string (lower linear mass density) reflects off of the boundary of a heavier string (higher linear mass density). This happens because the heavier string doesn't respond as quickly to the tension force as the lighter string, and therefore the amplitude of the oscillation at the boundary point is less than the incoming wave. By the superposition principle, the reflected wave must cancel part of the incoming wave, and therefore it is phase shifted. Note that when the wave traveling in a heavier string reflects off of the boundary of a lighter string, since the boundary point has the freedom to move as quickly as possible, no such phase shift would occur in the reflected wave. Electrical transmission lines
Reflections of signals on conducting lines typically exhibit a phase change from the incident signal. There are two extreme cases of termination: short circuit (closed line), and open circuit (broken line). In both cases the full amplitude of the wave is reflected. short circuit The voltage wave reflection on a line terminated with a short circuit is 180° phase shifted. This is analogous (by the mobility analogy) to a string where the end is fixed in position, or a sound wave in a tube with a blocked off end. The current wave, on the other hand, is not phase shifted. broken / open line A transmission line terminated with an open circuit is the dual case; the voltage wave is shifted by 0° and the current wave is shifted by 180°. reactive termination A transmission line terminated with a pure capacitance or inductance will also give rise to a phase shifted wave at full amplitude. The voltage phase shift is given by  where 
Z0 is the characteristic impedance of the line
X is the susceptance of the inductance or capacitance, given respectively by ωL or 
L and C are, respectively, inductance and capacitance, and
ω is the angular frequency. In the case of reactive termination the phase shift will be between 0 and +180° for inductors and between 0 and −180° for capacitors. The phase shift will be exactly ±90° when |X| = Z0. For the general case when the line is terminated with some arbitrary impedance, Z, the reflected wave is generally less than the incident wave. The full expression for phase shift needs to be used,

This expression assumes the characteristic impedance is purely resistive. See also
Reflection coefficient

References

Physical optics
Wave mechanics
Sound