# tensorCommutativity(Module,Module) -- make the canonical isomorphism arising from commutativity

## Synopsis

• Function: tensorCommutativity
• Usage:
tensorCommutativity(M, N)
• Inputs:
• M, ,
• N, , both over the same ring $R$
• Outputs:
• , that is an isomorphism from $M \otimes_R N$ to $N \otimes_R M$.

## Description

Given $R$-modules $M$ and $N$, there exists a canonical isomorphism $f \colon M \otimes_R N \to N \otimes_R M$ interchanging the factors. This method implements this isomorphism.

Even for free modules, this map is not simply given by the identity matrix.

 i1 : R = ZZ/101[x,y]; i2 : M = R^2 2 o2 = R o2 : R-module, free i3 : N = R^3 3 o3 = R o3 : R-module, free i4 : f = tensorCommutativity(M, N) o4 = | 1 0 0 0 0 0 | | 0 0 0 1 0 0 | | 0 1 0 0 0 0 | | 0 0 0 0 1 0 | | 0 0 1 0 0 0 | | 0 0 0 0 0 1 | 6 6 o4 : Matrix R <--- R i5 : assert isWellDefined f i6 : assert isIsomorphism f

By giving the generators of $M$ and $N$ sufficiently different degrees, we see that the canonical generators for the two tensor products come in different orders. The isomorphism is given by the corresponding permutation matrix.

 i7 : M = R^{1,2} 2 o7 = R o7 : R-module, free, degrees {-1, -2} i8 : N = R^{100,200,300} 3 o8 = R o8 : R-module, free, degrees {-100, -200, -300} i9 : M ** N 6 o9 = R o9 : R-module, free, degrees {-101, -201, -301, -102, -202, -302} i10 : N ** M 6 o10 = R o10 : R-module, free, degrees {-101, -102, -201, -202, -301, -302} i11 : tensorCommutativity(M, N) o11 = {-101} | 1 0 0 0 0 0 | {-102} | 0 0 0 1 0 0 | {-201} | 0 1 0 0 0 0 | {-202} | 0 0 0 0 1 0 | {-301} | 0 0 1 0 0 0 | {-302} | 0 0 0 0 0 1 | 6 6 o11 : Matrix R <--- R

For completeness, we include an example when neither module is free.

 i12 : g = tensorCommutativity(coker vars R ++ coker vars R, image vars R) o12 = {1} | 1 0 0 0 | {1} | 0 0 1 0 | {1} | 0 1 0 0 | {1} | 0 0 0 1 | o12 : Matrix i13 : source g o13 = cokernel {1} | -y 0 x y 0 0 0 0 0 0 | {1} | x 0 0 0 0 0 x y 0 0 | {1} | 0 -y 0 0 x y 0 0 0 0 | {1} | 0 x 0 0 0 0 0 0 x y | 4 o13 : R-module, quotient of R i14 : target g o14 = cokernel {1} | x y 0 0 0 0 0 0 -y 0 | {1} | 0 0 x y 0 0 0 0 0 -y | {1} | 0 0 0 0 x y 0 0 x 0 | {1} | 0 0 0 0 0 0 x y 0 x | 4 o14 : R-module, quotient of R i15 : assert isWellDefined g i16 : assert isIsomorphism g