Suppose X and Y are path connected. By definition, for any there is a continuous function with and

Now let and be two points in and let be the path in from to and be the path in from to . Define by . Then and .

You should know a theorem that tells you is continuous since it maps into a product space and each coordinate is given by a continuous function(Thm 19.6 in Munkres)