An inverse of a morphism $f : X \to Y$ in a category (or an element of a monoid) is another morphism $f^{-1} : Y \to X$ which is both a left-inverse (a retraction) as well as a right-inverse (a section) of $f$, in that
equals the identity morphism on $Y$ and
equals the identity morphism on $X$.
A morphism which has an inverse is called an isomorphism.
The inverse $f^{-1}$ is unique if it exists.
The inverse of an inverse morphism is the original morphism, $(f^{-1})^{-1} = f$.
An identity morphism, $i$, is a morphism which is its own inverse: $i^{-1} = i$.
A category in which all morphisms have inverses is called a groupoid.
An amusing exercise is to show that if $f,g,h$ are morphisms such that $f\circ g,\; g\circ h$ are defined and are isomorphisms, then $f,g,h$ are all isomorphisms.
This is a special case of the two-out-of-six property which is satisfied by the weak equivalences in any homotopical category.
When this is applied to a homotopy category such as that of Top for the standard model structure on topological spaces it implies the construction of and formulae for certain homotopies.
In a balanced category, such as a topos or more particularly Set, every morphism that is both monic and epic is an isomorphism and thus has an inverse. A partial order is an unbalanced category where every morphism is both monic and epic. Only its identity morphisms have inverses.
These can be a little more complicated; see quasigroup for some discussion of the one-object version.