I don't see much hope of getting a simple formula for such a map. The obvious inclusion map from {0,1} to {0,1,2} gives an injective map . Also, there is an obvious injective map from {0,1,2} to {0,1}×{0,1}, and this extends to an injective map . You could try applying one of the constructive proofs of the Cantor–Schröder–Bernstein theorem to this pair of maps in order to find a bijective map (which would probably turn out to be a homeomorphism). I haven't tried to do that, and I don't know whether it would be workable, but I can't think of any other approach to the problem.