  Hence the notion of category generalizes those of preorder and monoid. We should also point out that a groupoid has a very simple definition in a categorical context: it is a category in which every morphism is an isomorphism, that is for any morphism \(\boldsymbol{f}: X \rightarrow Y\), there is a morphism \(\boldsymbol{g}: Y \rightarrow X\) such that \(\boldsymbol{f} \circ \boldsymbol{g} = \mathbf{id}_X\) and \(\boldsymbol{g} \circ \boldsymbol{f} = \mathbf{id}_Y.\)