Categorical Viewpoint
If \(f\) is a function from \(X\) to \(Y\), we draw
Let \(f:X\to Y\) and \(g:Y\to Z\) be given. If \(g \circ f : X\to Z\) is the composite of \(f\) and \(g\), we may draw diagrams such as
and say that the diagrams commute. Generally, saying that a diagram commutes means that whenever two directed paths share the same source and target, the composition of the functions along both paths yields the same result. It is evident from the definition of composition that composition is associative. That is, if \(f:X\to Y, g:Y\to Z\), and \(h: Z\to W\) are functions, then \(h\circ(g\circ f) = (h\circ g)\circ f\); the diagram
commutes. The identity function is very special with respect to compositions. For any function \(f:X\to Y\), the diagrams
commute.
Definition. Let \(f:X\to Y\) be a function. A function \(g:Y\to X\) is called a left-inverse of \(f\) if \(g\circ f = \mathrm{id}_X\); the following diagram commutes:
A function \(h:Y\to X\) is called a right-inverse of \(f\) if \(f\circ h = \mathrm{id}_Y\); the following diagram commutes:
If a function from \(Y\) to \(X\) is both a left-inverse and right-inverse of \(f\), then it is called the inverse of \(f\).
Proposition. Let \(X\ne \varnothing\), and let \(f:X\to Y\) be a function.
- \(f\) is injective if and only if it has a left-inverse.
- \(f\) is surjective if and only if it has a right-inverse.
Example.
References
- Aluffi, P. (2009). Algebra: Chapter 0. American Mathematical Society, Providence, RI. https://doi.org/10.1090/gsm/104