Continuous map of Hausdorff space Let $f: X\rightarrow Y$ be a continuous map of Hausdorff space and $K\subseteq X$ be a compact subset. Suppose that 
$(a)$ $f|_K: K\rightarrow f(K)$ be a homeomorphism, and 
$(b)$ for every $x\in K$ there exists open neighborhood $U_x$ of $x$ and $V_x$ of $f(x)$ such that $f$ stricts to a homeomorphism $U_x\rightarrow V_x$ given by $x\mapsto f(x)$ i.e. $V_x=f(U_x)$.
Then I want to prove that there exists an open subset $U\subseteq X$ containing $K$ and an open subset $V\subseteq Y$, such that $f$ restricts to a homeomorphism $U\rightarrow V$ given by $x\mapsto f(x)$.
I have no idea how to construct this open set, maybe it should be the intersection of the open neighborhood of $x\in K$? But I think it is not necessary to keep it open. Can someone help me?
Then I tried like below:
Since $\{U_x|x\in K\}$ is an open cover of $K$, then by compactness of $K$, it should have a finite subcover say $\{U_{x_i}|i=1,...,n\}$
Then define $U=\bigcup_{i=1}^n U_{x_i}$.
I can see that the restriction is continuous and surjective, but I can not show that it is also injective, and therefore the continuity of its inverse map.
 A: I think your choice $U = \bigcup_{i=1}^nU_{x_i}$ might be problematic.
Assume that we have $K \subsetneq U$, i.e. $U \backslash K \neq \emptyset$, and assume that $\#(U \backslash K) \geq 2$. Let $Y := X/\sim$, where $x \sim x' :\iff x,x' \in U\backslash K$, and let $f : X \twoheadrightarrow X/\sim$ be the canonical projection.
Then, $f|_U : U \to V=f(U)$ is injective, if for $x,x' \in U$, with $x \neq x'$, we have $f|_U(x) \neq f|_U(x')$. However, if we choose $x,x' \in U \backslash K$, such that $x \neq x'$ (here, we used that $\#(U\backslash K)\geq 2$), then we always have $f|_U(x) = f|_U(x')$, because $x \sim x'$.
This construction doesn't contradict condition (a), since $\sim$ doesn't affect the elements of $K$. I think it doesn't contradict condition (b), if you choose $X$ to be a "nice" space, like some subspace of $\mathbb{R}^d$ for instance.
I'm not entirely sure this is correct. Am I missing something?
A: Under the additional assumption on $Y$ that for each nbhd of a point there exists a smaller nbhd whose closure is also contained in the first nbhd (this is sometimes called T3), I have a proof.
Using the above assumption, you can find a finite cover $U_i$ of $K$ such that $f_{\bar{U_i}}$ is a closed embedding. Then you can define $V_1 = f^{-1}(f(U_1)\backslash f(K\backslash U_1))$. Note that

*

*$V_1\subset U_1$

*$V_1$ is open

*by injectivity on $K$ that $K\cap V_1=K\cap U_1$

*$f_{|\bar{V_1}\cup K}$ is a closed topological embedding

Now we can proceed inductively by replacing $K$ in the previous by $\bar{V_1}\cup K$, and then $\{V_i\}$ will be an open cover of $K$ (by 2. and 3.) on whose union $f$ is injective, and since $\cup V_i \subset\cup U_i$ an open map, and obviously surjective on its image.
