Bijection
Task number: 3379
Let \(f\colon X \to Y\) and \(g\colon Y \to X\) be functions such that for every \(x \in X\), \((g \circ f)(x) = x\) and for every \(y \in Y\), \((f \circ g)(y) = y\). Prove that \(f\) and \(g\) are bijective (i.e. both injective and surjective).
Hint
Try to show that if \(g \circ f\) is injective, then \(f\) is also injective, and also that if \(f \circ g\) is surjective, then \(f\) is also surjective.
Solution
By contradiction, if \(f\) is not injective, there exist \(x\) and \(y\), \(f(x)=f(y)\), but then \((g\circ f)(x)=(g\circ f)(y)\), but this cannot equal \(x\) and \(y\) at the same time.
Similarly, if \(f\) is not surjective, there exists \(y\in Y\) which is not the image of any element in \(X\), but then \((f \circ g)(y)\ne y\).
So \(f\) is bijective.
We can show this for \(g\) by the same argument, exchanging \(X\) and \(Y\) and the order of \(f\) and \(g\).
Note: If functions \(f\) and \(g\) fulfill the given conditions, then they must be inverse functions of each other.