So, I'm just starting to peruse "Categories for the Working Mathematician", and there's one thing I'm uncertain on. Lets say I have three objects, $X,Y,Z$ and two arrows $f,g$ such that $X\overset {f} {\to}Y\overset {g} {\to}Z$. Does this necessitate the composition arrow exist so the diagram commutes, i.e must I have an $X\overset {h} {\to} Z$ such that $h=g\circ f$, or is it just that IF such an arrow $h$ exists, then it commutes?
The question came up when the book defined preorders, saying that they were transitive since we could associate arrows...I just wanted to make sure association of arrows actually mandates the creation of the direct arrow.
The definition of category ensures that you can always "compose" two arrows if one's target is the other's source: that is, every diagram
$$ \begin{matrix} X & \xrightarrow{f} & Y \\ & & \downarrow g\!\!\!\!\! \\ & & Z \end{matrix}$$
can be (uniquely!) completed to a commutative diagram
$$ \begin{matrix} X & \xrightarrow{f} & Y \\ &\!\!{}_{gf\!\!\!}\searrow & \downarrow g\!\!\!\!\! \\ & & Z \end{matrix}$$
However, it is not true that every diagram
$$ \begin{matrix} X & \xrightarrow{f} & Y \\ &\!\!{}_{h\!\!\!}\searrow & \downarrow g\!\!\!\!\! \\ & & Z \end{matrix}$$
commutes; in many categories, you can have $h \neq gf$ in such a diagram.
Preorders are a special case; they can be defined as categories with the weird property that every diagram is commutative; e.g. in a preorder, whenever you have the third triangle above, you have to have $h = gf$