# Length of a module

In algebra, the length of a module over a ring $R$ is a generalization of the dimension of a vector space which measures its size. $^{page153}$ It is defined to be the length of the longest chain of submodules. For vector spaces (modules over a field), the length equals the dimension. If $R$ is an algebra over a field $k$, the length of a module is at most its dimension as a $k$-vector space.
In commutative algebra and algebraic geometry, a module over a Noetherian commutative ring $R$ can have finite length only when the module has Krull dimension zero. Modules of finite length are finitely generated modules, but most finitely generated modules have infinite length. Modules of finite length are called Artinian modules and are fundamental to the theory of Artinian rings.
The degree of an algebraic variety inside an affine or projective space is the length of the coordinate ring of the zero-dimensional intersection of the variety with a generic linear subspace of complementary dimension. More generally, the intersection multiplicity of several varieties is defined as the length of the coordinate ring of the zero-dimensional intersection.

## Definition
### Length of a module

Let $M$ be a (left or right) module over some ring $R$. Given a chain of submodules of $M$ of the form
    $M_{0}\subsetneq M_{1}\subsetneq \cdots \subsetneq M_{n},$
one says that $n$ is the length of the chain. The length of $M$ is the largest length of any of its chains. If no such largest length exists, we say that $M$ has infinite length. Clearly, if the length of a chain equals the length of the module, one has $M_{0}=0$ and $M_{n}=M.$

### Length of a ring

The length of a ring $R$ is the length of the longest chain of ideals; that is, the length of $R$ considered as a module over itself by left multiplication. By contrast, the Krull dimension of $R$ is the length of the longest chain of prime ideals.

## Properties
### Finite length and finite modules

If an $R$-module $M$ has finite length, then it is finitely generated. If R is a field, then the converse is also true.

### Relation to Artinian and Noetherian modules

