# resolution(Module) -- compute a free resolution of a module

## Description

The given generators and relations are used to determine a presentation of M to serve as the first matrix of the free resolution; if the presentation is not minimal, and a minimal resolution is desired, use resolution minimalPresentation M instead.

Warning: the resolution can have free modules with unexpected ranks when the module M is not homogeneous. Here is an example where even the lengths of the resolutions differ. We compute a resolution of the kernel of a ring map in two ways. The ring R is constructed naively, but the ring S is constructed with variables of the right degrees so the ring map g will turn out to be homogeneous.

 `i1 : k = ZZ/101; T = k[v..z];` ```i3 : m = matrix {{x,y,z,x^2*v,x*y*v,y^2*v,z*v,x*w,y^3*w,z*w}} o3 = | x y z vx2 vxy vy2 vz wx wy3 wz | 1 10 o3 : Matrix T <--- T``` ```i4 : n = rank source m o4 = 10``` ```i5 : R = k[u_1 .. u_n] o5 = R o5 : PolynomialRing``` ```i6 : S = k[u_1 .. u_n,Degrees => degrees source m] o6 = S o6 : PolynomialRing``` ```i7 : f = map(T,R,m) 2 2 3 o7 = map(T,R,{x, y, z, v*x , v*x*y, v*y , v*z, w*x, w*y , w*z}) o7 : RingMap T <--- R``` ```i8 : g = map(T,S,m) 2 2 3 o8 = map(T,S,{x, y, z, v*x , v*x*y, v*y , v*z, w*x, w*y , w*z}) o8 : RingMap T <--- S``` ```i9 : res ker f 1 17 57 76 46 12 1 o9 = R <-- R <-- R <-- R <-- R <-- R <-- R <-- 0 0 1 2 3 4 5 6 7 o9 : ChainComplex``` ```i10 : res ker g 1 14 35 35 15 2 o10 = S <-- S <-- S <-- S <-- S <-- S <-- 0 0 1 2 3 4 5 6 o10 : ChainComplex``` ```i11 : isHomogeneous f o11 = false``` ```i12 : isHomogeneous g o12 = true```
 `i13 : R = ZZ/32003[a..d]/(a^2+b^2+c^2+d^2);` ```i14 : M = coker vars R o14 = cokernel | a b c d | 1 o14 : R-module, quotient of R``` ```i15 : C = resolution(M, LengthLimit=>6) 1 4 7 8 8 8 8 o15 = R <-- R <-- R <-- R <-- R <-- R <-- R 0 1 2 3 4 5 6 o15 : ChainComplex```

A manually constructed resolution can be installed as the resolution of a module, bypassing the call to the engine when a resolution is requested, as follows.

 ```i16 : A = QQ[x,y] o16 = A o16 : PolynomialRing``` ```i17 : C = chainComplex( map(A^1,A^{3:-2},{{x^2,x*y,y^2}}), map(A^{3:-2},A^{2:-3},{{y,0},{ -x,y},{0,-x}}), map(A^{2:-3},0,0)) 1 3 2 o17 = A <-- A <-- A <-- 0 0 1 2 3 o17 : ChainComplex``` ```i18 : M = HH_0 C o18 = cokernel | x2 xy y2 | 1 o18 : A-module, quotient of A``` `i19 : res M = C;` ```i20 : res M 1 3 2 o20 = A <-- A <-- A <-- 0 0 1 2 3 o20 : ChainComplex```

For an overview of resolutions, in order of increasing detail, see:

Some useful related functions: