Definition 6.2.5.1. Let $\operatorname{\mathcal{C}}$ be an $\infty $-category and let $S$ be a collection of morphisms of $\operatorname{\mathcal{C}}$. An $S$-optimal factorization of $f$ is a $2$-simplex
of $\operatorname{\mathcal{C}}$, corresponding to a morphism $\widetilde{g}: \widetilde{X} \rightarrow \widetilde{Y}$ in the $\infty $-category $\operatorname{\mathcal{C}}_{/Z}$ with the following properties:
The morphism $s: Y \rightarrow Z$ belongs to $S$.
Let $\widetilde{Y}'$ be an object of $\operatorname{\mathcal{C}}_{/Z}$ corresponding to a morphism $s': Y' \rightarrow Z$ which belongs to $S$. Then composition with $\widetilde{g}$ induces a homotopy equivalence of Kan complexes
\[ \operatorname{Hom}_{ \operatorname{\mathcal{C}}_{/Z} }(\widetilde{Y}, \widetilde{Y}') \rightarrow \operatorname{Hom}_{\operatorname{\mathcal{C}}_{/Z} }( \widetilde{X}, \widetilde{Y}' ). \]
If these conditions are satisfied, we say that the diagram (6.2) is an $S$-optimal factorization of $f$.