Consider the function $f: \mathbb{R} \to \mathbb{R}^{\geq 0}$ defined by $f(x) = x^2$ for all $x \in \mathbb{R}$. $f$ is surjective, because for all $x \in \mathbb{R}^{\geq 0}$ we have $f(\sqrt{x}) = x$, as every non-negative real number has a square root. However, $f$ is not injective, because we have $f(1) = f(-1) = 1$ where $1 \neq -1$.
I then observed that $f$ had multiple right inverses (a right inverse of a function $f: X \to Y$ is a function $g: Y \to X$ such that $f \circ g = id_Y$, which is the identity function on $Y$), such as:
- Define $g: \mathbb{R}^{\geq 0}$ by $g(x) = \sqrt{x}$. $g$ is a right inverse, because $(f \circ g)(x) = f(g(x)) = f(\sqrt{x}) = (\sqrt{x})^2 = x$.
- Define $g: \mathbb{R}^{\geq 0}$ by $g(x) = -\sqrt{x}$. $g$ is a right inverse, because $(f \circ g)(x) = f(g(x)) = f(-\sqrt{x}) = (-\sqrt{x})^2 = x$.
In general, I have been able to find multiple right inverses for all the surjective but not injective functions I have tested. I want to prove or disprove that all functions $f: X \to Y$ where $f$ is surjective and not injective, have multiple right inverses.
My current idea is that because $f$ is not injective, there exists some $y \in \mathbb{R}$ where $f(x_0) = f(x_1) = y$ for $x_0, x_1 \in \mathbb{R}^{\geq 0}$ where $x_0 \neq x_1$. Thus, we can have two right inverses, one of which takes $y$ to $x_0$, and the other of which takes $y$ to $x_1$.
However, I don't think this is formal enough. Can someone provide a formal proof of the assertion above?