An $R$-module $M$ has finite length if and only if it is both a Noetherian module and an Artinian module (cf. Hopkins' theorem). Since all Artinian rings are Noetherian, this implies that a ring has finite length if and only if it is Artinian.

### Behavior with respect to short exact sequences

Suppose$0\rightarrow L\rightarrow M\rightarrow N\rightarrow 0$is a short exact sequence of $R$-modules. Then M has finite length if and only if L and N have finite length, and we have ${\text{length}}_{R}(M)={\text{length}}_{R}(L)+{\text{length}}_{R}(N)$ In particular, it implies the following two properties
* The direct sum of two modules of finite length has finite length
* The submodule of a module with finite length has finite length, and its length is less than or equal to its parent module.

### Jordan–Hölder theorem

A composition series of the module M is a chain of the form
    $0=N_{0}\subsetneq N_{1}\subsetneq \cdots \subsetneq N_{n}=M$
such that
    $N_{i+1}/N_{i}{\text{ is simple for }}i=0,\dots ,n-1$
A module M has finite length if and only if it has a (finite) composition series, and the length of every such composition series is equal to the length of M.

## Examples
### Finite dimensional vector spaces

Any finite dimensional vector space $V$ over a field $k$ has a finite length. Given a basis $v_{1},\ldots ,v_{n}$ there is the chain$0\subset {\text{Span}}_{k}(v_{1})\subset {\text{Span}}_{k}(v_{1},v_{2})\subset \cdots \subset {\text{Span}}_{k}(v_{1},\ldots ,v_{n})=V$which is of length $n$. It is maximal because given any chain,$V_{0}\subset \cdots \subset V_{m}$the dimension of each inclusion will increase by at least $1$. Therefore, its length and dimension coincide.

### Artinian modules

Over a base ring $R$, Artinian modules form a class of examples of finite modules. In fact, these examples serve as the basic tools for defining the order of vanishing in intersection theory.

#### Zero module

The zero module is the only one with length 0.

#### Simple modules

Modules with length 1 are precisely the simple modules.

#### Artinian modules over Z

The length of the cyclic group $\mathbb {Z} /n\mathbb {Z}$ (viewed as a module over the integers Z) is equal to the number of prime factors of $n$, with multiple prime factors counted multiple times. This follows from the fact that the submodules of $\mathbb {Z} /n\mathbb {Z}$ are in one to one correspondence with the positive divisors of $n$, this correspondence resulting itself from the fact that $\mathbb {Z}$ is a principal ideal ring.

## Use in multiplicity theory

For the needs of intersection theory, Jean-Pierre Serre introduced a general notion of the multiplicity of a point, as the length of an Artinian local ring related to this point.
The first application was a complete definition of the intersection multiplicity, and, in particular, a statement of Bézout's theorem that asserts that the sum of the multiplicities of the intersection points of n algebraic hypersurfaces in a n-dimensional projective space is either infinite or is exactly the product of the degrees of the hypersurfaces.
This definition of multiplicity is quite general, and contains as special cases most of previous notions of algebraic multiplicity.

### Order of vanishing of zeros and poles

A special case of this general definition of a multiplicity is the order of vanishing of a non-zero algebraic function $f\in R(X)^{*}$ on an algebraic variety. Given an algebraic variety $X$ and a subvariety $V$ of codimension 1 the order of vanishing for a polynomial $f\in R(X)$ is defined as$\operatorname {ord} _{V}(f)={\text{length}}_{{\mathcal {O}}_{V,X}}\left({\frac {{\mathcal {O}}_{V,X}}{(f)}}\right)$where ${\mathcal {O}}_{V,X}$ is the local ring defined by the stalk of ${\mathcal {O}}_{X}$ along the subvariety $V$ $^{pages426-227}$, or, equivalently, the stalk of ${\mathcal {O}}_{X}$ at the generic point of $V$ $^{page22}$. If $X$ is an affine variety, and $V$ is defined the by vanishing locus $V(f)$, then there is the isomorphism${\mathcal {O}}_{V,X}\cong R(X)_{(f)}$This idea can then be extended to rational functions $F=f/g$ on the variety $X$ where the order is defined as$\operatorname {ord} _{V}(F):=\operatorname {ord} _{V}(f)-\operatorname {ord} _{V}(g)$ which is similar to defining the order of zeros and poles in complex analysis.

#### Example on a projective variety

For example, consider a projective surface $Z(h)\subset \mathbb {P} ^{3}$ defined by a polynomial $h\in k[x_{0},x_{1},x_{2},x_{3}]$, then the order of vanishing of a rational function$F={\frac {f}{g}}$is given by$\operatorname {ord} _{Z(h)}(F)=\operatorname {ord} _{Z(h)}(f)-\operatorname {ord} _{Z(h)}(g)$where$\operatorname {ord} _{Z(h)}(f)={\text{length}}_{{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}\left({\frac {{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}{(f)}}\right)$For example, if $h=x_{0}^{3}+x_{1}^{3}+x_{2}^{3}+x_{2}^{3}$ and $f=x^{2}+y^{2}$ and $g=h^{2}(x_{0}+x_{1}-x_{3})$ then$\operatorname {ord} _{Z(h)}(f)={\text{length}}_{{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}\left({\frac {{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}{(x^{2}+y^{2})}}\right)=0$since $x^{2}+y^{2}$ is a unit in the local ring ${\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}$. In the other case, $x_{0}+x_{1}-x_{3}$ is a unit, so the quotient module is isomorphic to${\frac {{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}{(h^{2})}}$so it has length $2$. This can be found using the maximal proper sequence$(0)\subset {\frac {{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}{(h)}}\subset {\frac {{\mathcal {O}}_{Z(h),\mathbb {P} ^{3}}}{(h^{2})}}$

#### Zero and poles of an analytic function

The order of vanishing is a generalization of the order of zeros and poles for meromorphic functions in complex analysis. For example, the function${\frac {(z-1)^{3}(z-2)}{(z-1)(z-4i)}}$has zeros of order 2 and 1 at $1,2\in \mathbb {C}$ and a pole of order $1$ at $4i\in \mathbb {C}$. This kind of information can be encoded using the length of modules. For example, setting $R(X)=\mathbb {C} [z]$ and $V=V(z-1)$, there is the associated local ring ${\mathcal {O}}_{V,X}$ is $\mathbb {C} [z]_{(z-1)}$ and the quotient module ${\frac {\mathbb {C} [z]_{(z-1)}}{((z-4i)(z-1)^{2})}}$Note that $z-4i$ is a unit, so this is isomorphic to the quotient module${\frac {\mathbb {C} [z]_{(z-1)}}{((z-1)^{2})}}$Its length is $2$ since there is the maximal chain$(0)\subset {\frac {\mathbb {C} [z]_{(z-1)}}{((z-1))}}\subset {\displaystyle {\frac {\mathbb {C} [z]_{(z-1)}}{((z-1)^{2})}}}$of submodules. More generally, using the Weierstrass factorization theorem a meromorphic function factors as$F={\frac {f}{g}}$which is a (possibly infinite) product of linear polynomials in both the numerator and denominator.