# Commutative diagram

In mathematics, and especially in category theory, a **commutative diagram** is a diagram such that all directed paths in the diagram with the same start and endpoints lead to the same result.^{[1]} It is said that commutative diagrams play the role in category theory that equations play in algebra (see Barr & Wells (2002, Section 1.7)).

In algebra texts, the type of morphism can be denoted with different arrow usages:

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.

Note that a diagram may be non-commutative, i.e., the composition of different paths in the diagram may not give the same result.

Phrases like "this commutative diagram" or "the diagram commutes"^{[2]} may be used.

In order for the diagram below to commute, three equalities must be satisfied:

Here, since the first equality follows from the last two, it suffices to show that (2) and (3) are true in order for the diagram to commute. However, since equality (3) generally does not follow from the other two, it is generally not enough to have only equalities (1) and (2) if one were to show that the diagram commutes.

**Diagram chasing** (also called **diagrammatic search**) is a method of mathematical proof used especially in homological algebra, where one establishes a property of some morphism by tracing the elements of a commutative diagram. A proof by diagram chasing typically involves the formal use of the properties of the diagram, such as injective or surjective maps, or exact sequences.^{[4]} A syllogism is constructed, for which the graphical display of the diagram is just a visual aid. It follows that one ends up "chasing" elements around the diagram, until the desired element or result is constructed or verified.

Examples of proofs by diagram chasing include those typically given for the five lemma, the snake lemma, the zig-zag lemma, and the nine lemma.

There are two kinds of composition in a 2-category (called **vertical composition** and **horizontal composition**), and they may also be depicted via pasting diagrams (see 2-category#Definition for examples).

A commutative diagram in a category *C* can be interpreted as a functor from an index category *J* to *C;* one calls the functor a **diagram.**

More formally, a commutative diagram is a visualization of a diagram indexed by a poset category. Such a diagram typically include:

Conversely, given a commutative diagram, it defines a poset category, where: