Reflection of a shock wave into a density gradient