Let $X$ be a topological space and $f:X\longrightarrow X$ a continuous function such that $f(f(x))=f(x)$ for every $x\in X$, then $f$ is a quotient map.
I really don't know if this is true, my professor asked me to prove this in an exam, so I guess is correct. I don't even know how to prove that $f$ is onto, I only noticed that $f^{-1}(f(X))=f(X)$.
Any help will be appreciated. Thank you.
As mentioned in the comments, $f$ need not be surjective. However, if we consider the range restriction $p: X \mapsto f (X)$ defined by $p (x) = f (x)$ for all $x \in X$, then $p$ is indeed a quotient map, as we can show.
By construction, $p$ is surjective: given $y$ in the range of $p$ (that is, $y \in f (X)$), there exists $x \in X$ such that $f (x) = y$. But $p (x) = f (x)$ for all $x \in X$, so it follows that there exists $x \in X$ such that $p (x) = y$, as desired.
Now, we show that $p$ is "strongly continuous" - that is, a set $V \subseteq f (X)$ is open if and only if $p^{-1} (V) \subseteq X$ is open. It helps to see that for any subset $B \subseteq f (X)$, we have that $p^{-1} (B) = f^{-1} (B)$, a property of range restrictions.
(1) Suppose $V$ is open in $f (X)$. Then there exists $W$ open in $X$ such that $V = f (X) \cap W$. We have that $p^{-1} (V) = f^{-1} (V) = f^{-1} (f (X) \cap W) = f^{-1} (f (X)) \cap f^{-1} (W) = X \cap f^{-1} (W) = f^{-1} (W)$, which is open in $X$ by hypothesis that $f$ is continuous. (This much shows that $p$ is continuous.)
(2) Suppose $V \subseteq f (X)$ is such that $p^{-1} (V) = f^{-1} (V)$ is open in $X$. Denote $f^{-1} (V)$ by $U$. Then $f (X) \cap U$ is open in $f (X) \subseteq X$.
We claim that $V = f (X) \cap U$. We had by hypothesis that $V \subseteq f (X)$. It is also easy to see that $V \subseteq U$. Given arbitrary $y \in V$, there exists $x \in U$ such that $f (x) = y$, so that by the given property of $f$, we have $f (f (x)) = f (y) = f (x) = y$. This shows that $y = f (y) \implies y \in f^{-1} (V) = U$. Now consider arbitrary $y \in f (X) \cap U$. The fact that $y \in U = f^{-1} (V)$ means that $f (y) \in V$. But $y \in f (X)$ means that there exists $x \in X$ such that $y = f (x)$. By the given property of $f$, we have that $f (f (x)) = f (y) = f (x) = y$. Since $f (y) \in V$ and $y = f (y)$, then $y \in V$.
This shows that $V = f (X) \cap U$ is open in $f (X)$, as desired.