Continuous function with compact domain has continuous inverse Let $A,B\subset\mathbb R$ and $f:A\to B$ be an invertible function (so 1-1 and onto). Prove that if $A$ is compact and $f$ is continuous, then the inverse $f^{-1}:B\to A$ is continuous. And give a counterexample when $A$ is not compact (no transcendentals).
If $f$ is continuous, then for every sequence $\{x_n\}$ in $A$ that converges to $L$, $\lim_{n\to\infty}f(x_n)=f(L)$. We need to prove that for every sequence $\{y_n\}$ in $B$ that converges to $K$, $\lim_{n\to\infty}f^{-1}(y_n)=f^{-1}(K)$ (Is this sufficient to prove that $f^{-1}$ is continuous?), I'm not sure how to proceed from there, and I'm having trouble coming up with a counterexample as well.
 A: To my knowledge, the most expeditious way to prove this is to use

$f$ is continuous on $X$ if and only if for any open set $V \subset Y$, $f^{-1}(V)$ is an open set in $X$.

where $X$ and $Y$ are domain and codomain of $f$ (can be arbitrary metric space).
Based on this statement, to show $f^{-1}$ is a continuous mapping of $B$ onto $A$, it is sufficient to show that for any open set $V \subset A$, $(f^{-1})^{-1}(V)$ is an open set in $B$, that is, $f(V)$ is open in $B$.
Now since $V$ is open in $A$ and $A$ is compact, $V^c \cap A$, as a closed subset of $A$, is compact (use the theorem that any closed subset of a compact set is compact). Since $f$ is continuous, $f(V^c \cap A)$ is compact and so is closed in $B$ (use the theorem that continuous mapping of any compact set is compact). Now since $f$ is one-to-one and onto, $f(V)$ is the complement of $f(V^c \cap A)$, hence is open in $B$.

For the counterexample, consider $A = [0, 1] \cup (2, 3]$, which is not compact, and define $f$ as follows:
\begin{align}
f(x) = \begin{cases}
x & x \in [0, 1] \\
x - 1 & x \in (2, 3] 
\end{cases}
\end{align}
$f$ is a one-to-one and onto function of $A$ to $B = [0, 2]$, in addition, $f$ is continuous at every point of $A$. It is easily to get that
\begin{align}
f^{-1}(x) = \begin{cases}
x & x \in [0, 1] \\
x + 1 & x \in (1, 2] 
\end{cases}
\end{align}
Hence $f^{-1}$ is not continuous at $1$! (a jump occurs here).
A: What you have:


*

*$f$ is bijective $A\to B$

*$\forall x\in A ~\forall \epsilon > 0 ~\exists \delta > 0 ~\forall x' \in A (|x - x'| < \delta \implies |f(x) - f(x') | < \epsilon)$. 


What you want:


*

*$\forall x \in A~ \forall \epsilon > 0 ~\exists \delta > 0 ~\forall x' \in A (|f(x) - f(x')| < \delta \implies |x - x'| < \epsilon)$. 


Proof by contradiction (sketch): assume for contradiction 
$$ \exists x\in A ~ \exists \epsilon > 0 ~\forall \delta > 0 ~\exists x' \in A ~(|f(x) - f(x')| < \delta ~\wedge ~ |x - x'| \geq \epsilon )$$
Then letting $\delta_k = \frac{1}{k}$ we can find a sequence $\{x_k\}$ such that $|f(x) - f(x_k)| < 1/k$ while $|x - x_k| \geq \epsilon$. 
By the Heine-Borel we have that $A$ is bounded. By Bolzano-Weierstrass we have that $\{x_k\}$ has a converging subsequence which we call $\{y_k\}$. Since $A$ is closed the limit, which we call $y$, is in $A$. 
Since $f$ is continuous and $y_k \to y$ you have $f(y_k) \to f(y)$. On the other hand since by assumption $f(x_k) \to f(x)$, the subsequence $f(y_k)$ must also converge to $f(x)$. This implies $f(x) = f(y)$. But we know that $|y - x| \geq \epsilon$ by triangle inequality and so $y \neq x$. This contradicts injectivity. 

I am assuming since you already have Heine-Borel you also have Bolzano-Weierstrass. 
