# matrices to and from modules -- including kernel, cokernel and image

## matrices to modules (kernel, image, cokernel)

Given a matrix, we may compute the kernel, image, and cokernel.
 i1 : R = QQ[a..f]; i2 : F = matrix{{a,b,d,e},{b,c,e,f}} o2 = | a b d e | | b c e f | 2 4 o2 : Matrix R <--- R
 i3 : M = ker F o3 = image {1} | cd-be 0 e2-df ce-bf | {1} | -bd+ae e2-df 0 -be+af | {1} | b2-ac -ce+bf -be+af 0 | {1} | 0 cd-be bd-ae b2-ac | 4 o3 : R-module, submodule of R i4 : coker F o4 = cokernel | a b d e | | b c e f | 2 o4 : R-module, quotient of R i5 : image F o5 = image | a b d e | | b c e f | 2 o5 : R-module, submodule of R
Some routines in Macaulay2 have abbreviations, for example ker may be used for kernel, and coker may be used for cokernel. The image function has no abbreviated form.

## modules to matrices

Each module has, at least implicitly, two matrices associated to it: generators (abbreviated form: gens), and relations. If a module is a submodule of a free module, then the relations matrix is zero. If a module is a quotient of a free module, then the generator matrix is the identity matrix. If a module is a subquotient, then both may be more general.
 i6 : generators M o6 = {1} | cd-be 0 e2-df ce-bf | {1} | -bd+ae e2-df 0 -be+af | {1} | b2-ac -ce+bf -be+af 0 | {1} | 0 cd-be bd-ae b2-ac | 4 4 o6 : Matrix R <--- R i7 : relations M o7 = 0 4 o7 : Matrix R <--- 0

Every finitely generated module has a presentation matrix. In Macaulay2, if the module is not a quotient of a free module, then a syzygy computation is performed to find a presentation matrix.
 i8 : presentation M o8 = {3} | -f -e | {3} | b a | {3} | -c -b | {3} | e d | 4 2 o8 : Matrix R <--- R