In mathematics, especially the many applications of category theory, a commutative diagram is a diagram of objects and morphisms such that, when picking two objects, one can follow any path through the diagram and obtain the same result by composition.

For example, the first isomorphism theorem is a commutative triangle as follows:

Since f = h o φ, the left diagram is commutative; and since φ = k o f, so is the right diagram.

Similarly, the square above is commutative if y o w = z o x.

Commutativity makes sense for a polygon of any finite number of sides (including just 1 or 2), and a diagram is commutative if every polygonal subdiagram is commutative.