Let $ Y $ be a subspace of both a Hausdorff space $ X _ 1 $ and a Hausdorff space $ X _ 2 $ such that $ \mathop { \rm { cl } } _ { X _ 1 } ( Y ) = X _ 1 $ and $ \mathop { \rm { cl } } _ { X _ 2 } ( Y ) = X _ 2 $. Suppose that the identity function $ i : Y \to Y $ can be extended to a continuous function $ f : X _ 1 \to X _ 2 $ as well as to a continuous function $ g : X _ 2 \to X _ 1 $. Prove that $ X _ 1 $ and $ X _ 2 $ are homeomorphic.
I am thinking to prove this by using the properties of continuous function between two topological spaces. But I get stuck in the part $ f ^ { - 1 } $ to prove that is a continuous function.
Thanks for the help.