A theory of the semidirect product of categories and the derived category of a category morphism is presented. In order to include division (≺) in this theory, the traditional setting of these constructions is expanded to include relational arrows. In this expanded setting, a relational morphism φ : M → N of categories determines an optimal decomposition
where
denotes semidirect product and D(φ) is the derived category of φ.The theory of the semidirect product of varieties of categories, V * W, is developed. Associated with each variety V of categories is the collection
of relational morphisms whose derived category belongs to V. The semidirect product of varieties and the composition of classes of the form
are shown to stand in the relationship
The associativity of the semidirect product of varieties follows from this result.Finally, it is demonstrated that all the results in the article concerning varieties of categories have pseudovariety and monoidal versions. This allows us to furnish a straightforward proof that
for both varieties and pseudovarieties of monoids.