Macaulay2 » Documentation
Packages » Macaulay2Doc :: Matrix * Matrix
next | previous | forward | backward | up | index | toc

Matrix * Matrix -- matrix multiplication

Synopsis

Description

Multiplication of matrices corresponds to composition of maps, and when the target Q of g equals the source P of f, the product f*g is defined, its source is the source of g, and its target is the target of f.
i1 : R = QQ[a,b,c,x,y,z];
i2 : f = matrix{{x},{y},{z}}

o2 = | x |
     | y |
     | z |

             3      1
o2 : Matrix R  <-- R
i3 : g = matrix{{a,b,c}}

o3 = | a b c |

             1      3
o3 : Matrix R  <-- R
i4 : f*g

o4 = | ax bx cx |
     | ay by cy |
     | az bz cz |

             3      3
o4 : Matrix R  <-- R

The degree of f*g is the sum of the degrees of f and of g.

The product is also defined when P != Q, provided only that P and Q are free modules of the same rank. If the degrees of P differ from the corresponding degrees of Q by the same degree d, then the degree of f*g is adjusted by d so it will have a good chance to be homogeneous, and the target and source of f*g are as before.
i5 : target (f*g) == target f

o5 = true
i6 : source (f*g) == source g

o6 = true
i7 : isHomogeneous (f*g)

o7 = true
i8 : degree(f*g)

o8 = {1}

o8 : List
Sometimes, it is useful to make this a map of degree zero. Use map(Matrix) for this purpose.
i9 : h = map(f*g,Degree=>0)

o9 = | ax bx cx |
     | ay by cy |
     | az bz cz |

             3      3
o9 : Matrix R  <-- R
i10 : degree h

o10 = {0}

o10 : List
i11 : degrees source h

o11 = {{2}, {2}, {2}}

o11 : List

See also

Ways to use this method: