Definition 1.3.4.1. Let $\operatorname{\mathcal{C}}$ be an $\infty $-category. Suppose we are given objects $X,Y,Z \in \operatorname{\mathcal{C}}$ and morphisms $f: X \rightarrow Y$, $g: Y \rightarrow Z$, and $h: X \rightarrow Z$. We will say that *$h$ is a composition of $f$ and $g$* if there exists a $2$-simplex $\sigma $ of $\operatorname{\mathcal{C}}$ satisfying $d_0(\sigma ) = g$, $d_1(\sigma ) = h$, and $d_2(\sigma ) = f$. In this case, we will also say that the $2$-simplex $\sigma $ *witnesses $h$ as a composition of $f$ and $g$*.

### 1.3.4 Composition of Morphisms

We now introduce a notion of composition for morphisms in an $\infty $-category.

Beware that, in the situation of Definition 1.3.4.1, the morphism $h$ is not determined by $f$ and $g$. However, it is determined up to homotopy:

Proposition 1.3.4.2. Let $\operatorname{\mathcal{C}}$ be an $\infty $-category containing morphisms $f: X \rightarrow Y$ and $g: Y \rightarrow Z$. Then:

- $(1)$
There exists a morphism $h: X \rightarrow Z$ which is a composition of $f$ and $g$.

- $(2)$
Let $h: X \rightarrow Z$ be a composition of $f$ and $g$, and let $h': X \rightarrow Z$ be another morphism in $\operatorname{\mathcal{C}}$ having the same source and target. Then $h'$ is a composition of $f$ and $g$ if and only if $h'$ is homotopic to $h$.

**Proof.**
The tuple $(g, \bullet , f)$ determines a map of simplicial sets $\sigma _0: \Lambda ^{2}_{1} \rightarrow \operatorname{\mathcal{C}}$ (Exercise 1.1.2.14). Since $\operatorname{\mathcal{C}}$ is an $\infty $-category, we can extend $\sigma _0$ to a $2$-simplex $\sigma $ of $\operatorname{\mathcal{C}}$. Then $\sigma $ witnesses the morphism $h = d_1(\sigma )$ as a composition of $f$ and $g$. This proves $(1)$. To prove $(2)$, let us first suppose that $h': X \rightarrow Z$ is some other morphism in $\operatorname{\mathcal{C}}$ which is a composition of $f$ and $g$. We will show that $h$ is homotopic to $h'$. Choose a $2$-simplex $\sigma '$ which witnesses $h'$ as a composition of $f$ and $g$. Then the tuple $( s_1(g), \bullet , \sigma ', \sigma )$ determines a morphism of simplicial sets $\tau _0: \Lambda ^{3}_{1} \rightarrow \operatorname{\mathcal{C}}$ (Exercise 1.1.2.14), which we depict informally as a diagram

where the dotted arrows indicate the boundary of the “missing” face of the horn $\Lambda ^{3}_{1}$. Using our assumption that $\operatorname{\mathcal{C}}$ is an $\infty $-category, we can extend $\tau _0$ to a $3$-simplex $\tau $ of $\operatorname{\mathcal{C}}$. Then the face $d_1(\tau )$ is a homotopy from $h$ to $h'$.

We now prove the converse. Let $\sigma $ be a $2$-simplex of $\operatorname{\mathcal{C}}$ which witnesses $h$ as a composition of $f$ and $g$, and let $h': X \rightarrow Z$ be a morphism of $\operatorname{\mathcal{C}}$ which is homotopic to $h$. Let $\sigma ''$ be a $2$-simplex of $\operatorname{\mathcal{C}}$ which is a homotopy from $h$ to $h'$. Then the tuple $( s_1(g), \sigma '', \bullet , \sigma )$ determines a map of simplicial sets $\rho _0: \Lambda ^{3}_{2} \rightarrow \operatorname{\mathcal{C}}$ (Exercise 1.1.2.14), which we depict informally as a diagram

Our assumption that $\operatorname{\mathcal{C}}$ is an $\infty $-category guarantees that we can extend $\rho _0$ to a $3$-simplex $\rho $ of $\operatorname{\mathcal{C}}$. Then the face $d_2(\rho )$ witnesses $h'$ as a composition of $f$ and $g$. $\square$

Notation 1.3.4.3. Let $\operatorname{\mathcal{C}}$ be an $\infty $-category and let $f: X \rightarrow Y$ and $g: Y \rightarrow Z$ be a pair of morphisms in $\operatorname{\mathcal{C}}$. We will write $h = g \circ f$ to indicate that $h$ is a composition of $f$ and $g$ (in the sense of Definition 1.3.4.1. In this case, it should be implicitly understood that we have chosen a $2$-simplex that witnesses $h$ as a composition of $f$ and $g$. We will sometimes abuse terminology by referring to $h$ as *the* composition of $f$ and $g$. However, the reader should beware that only the homotopy class of $h$ is well-defined (Proposition 1.3.4.2).

Example 1.3.4.4. Let $\operatorname{\mathcal{C}}$ be an ordinary category containing a pair of morphisms $f: X \rightarrow Y$ and $g: Y \rightarrow Z$. Then there is a unique morphism $h: X \rightarrow Z$ in the $\infty $-category $\operatorname{N}_{\bullet }(\operatorname{\mathcal{C}})$ which is a composition of $f$ and $g$, given by the usual composition $g \circ f$ in the category $\operatorname{\mathcal{C}}$.

Example 1.3.4.5. Let $X$ be a topological space and suppose we are given continuous paths $f,g: [0,1] \rightarrow X$ which are composable in the sense that $f(1) = g(0)$, and let $g \star f: [0,1] \rightarrow X$ denote the path obtained by concatenating $f$ and $g$, given concretely by the formula

Then $g \star f$ is a composition of $f$ and $g$ in the $\infty $-category $\operatorname{Sing}_{\bullet }(X)$. More precisely, the continuous map

can be regarded as a $2$-simplex of $\operatorname{Sing}_{\bullet }(X)$ which witnesses $g \circ f$ as a composition of $f$ and $g$.

Warning 1.3.4.6. In the situation of Example 1.3.4.5, the concatenation $g \star f$ is not the only path which is a composition of $f$ and $g$ in the $\infty $-category $\operatorname{Sing}_{\bullet }(\operatorname{\mathcal{C}})$. Any path in $X$ which is homotopic to $g \star f$ (with endpoints fixed) has the same property, by virtue of Proposition 1.3.4.2 (and Example 1.3.3.3). For example, we can replace $g \star f$ by a reparametrization, such as the path

When viewing $\operatorname{Sing}_{\bullet }(X)$ as an $\infty $-category, all of these paths have an equal claim to be regarded as “the” composition of $f$ and $g$.

We now show that composition respects the relation of homotopy:

Proposition 1.3.4.7. Let $\operatorname{\mathcal{C}}$ be an $\infty $-category. Suppose we are given a pair of homotopic morphisms $f,f': X \rightarrow Y$ in $\operatorname{\mathcal{C}}$ and a pair of homotopic morphisms $g,g': Y \rightarrow Z$ in $\operatorname{\mathcal{C}}$. Let $h$ be a composition of $f$ and $g$, and let $h'$ be a composition of $f'$ and $g'$. Then $h$ is homotopic to $h'$.

**Proof.**
Let $h''$ be a composition of $f$ and $g'$. Since homotopy is an equivalence relation (Proposition 1.3.3.5), it will suffice to show that both $h$ and $h'$ are homotopic to $h''$. We will show that $h$ is homotopic to $h''$; the proof that $h'$ is homotopic to $h''$ is similar. Let $\sigma _3$ be a $2$-simplex of $\operatorname{\mathcal{C}}$ which witnesses $h$ as a composition of $f$ and $g$, let $\sigma _2$ be a $2$-simplex of $\operatorname{\mathcal{C}}$ which witnesses $h''$ as a composition of $f$ and $g'$, and let $\sigma _0$ be a $2$-simplex of $\operatorname{\mathcal{C}}$ which is a homotopy from $g$ to $g'$. Then the tuple $(\sigma _0, \bullet , \sigma _2, \sigma _3)$ determines a map of simplicial sets $\tau _0: \Lambda ^{3}_1 \rightarrow \operatorname{\mathcal{C}}$ (Exercise 1.1.2.14), which we depict informally as a diagram

where the dotted arrows indicate the boundary of the “missing” face of the horn $\Lambda ^{3}_{1}$. Using our assumption that $\operatorname{\mathcal{C}}$ is an $\infty $-category, we can extend $\tau _0$ to a $3$-simplex $\tau $ of $\operatorname{\mathcal{C}}$. Then the face $d_1(\tau )$ is a homotopy from $h$ to $h''$. $\square$