Definition Let $\operatorname{\mathcal{C}}$ be a category. We say that a morphism $f: C \rightarrow D$ in $\operatorname{\mathcal{C}}$ is an isomorphism if there exists a morphism $g: D \rightarrow C$ satisfying the identities

\[ f \circ g = \operatorname{id}_{D} \quad \quad g \circ f = \operatorname{id}_{C}. \]

In this case, the morphism $g$ is uniquely determined and we write $g = f^{-1}$. We say that $\operatorname{\mathcal{C}}$ is a groupoid if every morphism in $\operatorname{\mathcal{C}}$ is invertible.