[Math] Help with composite identity functions in discrete mathematics

discrete mathematicsfunctions

I am having trouble with the following problem:

For nonempty sets $A$ and $B$ and functions $f : A \rightarrow
B$ and $g: B \rightarrow A$ suppose that $g \circ f = i_A$, the
identity function on $A$. Prove: $f$ is surjective if and only if $g$ is injective.

Work:
Proof:
1. We prove that if $g$ is injective then $f$ is surjective.
2. We will then prove that if $f$ is surjective then $g$ is injective.
We now prove that if $g$ is injective then $f$ is surjective.
Suppose $g$ is not injective, then there exists $b_1\neq b_2$ such that $g(b_1)=g(b_2)$.
Suppose that $f$ is surjective, that is , there exists $a_1\neq a_2$ such that $f(a_i)=b_i$.
We obtain a contradiction since $a_1=(g\circ f)(a_1)=(g\circ f)(a_2)=a_2$ and $a_1\neq a_2$.
Suppose $f$ is not surjective and suppose that $g$ is injective.
Then there exists $b\in B$ such that $f(a)\neq b$ for all $a\in A$.
Since $g$ is injective, $g(x)=g(y)$ then $x=y$ for $x,y\in B$.
However, $g(b)$ is not mapped in $A$. Therefore, $g$ cannot be injective since not all of its domain is mapped to a unique value in $A$.

Best Answer

You have quite a few multiple negations in that, and probabliy got confused yourself. For example

We now prove that if $g$ is injective then $f$ is surjective. Suppose $g$ is not injective ...

does not make sense. A proof looking like "Suppose$g$ is not injective ... contradiction" Is a proof of a statement "if ..., then $g$ injective", not of "if $g$ inkjective, then ..."

Here's a more direct writeup:

  • Assume $g$ is injective. Let $b\in B$ be arbitrary. Let $a=g(b)$. By assumption $g(f(a))=a$. As $g$ is injective, $g(f(a))=g(b)$ implies $b=f(a)$. As $b$ was an arbiitrary elelemt of $B$, this shows that $f$ is surjective.

  • Assume $f$ is surjective. Let $b,b'\in B$. To show that $g$ is injective we need to show that $g(b9=g(b')$ implies $b=b'$. By surjectivity of $f$, pick $a,a'\in A$ with $f(a)=b$, $f(a')=b'$. Then $a=g(f(a))=g(b)=g(b')=g(f(a'))=a'$ and hence $b=b'$ s was to be shown.

Related Question