EDIT 4: the impossibility of such an example for $\mathbb{R}$ has been confirmed positive in this paper.
EDIT 3: not a duplicate - the linked question has an answer only for dimensions $n>=3$. Considering the examples given in the comments, additional criteria:
- The map must be defined on all of $\mathbb{R^2}$
- It must be open and closed as a map to $\mathbb{R^2}$, not $f(\mathbb{R^2})$
EDIT 2: duplicate of this question, voting to close.
EDIT: It appears I've read wrong and the exercise asks for $f$ not necessarily defined on the whole plane. I'm leaving the question open for a possible example on the whole plane.
Finding an example of such a map is a part of an exercise from John Lee's "Introduction to Topological Manifolds", suggesting that it's possible, but I'm failing to do so. We are looking for a map $f: \mathbb{R^2} \rightarrow \mathbb{R^2}$ that is open, closed, but not continuous, with the usual topology on $\mathbb{R^2}$ spanned by open disks $B_r(x) = \{y \in \mathbb{R^2}: ||y-x|| < r\}$. So far it seems to me (argumentation below) that it's impossible in the case of $f: \mathbb{R} \rightarrow \mathbb{R}$, and that this argumentation can be extended to prove that it's also impossible in the plane case.
Let $f: \mathbb{R} \rightarrow \mathbb{R}$ be open and closed, and let $x_0$ be a point of discontinuity. We distinguish the cases:
- (Isolated) $f_{x \rightarrow x_0-} = f_{x \rightarrow x_0+} = y_1, f(x_0) = y_2$. Then $f((a,b) \ni x_0) = (c_1, c_2) \cup\{y_2\} \cup (c_3, c_4)$ - not open.
- (Jump) $f_{x \rightarrow x_0-} = y_1, f(x_0) = f_{x \rightarrow x_0+} = y_2$.Then $f((a,b) \ni x_0) = (c_1, y_1) \cup\ [y_2, c_2)$ - not open.
- (One-sided infinity) $f_{x \rightarrow x_0-} = +\infty, f(x_0) = f_{x \rightarrow x_0+} = y$. Then for $(a,b) \ni x_0$ small enough so that $f(x) > y, \forall x \in (a,x_0)$ we have $f((a,b)) = (c_1, +\infty) \cup [y, c_2)$ - not open.
- (Double-sided infinity) $f_{x \rightarrow x_0-} = +\infty, f(x_0) = y, f_{x \rightarrow x_0+} = -\infty$. Then for $(a,b) \ni x_0$ small enough so that $f(x) > y, \forall x \in (a,x_0)$ and $f(x) < y, \forall x \in (x_0,b)$ we have $f((a,b)) = (c_1, +\infty) \cup \{y\} \cup (-\infty, c_2)$ - not open.
Other cases are essentially the same.(jump from the other side, infinity with the same sign, etc.). Am I missing some cases? Or is this correct, but there are significantly different cases for $\mathbb{R^2}$?