How to find a homeomorphism $\mathbb{R}^{n}\rightarrow\mathbb{R}^{n}$ having certain properties Let $n\ge 2$ and let $C$ be a Cantor space in $\mathbb{R}^{n}$. That is, $C$ is homeomorphic to the Cantor ternary set.
Let $x$ and $y$ be two points in $\mathbb{R}^{n}-C$, and let $L_{xy}$ be the straight line segment joining them. For a fixed $\varepsilon>0$ we would like to to find a homeomorphism $\phi:\mathbb{R}^{n}\rightarrow\mathbb{R}^{n}$ such that

*

*$\phi(x)=x$ and $\phi(y)=y$.

*Outside an $\varepsilon$-neighborhood of $L_{xy}$, $\phi$ is the identity, and $|\phi(z)-z|<\varepsilon$.

*$\phi(L_{xy})\cap C=\emptyset$.


How do we construct/show existence of such a homeomorphism $\phi?$

 A: I will first give a proof in the case $n\ge 3$ and then explain how to modify it to include the case $n=2$.
Without loss of generality (after applying a rotation and rescaling), the segment $L=L_{xy}$ is contained in the $x_n$-axis, and also $x=0$ and $y=(0,...,0,1)$.
Take $m\in {\mathbb N}$ sufficiently large (see below) and for $i=0,...,m-1$ consider congruent cubes $Q_i$ in $R^n$ given by the inequalities
$$
- \frac{1}{2m} \le x_k\le \frac{1}{2m}, k=1,...,n-1, \frac{i}{m}\le x_n\le \frac{i+1}{m}.  
$$
These closed cubes cover the unit interval $L$; $x$ belongs to the bottom of the first cube and $y$ belongs to the top of the last cube.  Set
$$
Q:= Q_0\cup...\cup Q_{m-1}, U:= {\mathbb R}^n \setminus Q.
$$
The number $m$ is chosen so that the diameter of each cube is $\le \epsilon$. In each cube $Q_i$ inscribe the sphere $\Sigma_i$ of diameter $1/m$. (The center of the sphere lies on the segment $L$.) It suffices to consider the case when the intersection points of these spheres with $L$ are all disjoint with the Cantor set $C$.
(This is achieved by moving the points $x, y$ a bit along the $x_n$-axis.) These intersection points are
$$
p_i=(0,...,0, \frac{i}{m}), i=0,...,m. 
$$
I will use the notation $L_i$ for the segments $p_i p_{i+1}$.
Since the dimension of each sphere is $\ge 2$ (this is where I use the assumption $n\ge 3$), the intersection $C\cap \Sigma_i$
does not separate this sphere. Therefore, for each $i$ there exists a smooth simple path $c_i$ in $\Sigma_i$ which is disjoint from
$C\cup \partial Q_i$ except for the end-points  $p_i$, $p_{i+1}$ which, of course, lie on $\partial Q_i$.
Since $c_i$ lies on the sphere $\Sigma_i$, it is "unknotted" in the cube $Q_i$ (where the unknotedness is understood relative the end-points of $c_i$ which are supposed to be fixed by the unknotting isotopy).
Remark. Of course, the unknotedness is only an issue in the case $n=3$, in higher dimensions it is automatic.
Hence, for each $i$ there exists a self-homeomorphism $f_i: Q_i\to Q_i$ which equals the identity on the boundary of the cube and takes $L_i$ to $c_i$. Extend these homeomorphisms by the identity to the $U$. The result
is a homeomorphism $f: {\mathbb R}^n\to {\mathbb R}^n$.  By the assumption about the diameters of the cubes $Q_i$, the map
$f$ has displacement $\le \epsilon$:
$$
 d(z, f(z))\le \epsilon ~~\forall~z\in {\mathbb R}^n. 
 $$
By the construction, $f$ takes $L$ to the concatenation of the curves
$$
 c=c_0\star c_1\star .... \star c_{m-1},
 $$
which is a curve connecting $x$ to $y$ and disjoint from $C$.
This completes the proof in the case $n\ge 3$. To deal with the case $n=2$, we do not need the circles $\Sigma_i$, but for each $i$ take any smooth simple path $c_i$ in $Q_i$ connecting $p_i$ to $p_{i+1}$ and disjoint from
$C\cup \partial Q_i$ except for the end-points  $p_i$, $p_{i+1}$ which, of course, lie on $\partial Q_i$. In dimension 2 any path in a square is unknotted, hence, we  again get our homeomorphism $f_i: Q_i\to Q_i$, taking $L_i$ to $c_i$ and equal to the identity on $\partial Q_i$. The rest of the proof is the same as for dimensions $n\ge 3$. qed
