# kernel(ComplexMap) -- make the kernel of a map of complexes

## Description

The kernel of a chain complex map $f : C \to D$ is the complex $E$ whose $i-th$ term is $kernel(f_i)$, and whose differential is induced from the differential on the source.

In the following example, we first construct a random complex morphism $f : C \to D$. We consider the exact sequence $0 \to D \to cone(f) \to C[-1] \to 0$. For the maps $g : D \to cone(f)$ and $h : cone(f) \to C[-1]$, we compute the kernel.

 i1 : S = ZZ/101[a,b,c,d]; i2 : C = freeResolution ideal(b^2-a*c, b*c-a*d, c^2-b*d) 1 3 2 o2 = S <-- S <-- S 0 1 2 o2 : Complex i3 : D = freeResolution ideal(a,b,c) 1 3 3 1 o3 = S <-- S <-- S <-- S 0 1 2 3 o3 : Complex i4 : f = randomComplexMap(D, C, Cycle => true, InternalDegree => 0) 1 1 o4 = 0 : S <----------- S : 0 | -22 | 3 3 1 : S <------------------------------------------------ S : 1 {1} | 36b+3c 30b-19c+22d -29b-10c | {1} | -36a-22b+29c -30a-14c 29a+29c+22d | {1} | 19a-29b 19a-8b 10a-29b-22c | 3 2 2 : S <--------------------------------------------- S : 2 {2} | -29a-30b+31c-22d 29b+6c-36d | {2} | -10a+24b+3c 34b-19c+19d | {2} | 24a-8b+29c -24a-29b-14c-29d | o4 : ComplexMap i5 : Cf = cone f 1 4 6 3 o5 = S <-- S <-- S <-- S 0 1 2 3 o5 : Complex i6 : g = canonicalMap(Cf, D) 1 1 o6 = 0 : S <--------- S : 0 | 1 | 4 3 1 : S <----------------- S : 1 {0} | 0 0 0 | {1} | 1 0 0 | {1} | 0 1 0 | {1} | 0 0 1 | 6 3 2 : S <----------------- S : 2 {2} | 0 0 0 | {2} | 0 0 0 | {2} | 0 0 0 | {2} | 1 0 0 | {2} | 0 1 0 | {2} | 0 0 1 | 3 1 3 : S <------------- S : 3 {3} | 0 | {3} | 0 | {3} | 1 | o6 : ComplexMap i7 : h = canonicalMap(C[-1], Cf) 1 4 o7 = 1 : S <--------------- S : 1 | 1 0 0 0 | 3 6 2 : S <----------------------- S : 2 {2} | 1 0 0 0 0 0 | {2} | 0 1 0 0 0 0 | {2} | 0 0 1 0 0 0 | 2 3 3 : S <----------------- S : 3 {3} | 1 0 0 | {3} | 0 1 0 | o7 : ComplexMap i8 : ker g == 0 o8 = true i9 : prune ker h == D o9 = true

There is a canonical map of complexes from the kernel to the source.

 i10 : h1 = canonicalMap(source h, ker h) 1 1 o10 = 0 : S <--------- S : 0 | 1 | 4 1 : S <----------------- image {0} | 0 0 0 | : 1 {0} | 0 0 0 | {1} | 1 0 0 | {1} | 1 0 0 | {1} | 0 1 0 | {1} | 0 1 0 | {1} | 0 0 1 | {1} | 0 0 1 | 6 2 : S <----------------- image {2} | 0 0 0 | : 2 {2} | 0 0 0 | {2} | 0 0 0 | {2} | 0 0 0 | {2} | 0 0 0 | {2} | 0 0 0 | {2} | 1 0 0 | {2} | 1 0 0 | {2} | 0 1 0 | {2} | 0 1 0 | {2} | 0 0 1 | {2} | 0 0 1 | 3 3 : S <------------- image {3} | 0 | : 3 {3} | 0 | {3} | 0 | {3} | 0 | {3} | 1 | {3} | 1 | o10 : ComplexMap i11 : ker h == image h1 o11 = true i12 : ker h1 == 0 o12 = true