MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Matrix Multiplication...

  • To: mathgroup at
  • Subject: [mg23574] Re: [mg23551] Matrix Multiplication...
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Sat, 20 May 2000 17:44:30 -0400 (EDT)
  • Sender: owner-wri-mathgroup at

The answer lies in the following:


{Flat, Listable, NumericFunction, OneIdentity, Orderless, Protected}

The Mathematica function Times has the attribute Listable. This means that
it threads over lists as in:

Times[{a, b, c}, {d, e, f}]

{a d, b e, c f}

Since Matrices are lists of lists and you get the result you have observed.
Listability is actually implemented via the function Thread rather than
Outer. In other words you will get the same result with:

Thread[Times[{a, b, c}, {d, e, f}]]

{a d, b e, c f}

On the other hand the usual matrix product is implemented through . (Dot)
which is a special case of Inner. Although Mathematica's use of Dot for
matrix product may see non-standard it is completely consistent with the way
Dot behaves for arbitrary tensors including vectors (it contracts the last
index of the first tensor with the first index of the second tensor).

Andrzej Kozlowski
Toyama International University

on 00.5.20 4:10 PM, J.R. Chaffer at jrchaff at wrote:

> Hi,
> New to Mathematica, and to exotic matrix techniques.
> Apparently Mathematica does "ordinary" matrix multiplication
> via the "dot" product symbol, ".";  but when one uses the
> asterisk, one gets "squaring" of two matrices:
> If m1 = {{a,b},{c,d}};  and m2={{e,f},{g,h}};  then
> m1*m2 = {{ae, bf},{cg,dh}},  and
> m1*m1 = {{a^2, b^2},{c^2, d^2}};
> while m1.m2 gives normal matrix multiplication.
> What is going on here?  What kind of matrix multiplication is
> this "*" giving?  Why does it match up with the casual appearance
> of 'squaring' if m1 = m2?  I tried the Mathematica function
> "Outer", i.e. "Outer[Times,m1,m2]", and this is NOT the same
> as the result with "*".  I don't understand outer products anyway,
> but apparently that is not this, whatever it is.
> Can someone give me a short explanation?
> Thanks.
> John Chaffer
> old-timer-new-person

  • Prev by Date: Re: Dirichlet function plot
  • Next by Date: Re: Matrix Multiplication...
  • Previous by thread: Matrix Multiplication...
  • Next by thread: Re: Matrix Multiplication...