Do continuous mappings always have an inverse? A theorem of general topology states that: 
A mapping $f$ from $X$ to $Y$ is continuous if and only if the inverse image of any open set in $Y$ is open in $X$. 
Does this mean that continuous functions always have inverses?
 A: Please convince yourself that following two concepts are Not same :


*

*having inverse (i.e., existence of function $g$ such that $g\circ f=f\circ g =Id$)

*Inverse image of $U\subseteq Y$ i.e., $f^{-1}(U)=\{x\in X : f(x)\in U\}$


All you can say is 


*

*If $f$ is invertible then your $f^{-1}(U)$ for any $U\subseteq Y$ would be nonempty as your function $f$ is surjective.


You can not even say that


*

*$f$ is always  invertible even if your $f^{-1}(U)$ is non empty for every subset $U$ of $Y$ as Non emptiness of $f^{-1}(U)$ for each $U\subseteq Y$ would just say that it is surjective which is not sufficient for invertibility.


P.S : I bet most of the students would get confused with this... way to go!!! :)
A: A function $f: X\to Y$ is continuous if and only if $f^{-1}[U]\subset X$ is open in $X$ for every $U\subset Y$ open in $Y$.
Where: $f^{-1}[U]=\{x\in X : f(x)\in U\}$ - is the inverse image of $U$.
The inverse image is definable even if the function is not invertible.
For example $f(x)=x^2$, $f:\mathbb R\to\mathbb R$, then
$f^{-1}[(0,1)]=(-1,1)$.
A: There are several issues here. For any $f:X\to Y$, we can think of its inverse as a function not defined on $Y$ but rather on $\mathcal P(Y)$, the collection of subsets of $Y$, and taking values not on $X$ but on $\mathcal P(X)$. (So $f^{-1}$ is an example of a set valued function.)
As indicated in the other answers, this inverse function is given by $$f^{-1}[A]=\{x\in X\mid f(x)\in A\}$$ for any $A\subseteq Y$. If it happens that $f$ is injective then, letting $f(X)=\{f(x)\mid x\in X\}$, we have that for any $y\in f(X)$, $f^{-1}[\{y\}]=\{x\}$ for some unique $x\in X$ (that, of course, depends on $y$), and in that case we can think of $f^{-1}$ as an actual function from $f(X)$ to $X$, given by $f^{-1}(y)=x$ iff $f^{-1}[\{y\}]=\{x\}$ iff $f(x)=y$. (I agree the notation is not ideal and can be confusing when first encountered.)
A different issue is whether, in the presence of continuity, the function $f$ admits a genuine inverse. One immediately sees that this is not the case, as $f$ could be constant. OK. Let's change the question then. Assuming that $f$ is continuous and not constant in a neighborhood of $x\in X$, is there a neighborhood of $x$ (perhaps very small) where $f$ is $1$-$1$ and therefore invertible? Again, the answer is no, as $f(x)=x^2$ illustrates: This function is not invertible in any neighborhood of $0$. But $0$ is an extreme value (a local minimum). OK. So, we could change the question yet again, to: Assuming that $f$ is continuous, that $x\in X$, and that $x$ is not an extreme value of $f$, is there a neighborhood of $x$ where $f$ is invertible? Remarkably, the answer is still no. In fact, there are continuous functions $f:\mathbb R\to\mathbb R$ that are not constant in any interval and yet are not invertible in any interval so, even though any interval contains points that are not extreme values, $f$ is not $1$-$1$ in any neighborhood (see here).
What if we require more than continuity, say, what if we require that $f:\mathbb R^n\to\mathbb R^m$ is differentiable, and the derivative is "well-behaved"? Well, in that case we actually have some positive results, the most famous being the so-called inverse function theorem but the specific assumptions are somewhat technical. See this nice blog post by T. Tao for its statement and some variants.
