# If $gf$ is 1-1, is $g$ 1-1?

Suppose $gf$ is 1-1. Is $g$ 1-1?

Let $g(f(x_0)) = g(f(x_1))$.

Then $x_0 = x_1$.

Then $f(x_0) = f(x_1)$.

So $g$ is 1-1.

Maybe there might not exist an $x_0$ or an $x_1$, but I assume since $gf$ is 1-1, then an $x$ must exist. So I wouldn't need to prove $f$ is onto.

-
Are you supposed to show that $f$ is one-to-one, or that $g$ is one-to-one? Your question title and question body disagree. One of these is true and the other is false, so it certainly matters. –  Zev Chonoles Sep 28 at 19:02
@ZevChonoles Cleared it up. –  Don Larynx Sep 28 at 19:14
That only proves that $g$ is $1-1$ when restricted to the image of $f$. What if $y\neq f(x)$ for all $x$? –  Thomas Andrews Sep 28 at 19:20

Let $f: \{0\} \to \{0, 1\}$ be the function that takes $0$ to $0$. Let $g: \{0, 1\} \to \{0\}$ be the unique function, taking both elements to $0$. Then $gf$ is the identity function on the set $\{0\}$, but $g$ is clearly not 1-1.

-
If $g\circ f$ is one to one then $f$ is one to one.
Proof let $x$ and $y$ such that $f(x)=f(y)$, then $g\circ f(x)=g\circ f(y)$ hence $x=y$ since $g\circ f$ is one to one. And we have shown that $f(x)=f(y)$ implies $x=y$ and so $f$ is one to one.
The function $g$ doesn't have to be 1-1 because its domain may be larger than the image of $f$. For example, set $g(x) = x^2$ and $f(x) = \sqrt{x}$. You have $(g \circ f)(x) = x$ which is 1-1 on the positive reals, but $g$ as a function on all reals is not 1-1.