Zig-zag lemma

In mathematics, particularly homological algebra, the zig-zag lemma asserts the existence of a particular long exact sequence in the homology groups of certain chain complexes. The result is valid in every abelian category.
Statement.
In an abelian category (such as the category of abelian groups or the category of vector spaces over a given field), let formula_1 and formula_2 be chain complexes that fit into the following short exact sequence:
Such a sequence is shorthand for the following commutative diagram:
where the rows are exact sequences and each column is a chain complex. 
The zig-zag lemma asserts that there is a collection of boundary maps
that makes the following sequence exact:
The maps formula_5 and formula_6 are the usual maps induced by homology. The boundary maps formula_7 are explained below. The name of the lemma arises from the "zig-zag" behavior of the maps in the sequence. A variant version of the zig-zag lemma is commonly known as the "snake lemma" (it extracts the essence of the proof of the zig-zag lemma given below).
Construction of the boundary maps.
The maps formula_7 are defined using a standard diagram chasing argument. Let formula_9 represent a class in formula_10, so formula_11. Exactness of the row implies that formula_12 is surjective, so there must be some formula_13 with formula_14. By commutativity of the diagram, 
By exactness, 
Thus, since formula_17 is injective, there is a unique element formula_18 such that formula_19. This is a cycle, since formula_20 is injective and
since formula_22. That is, formula_23. This means formula_24 is a cycle, so it represents a class in formula_25. We can now define
With the boundary maps defined, one can show that they are well-defined (that is, independent of the choices of "c" and "b"). The proof uses diagram chasing arguments similar to that above. Such arguments are also used to show that the sequence in homology is exact at each group.