Why there is a $180^{\circ}$ phase shift for a transverse wave and no phase shift for a longitudinal waves upon reflection from a rigid wall? 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?
 A: Great question!
You might have learned that the amplitude of compression and the amplitude of particle displacements are not synonymous.  In fact, the maximum amplitude of pressure and the maximum amplitude of particle displacements are out of phase for $\pi/2$.  And twice $\pi/2$ (one for original, and one for the reflected wave) accounts for the missing $\pi$ in the phase change of particle displacement.
Imagine, that rarefaction travels towards the wall, which is on the right side.  On the moment the wave strikes the wall, maximum displacement is left of rarefaction, that is $\pi/2$ behind it.  The same is true for the reflected wave, that is, maximum displacement is again left of the rarefaction, only the direction of the wave is opposite, so maximum displacement amplitude is $\pi/2$ in front of rarefaction.
Thus, the phase of particle displacement changes phase for $\pi$, while the phase of pressure does not change at all at rigid surface.
A: Here is another possible way of explanation:
Reflection of the wave is similar process as crushing two waves, one from the left and one from the right, which meet exactly at the surface.  Now, if you wish that particle at the surface has zero displacement, then the wave on the right must be point-symmetrical through that particle to the wave on the left.
If left wave pulls particle at the surface up, the right wave must pull it down.  If left wave pulls particle at the surface down, the right wave must pull it up.
Obviously, trough and crest match.
If left wave pulls particle at the surface left, the right wave must pull it right.
However, pulling left from the left and right from the right both corresponds to rarefaction.
If left wave pushes particle at the surface right, the right wave must push it left.
However, pushing right from the left and pushing left from the right both corresponds to compression.
I really love this problem (as mentioned above) but this explanation is furthest my mind is able to go...
A: When a transverse wave travel in a medium the particle velocity is in upward direction &wave velocity is in forward direction.When a transverse wave meet the surface of the wall,it exert force in upward direction,because particle velocity of wave is in upward direction.so wall also exert force in downward direction(Newton's third law).so particle the particle velocity get reversed.so if we send crest it reflects as though.ln the case of longitudinal wave  velocity& particle velocity both are in forward direction.so when it meet the wall it exert force in forward direction so wall exert force in backward direction. The phase of wave get change by  π radian .but compression remain as computation.
