I'm having difficulty with proving directly that every metric space is a Tychonoff space. I can show that every metric space is Hausdorff.

Let be a metric space, let be a closed subset of , let . Hint: Define by . So, and for every . I am stuck on proving that this function is continuous. Anyone can help me?