# numgens(Module) -- number of generators of a module

## Synopsis

• Function: numgens
• Usage:
numgens M
• Inputs:
• M,
• Outputs:
• an integer, number of generators of M

## Description

In Macaulay2, each module comes equipped with a matrix of generators. It is the number of columns of this matrix which is returned. If the module is graded, this may or may not be the number of minimal generators.
 i1 : R = QQ[a..d]; i2 : M = ker vars R o2 = image {1} | -b 0 -c 0 0 -d | {1} | a -c 0 0 -d 0 | {1} | 0 b a -d 0 0 | {1} | 0 0 0 c b a | 4 o2 : R-module, submodule of R i3 : generators M o3 = {1} | -b 0 -c 0 0 -d | {1} | a -c 0 0 -d 0 | {1} | 0 b a -d 0 0 | {1} | 0 0 0 c b a | 4 6 o3 : Matrix R <--- R i4 : numgens M o4 = 6
The number of generators of a free module is its rank.
 i5 : numgens R^10 o5 = 10