Why is it that when a transverse wave is reflected from a 'rigid' surface, it undergoes a phase change of $\pi$ radians, whereas when a longitudinal wave is reflected from a rigid surface, it does not show any change of phase? For example, if a wave pulse in the form of a crest is sent down a stretched string whose other end is attached to a wall, it gets reflected as a trough. But if a wave pulse is sent down an air column closed at one end, a compression returns as a compression and a rarefaction returns as a rarefaction.
Update: I have an explanation (provided by Pygmalion) for what happens at the molecular level during reflection of a sound wave from a rigid boundary. The particles at the boundary are unable to vibrate. Thus a reflected wave is generated which interferes with the oncoming wave to produce zero displacement at the rigid boundary. I think this is true for transverse waves as well. Thus in both cases, there is a phase change of $\pi$ in the displacement of the particle reflected at the boundary. But I still don’t understand why there is no change of phase in the pressure variation. Can anyone explain this properly?