Consider a pulse moving through a medium - perhaps on a string. What happens to the pulse when it reaches the boundary of that medium depends on whether the medium is fixed in space or free to move at its end. For example, if the pulse is moving through a rope and the end of the rope is fixed or held by someone and not free to move then it could be said that the pulse is approaching a fixed end. On the other hand, if the end of the rope is lying on the floor such that it is free to move up or down when the pulse reaches its end, then it could be said that the pulse is approaching a free end.
If the end is fixed then the pulse is reflected and undergoes a phase change og 180 degrees or half a period, so a crest become a trough and vice versa.
If the end is free to move then reflection but no inversion takes place.
Inversion will always be observed when the end of the medium is fixed. When two media are connected and the pulse travelling through a medium meets a denser medium it is partially reflected and partially transmitted. The reflected part is inverted as for the fixed end.
If instead the pulse meets a lighter medium it is partially reflected and partially transmitted but undergoes no inversion.
<