If $f$ is bijection in a dense subset then $f$ is bijection in all space Let $X=(X,\mathcal{T}_X)$ and $Y=(Y,\mathcal{T}_Y)$ be topological Hausdorff spaces and $f: X \longrightarrow Y$ be a continuous function. If $f:D \subset X \longrightarrow Y$, with $D$ dense in $X$, is a bijection (one-to-one and onto) then $f:X \longrightarrow Y$ is a bijection too.
This is true in general?
 A: This is not true in general, and the fact that $X$ and $Y$ are topological spaces (or that $D$ is dense in $X$ and $f$ is continuous) is not relevant to the question.
Suppose that $D$ is a strict subset of $X$. Since $f\vert_D$ is onto, we have that for each $y\in Y$, there is some $x\in D$ such that $f(x) = y$. Then, for each $x^\prime\in X\setminus D$, we have that there is some $x\in D$ so that $f(x) = f(x^\prime)$.
This implies that $f$ is not injective.
More generally, Take any two sets $X$ and $Y$, and a function $f\colon X\to Y$ whose restriction $f\vert_D \colon D\to Y$, where $D\subsetneq X$ is a strict subset, is surjective. Then, $f$ cannot be injective.
However, this also helps one see that if $D = X$, then, trivially, the claim is true.
A: Here's a nice extreme example. Let $X$ be any set with at least two elements and fix $x\in X$ to be one of them. Consider the topology $\{\varnothing\}\cup\{A\mid x\in A\}$.
Now let $Y$ be any topological space, and fix $y\in Y$. Now consider the constant function $f(u)=y$ for all $u\in X$. This function is a bijection on the dense set $\{x\}$, since any function is injective on a singleton, and it is continuous since if $U$ is any open set, then $f^{-1}(U)$ is either empty or $X$, both of which are open. But $f$ is far from a bijection.
A: Here is a counterexample in which $X$ is Hausdorff:
Consider the continuous function $f: [0, 1] \to S^1$ given by $t \mapsto (\cos 2\pi t, \sin 2\pi t)$. It's not bijective, since $f(0) = f(1)$. Yet, $[0, 1)$ is dense in $[0, 1]$ and the restriction of $f$ to $[0, 1)$ is a bijection.
