# randomHomomorphism -- create a random homomorphism between graded modules

## Synopsis

• Usage:
randomHomomorphism(d, N, M)
• Inputs:
• d, a list, or an integer, if the common ring $R$ of $M$ and $N$ is singly graded
• N, , the target module
• M, , the source module
• Outputs:
• , a random $R$-module homomorphism from $M$ to $N$ of degree $d$

## Description

This function can be useful to find isomorphisms between modules (since if there is an isomorphism, a random map between them will be such an isomorphism), as well as writing the canonical module as an ideal (up to degree shift) in the ring.

We start with a simpler application: duplicating the work of the simpler function random(ZZ,Ideal). Here are two ways to get a random element of degree 4 in the ideal $I$.

 i1 : S = ZZ/101[a..d] o1 = S o1 : PolynomialRing i2 : I = monomialCurveIdeal(S, {2,5,9}) 2 2 4 2 3 3 5 3 2 o2 = ideal (b c - a d, c - a*b*d , a*c - b d, b - a c ) o2 : Ideal of S i3 : g = randomHomomorphism({4}, module I, S^1) o3 = {3} | 24a-36b-30c-29d | {4} | 19 | {4} | 19 | {5} | 0 | o3 : Matrix i4 : isWellDefined g o4 = true i5 : super g o5 = | 24ab2c-36b3c-30b2c2+19ac3+19c4-24a3d+36a2bd-19b3d+30a2cd-29b2cd+29a2d2 ------------------------------------------------------------------------ -19abd2 | 1 1 o5 : Matrix S <--- S i6 : J = ideal image g 2 3 2 2 3 4 3 2 3 o6 = ideal(24a*b c - 36b c - 30b c + 19a*c + 19c - 24a d + 36a b*d - 19b d ------------------------------------------------------------------------ 2 2 2 2 2 + 30a c*d - 29b c*d + 29a d - 19a*b*d ) o6 : Ideal of S i7 : random(4, I) 2 3 2 2 3 4 3 2 3 o7 = - 10a*b c - 29b c - 8b c - 24a*c - 29c + 10a d + 29a b*d + 24b d + ------------------------------------------------------------------------ 2 2 2 2 2 8a c*d - 22b c*d + 22a d + 29a*b*d o7 : S

One important application of this function is to find an isomorphism of the canonical module of $R = S/I$ with an ideal $J \subset R$, up to a degree twist. See doubling for a function which uses this method.

 i8 : R = S/I o8 = R o8 : QuotientRing i9 : E = Ext^2(comodule I, S^{{-4}}) o9 = cokernel {-1} | c a2 ad 0 b2 | {-1} | d b2 0 c2 0 | {0} | 0 0 -c b -a | 3 o9 : S-module, quotient of S i10 : ER = E ** R o10 = cokernel {-1} | c a2 ad 0 b2 | {-1} | d b2 0 c2 0 | {0} | 0 0 -c b -a | 3 o10 : R-module, quotient of R i11 : isHomogeneous ER o11 = true i12 : f = randomHomomorphism(3, R^1, ER) o12 = | -16ad+39bd-38cd 16ac-39bc+38c2 39c3-16b2d-38ad2 | o12 : Matrix i13 : isWellDefined f o13 = true i14 : source f == ER o14 = true i15 : target f == R^1 o15 = true i16 : degree f == {3} o16 = true i17 : ker f == 0 o17 = true i18 : J = ideal image f 2 3 2 o18 = ideal (- 16a*d + 39b*d - 38c*d, 16a*c - 39b*c + 38c , 39c - 16b d - ----------------------------------------------------------------------- 2 38a*d ) o18 : Ideal of R