Identity Functions Proof

elementary-set-theoryfunctionssolution-verification

Claim: Let $f:A \to B$ and $g: B \to A$ be functions. Prove that if $g \circ f$ and $f \circ g$ are identity functions, then $f$ is bijective.

Attempt: An identity function is a function such that $h(x)=x$, or $h(\text{something})=\text{something}$.

Hence, we have that $g(f(x))=f(x)$ and $f(g(x))=g(x)$.

To show that $f$ is injective, we want to show that $f(x_1)=f(x_2) \implies x_1=x_2$. For this problem, we have that $f(g(x_1))=f(g(x_2)) \implies g(x_1)=g(x_2)$, so $f$ is injective.

To show that $f$ is surjective, we want to show that $\forall y \in A,\,\exists\,x \in A$ such that $f(g(x))=y$.

At this point I am stuck. I get that $f(g(x))=g(x)=y$ since $f \circ g$ is an identity function. Is this the end of the proof? I feel like I missed something.

Best Answer

Hence, we have that g(f(x))=f(x) and f(g(x))=g(x).

No!

You have that $g(f(x)) = x$ and $f(g(y)) = y$.

$g$ is not the identity function! $g\circ f$ is! And $f$ is not the identity function! $f\circ g$ is!

And note that $x \in A$ so $f(x) \in B$ so $g(f(x)) \in A$. And $y\in B$ so $g(y) \in A$ so $f(g(y)) \in B$.

======

Youf proof if injection doesn't work. $f(g(x_1)) = f(g(x_2)) \implies x_1 = x_2$ but it does not imply $g(x_1) = g(x_2)$ (unless we assume ahead of time that $f$ is injective).

Instead use that if $f(x_1) = f(x_2)$ then $g(f(x_1)) = g(f(x_2))$ (that's true for all functions. If $a = b$ then $g(a) = g(b)$). And as $g\circ f$ is the identity $g(f(x_1)) = x_1$ and $g(f(x_2)) = x_2$ so $f(x_1) = f(x_2)\implies x_1 = x_2$ and so $f$ is injective.

.....

"To show that f is surjective, we want to show that ∀y∈A,∃x∈A such that f(g(x))=y."

Not at all!

You want to show that $\forall y \in B, \exists x \in A$ such that $f(x) = y$.

" I get that f(g(x))=g(x)=y"

Not at all! $f(g(x)) \ne g(x)$ because $f(k)\ne k$ because $f$ is not that identity function. $f\circ g$ is the identity function so $f(g(x)) = x$.

Also if $x \in A$ and $g: B\to A$ we can't have $g(x)$. It's not defined unless $x \in B$ as well as in $A$.

Maybe you need to realize is that $A$ and $B$ are different sets.

You have $f: A\to B$ and $g: B\to A$ so $f\circ g: B\to A\to B$ and that's an identity function on the set $B$ so that for all $y \in B$ then $f(g(y)) = y$. And $g\circ f: A\to B\to A$ and that's an identity function on the set $A$ so that for all $x \in A$ then $g(f(x)) = x$.

.......

So to prove $f$ is surective you need that for all $y\in B$ there is an $x\in A$ so that $f(x) = y$. Now $f\circ g$ is the identity function so $f(g(y)) = y$. And $g(y) \in A$. So if we let $x = g(y)$ then $f(x) = f(g(y)) = y$. That's it. $f$ is surjective.