The right end of a string is tied down - this is what we call a fixed end. When a wave traveling along the string hits the fixed end, what happens?
A wave on a string is flipped when it reflects from a fixed end, and is reflected upright (no flip) when it reflects from a free end. Flipping the wave is equivalent to shifting it by half a wavelength.
Now consider a wave traveling along a light string tied to a heavy string. At the interface part of the wave is transmitted and part is reflected - the interface acts like a fixed end, so the reflected wave is inverted.
For a wave traveling along a heavy string tied to a light string the reflected part of the wave is not inverted when the wave reflects.