Inverse function theorem. Let $f:\mathbb{R}^{n}\rightarrow \mathbb{R}^{n}$, $C^{1}$, such that $det(f'(x))\neq 0,\ \forall\ x\in \mathbb{R}^{n}$ and $f^{-1}(K)$ is a compact set for all $K\subset \mathbb{R}^{n}$ compact. Prove that $f$ is a surjective function. 
If anyone can help, I'll be grateful.

You know $f$ is open, so $f(\mathbb{R}^n)$ is open.  It suffices to prove $f(\mathbb{R}^n)$ is closed.
Let $y\in\overline{f(\mathbb{R}^n)}$.  Choose $y_n\in f(\mathbb{R}^n)$, $y_n\to y$.  Since $\overline{B_r}(y)$ is compact, we know $f^{-1}(\overline{B_r}(y))$ is compact.  If $x_n\in\mathbb{R}^n$ be such that $f(x_n)=y_n$, then $x_n\in f^{-1}(\overline{B_r}(y))$ is a sequence in a compact subset of $\mathbb{R}^n$, hence has a convergent subsequence converging to some $x$.  Then $f(x)=y$.
