The snake lemma is a tool used in mathematics, particularly homological algebra, to construct long exact sequences. The snake lemma is valid in every and is a crucial tool in homological algebra and its applications, for instance in algebraic topology. Homomorphisms constructed with its help are generally called connecting homomorphisms.
In an (such as the category of abelian groups or the category of vector spaces over a given field), consider a commutative diagram:
where the rows are exact sequences and 0 is the zero object.
Then there is an exact sequence relating the and cokernels of a, b, and c:
where d is a homomorphism, known as the connecting homomorphism.
Furthermore, if the morphism f is a monomorphism, then so is the morphism , and if g''' is an epimorphism, then so is .
The cokernels here are: , , .
To see where the snake lemma gets its name, expand the diagram above as follows:
and then the exact sequence that is the conclusion of the lemma can be drawn on this expanded diagram in the reversed "S" shape of a slithering snake.
The maps between the kernels and the maps between the cokernels are induced in a natural manner by the given (horizontal) maps because of the diagram's commutativity. The exactness of the two induced sequences follows in a straightforward way from the exactness of the rows of the original diagram. The important statement of the lemma is that a connecting homomorphism d exists which completes the exact sequence.
In the case of abelian groups or modules over some ring, the map d can be constructed as follows:
Pick an element x in ker c and view it as an element of C; since g is surjective, there exists y in B with g(y) = x. Because of the commutativity of the diagram, we have g'(b(y)) = c(g(y)) = c(x) = 0 (since x is in the kernel of c), and therefore b(y) is in the kernel of g' . Since the bottom row is exact, we find an element z in A' with f '(z) = b(y). z is unique by injectivity of f '. We then define d(x) = z + im(a). Now one has to check that d is well-defined (i.e.