# injectivity, functions

Let $f: X\longrightarrow Y$ and $g: Y\longrightarrow Z.$

Show that $f : X\longrightarrow Y$ is bijective if and only if there exists $g: Y \longrightarrow X$ with $g \circ f = \operatorname{id}_X$ and $f \circ g = \operatorname{id}_Y.$ What happens if you drop one of the two conditions on $g$?

I needed help in constructing simple counterexamples to bijectivity of $f$ in either case.

What I have so far:

Define $g : Y \longrightarrow X$ by $g(f(x)) = x$ for all $x \in X.$ To show that $g$ is well-defined, suppose $f(c)$ and $f(d)$ are the same, but $c$ and $d$ are different (i.e. $f$ isn't injective); that is, let $y = f(c) = f(d),$ where $c \neq d.$ Then $g(y) = g(f(c)) = c,$ and also $g(y) = g(f(d)) = d.$ Hence, $c = d,$ which is a contradiction by the injectivity of $f.$

That $g \circ f = \operatorname{id}_X$ is true by the way we defined $g.$

As for $f \circ g = \operatorname{id}_Y:$

\begin{align*} f(g(y)) &= f(g(f(x)) &&\text{for some }x \in X\text{ (since }f\text{ is surjective)}\\ &= f(x) &&\text{(since }g\circ f=\mathrm{id}_X\text{)}\\ &= y \end{align*} as required.

Conversely, suppose there exists $g : Y \longrightarrow X$ with $g \circ f = \operatorname{id}_X$ and $f \circ g = \operatorname{id}_Y.$ Since $f \circ g = \operatorname{id}_Y$ is onto, part a) allows us to conclude that $f$ is surjective (onto). Since $g \circ f = \operatorname{id}_X$ is 1-1, part a) allows us to conclude that $f$ is injective (1-1).

Hence, $f$ is a bijection.

-
$\LaTeX$ please. – user38268 Jan 22 '12 at 1:56
Can you please edit it, I am still trying to learn Latex – Buddy Holly Jan 22 '12 at 2:13
Also, you have already posted this question before and it was closed; please see math.stackexchange.com/questions/100102/…. Please do not duplicate questions. – Amitesh Datta Jan 22 '12 at 2:27
the only part different is: What happens if you drop one of the two conditions on g ? And this part I'm stuck on – Buddy Holly Jan 22 '12 at 2:29
Try working on this example: $f:\mathbb{Z}\longrightarrow\mathbb{Z},\;f(z)=2z.$ Take $g:\mathbb Z\longrightarrow Z,$ such that $g(2z)=z$ and $g(2z+1)=0$ for any $z\in \mathbb Z.$ Which of the conditions works here? Which doesn't? – user23211 Jan 22 '12 at 2:44

Your argument for why $g$ is well defined is not correct. In fact, it's circular: in order to claim that you can say $g(f(c))=c$, you are already assuming it is well defined, so the contradiction you are arriving at comes from assuming both that $g$ is and is not well defined. You haven't proven that $g$ is well-defined. Moreover, you are assuming that $f$ is not injective, and then you are assuming that $f$ is injective. That's no good.
Instead, let $y\in Y$; since $f$ is onto, there is at least one $c\in X$ such that $f(c)=y$. Since $f$ is one-to-one, there is at most one $c$ such that $f(c)=y$. So for each $y\in Y$ there is one and only one $c\in X$ such that $f(c)=y$. Define $g(y)=c$. You've already worked the "well-definedness" into your definition. The proof that this definition works is fine.
Suppose you have $g\circ f = \mathrm{id}_X$ but not $f\circ g=\mathrm{id}_Y$. By previous parts you know that $f$ is one-to-one. In fact, that's both necessary and sufficient. (HINT: Show that if $g\circ f=\mathrm{id}_X$ and $f\circ h=\mathrm{id}_Y$ for some $g,h\colon Y\to X$, then $g=h$; so the fact that $g$ works as an inverse on one side but not the other will tell you that $f$ cannot be onto).
Something similar if you know $f\circ g = \mathrm{id}_Y$ and we also have $g\circ f\neq \mathrm{id}_X$: now you can conclude one thing about $f$; show that this is the only thing you can conclude, and that the fact that $g$ works as an inverse on the right but not the left tells you the function is not bijective.