# Snake lemma

The snake lemma is a tool used in mathematics, particularly homological algebra, to construct long exact sequences. The snake lemma is valid in every abelian category 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.

## Statement

In an abelian category (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 kernels and cokernels of a, b, and c:
    $\ker a~{\color {Gray}\longrightarrow }~\ker b~{\color {Gray}\longrightarrow }~\ker c~{\overset {d}{\longrightarrow }}~\operatorname {coker} a~{\color {Gray}\longrightarrow }~\operatorname {coker} b~{\color {Gray}\longrightarrow }~\operatorname {coker} c$
where d is a homomorphism, known as the connecting homomorphism.
Furthermore, if the morphism f is a monomorphism, then so is the morphism $\ker a~{\color {Gray}\longrightarrow }~\ker b$, and if g' is an epimorphism, then so is $\operatorname {coker} b~{\color {Gray}\longrightarrow }~\operatorname {coker} c$.
The cokernels here are: $\operatorname {coker} a=A'/\operatorname {im} a$, $\operatorname {coker} b=B'/\operatorname {im} b$, $\operatorname {coker} c=C'/\operatorname {im} c$.

## Explanation of the name

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.

## Construction of the maps

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., d(x) only depends on x and not on the choice of y), that it is a homomorphism, and that the resulting long sequence is indeed exact. One may routinely verify the exactness by diagram chasing (see the proof of Lemma 9.1 in).
Once that is done, the theorem is proven for abelian groups or modules over a ring. For the general case, the argument may be rephrased in terms of properties of arrows and cancellation instead of elements. Alternatively, one may invoke Mitchell's embedding theorem.

## Naturality

In the applications, one often needs to show that long exact sequences are "natural" (in the sense of natural transformations). This follows from the naturality of the sequence produced by the snake lemma.
If
is a commutative diagram with exact rows, then the snake lemma can be applied twice, to the "front" and to the "back", yielding two long exact sequences; these are related by a commutative diagram of the form

## Example

Let $k$ be field, $V$ be a $k$-vector space. $V$ is $k[t]$-module by $t:V\to V$ being a $k$-linear transformation, so we can tensor $V$ and $k$ over $k[t]$.
    $V\otimes _{k[t]}k=V\otimes _{k[t]}(k[t]/(t))=V/tV=\operatorname {coker} (t).$
Given a short exact sequence of $k$-vector spaces $0\to M\to N\to P\to 0$, we can induce an exact sequence $M\otimes _{k[t]}k\to N\otimes _{k[t]}k\to P\otimes _{k[t]}k\to 0$ by right exactness of tensor product. But the sequence $0\to M\otimes _{k[t]}k\to N\otimes _{k[t]}k\to P\otimes _{k[t]}k\to 0$ is not exact in general. Hence, a natural question arises. Why is this sequence not exact?
According to the diagram above, we can induce an exact sequence $\ker(t_{M})\to \ker(t_{N})\to \ker(t_{P})\to M\otimes _{k[t]}k\to N\otimes _{k[t]}k\to P\otimes _{k[t]}k\to 0$ by applying the snake lemma. Thus, the snake lemma reflects the tensor product's failure to be exact.

## In the category of groups

Whether the snake lemma holds in the category of groups depends on the definition of cokernel. If $f:A\to B$ is a homomorphism of groups, the universal property of the cokernel is satisfied by the natural map $B\to B/N(\operatorname {im} f)$, where $N(\operatorname {im} f)$ is the normalization of the image of $f$. The snake lemma fails with this definition of cokernel: The connecting homomorphism can still be defined, and one can write down a sequence as in the statement of the snake lemma. This will always be a chain complex, but it may fail to be exact.
If one simply replaces the cokernels in the statement of the snake lemma with the (right) cosets $A'/\operatorname {im} a,B'/\operatorname {im} b,C'/\operatorname {im} c'$, the lemma is still valid. The quotients however are not groups, but pointed sets (a short sequence $(X,x)\to (Y,y)\to (Z,z)$ of pointed sets with maps $f:X\to Y$ and $g:Y\to Z$ is called exact if $f(X)=g^{-1}(z)$).

### Counterexample to snake lemma with categorical cokernel

Consider the alternating group $A_{5}$: this contains a subgroup isomorphic to the symmetric group $S_{3}$, which in turn can be written as a semidirect product of cyclic groups: $S_{3}\simeq C_{3}\rtimes C_{2}$. This gives rise to the following diagram with exact rows:
    ${\begin{matrix}&1&\to &C_{3}&\to &C_{3}&\to 1\\&\downarrow &&\downarrow &&\downarrow \\1\to &1&\to &S_{3}&\to &A_{5}\end{matrix}}$
Note that the middle column is not exact: $C_{2}$ is not a normal subgroup in the semidirect product.
Since $A_{5}$ is simple, the right vertical arrow has trivial cokernel. Meanwhile the quotient group $S_{3}/C_{3}$ is isomorphic to $C_{2}$. The sequence in the statement of the snake lemma is therefore
    $1\longrightarrow 1\longrightarrow 1\longrightarrow 1\longrightarrow C_{2}\longrightarrow 1$,
which indeed fails to be exact.

## In popular culture

The proof of the snake lemma is taught by Jill Clayburgh's character at the very beginning of the 1980 film It's My Turn.