Matrix Multiplication

DOWNLOAD Mathematica Notebook EXPLORE THIS TOPIC IN the MathWorld Classroom

The product C of two matrices A and B is defined as

 c_(ik)=a_(ij)b_(jk),
(1)

where j is summed over for all possible values of i and k and the notation above uses the Einstein summation convention. The implied summation over repeated indices without the presence of an explicit sum sign is called Einstein summation, and is commonly used in both matrix and tensor analysis. Therefore, in order for matrix multiplication to be defined, the dimensions of the matrices must satisfy

 (n×m)(m×p)=(n×p),
(2)

where (a×b) denotes a matrix with a rows and b columns. Writing out the product explicitly,

 [c_(11) c_(12) ... c_(1p); c_(21) c_(22) ... c_(2p); | | ... |; c_(n1) c_(n2) ... c_(np)]=[a_(11) a_(12) ... a_(1m); a_(21) a_(22) ... a_(2m); | | ... |; a_(n1) a_(n2) ... a_(nm)][b_(11) b_(12) ... b_(1p); b_(21) b_(22) ... b_(2p); | | ... |; b_(m1) b_(m2) ... b_(mp)],
(3)

where

c_(11)=a_(11)b_(11)+a_(12)b_(21)+...+a_(1m)b_(m1)
(4)
c_(12)=a_(11)b_(12)+a_(12)b_(22)+...+a_(1m)b_(m2)
(5)
c_(1p)=a_(11)b_(1p)+a_(12)b_(2p)+...+a_(1m)b_(mp)
(6)
c_(21)=a_(21)b_(11)+a_(22)b_(21)+...+a_(2m)b_(m1)
(7)
c_(22)=a_(21)b_(12)+a_(22)b_(22)+...+a_(2m)b_(m2)
(8)
c_(2p)=a_(21)b_(1p)+a_(22)b_(2p)+...+a_(2m)b_(mp)
(9)
c_(n1)=a_(n1)b_(11)+a_(n2)b_(21)+...+a_(nm)b_(m1)
(10)
c_(n2)=a_(n1)b_(12)+a_(n2)b_(22)+...+a_(nm)b_(m2)
(11)
c_(np)=a_(n1)b_(1p)+a_(n2)b_(2p)+...+a_(nm)b_(mp).
(12)

Matrix multiplication is associative, as can be seen by taking

 [(ab)c]_(ij)=(ab)_(ik)c_(kj)=(a_(il)b_(lk))c_(kj),
(13)

where Einstein summation is again used. Now, since a_(il), b_(lk), and c_(kj) are scalars, use the associativity of scalar multiplication to write

 (a_(il)b_(lk))c_(kj)=a_(il)(b_(lk)c_(kj))=a_(il)(bc)_(lj)=[a(bc)]_(ij).
(14)

Since this is true for all i and j, it must be true that

 (ab)c=a(bc).
(15)

That is, matrix multiplication is associative. Equation (13) can therefore be written

 [abc]_(ij)=a_(il)b_(lk)c_(kj),
(16)

without ambiguity. Due to associativity, matrices form a semigroup under multiplication.

Matrix multiplication is also distributive. If A and B are m×n matrices and C and D are n×p matrices, then

A(C+D)=AC+AD
(17)
(A+B)C=AC+BC.
(18)

Since n×n matrices form an Abelian group under addition, n×n matrices form a ring.

However, matrix multiplication is not, in general, commutative (although it is commutative if A and B are diagonal and of the same dimension).

The product of two block matrices is given by multiplying each block

 [o o    ; o o    ;   o   ;    o o o;    o o o;    o o o][x x    ; x x    ;   x   ;    x x x;    x x x;    x x x] 
 =[[o o; o o][x x; x x]  ;  [o][x] ;   [o o o; o o o; o o o][x x x; x x x; x x x]].
(19)

Wolfram Web Resources

Mathematica »

The #1 tool for creating Demonstrations and anything technical.

Wolfram|Alpha »

Explore anything with the first computational knowledge engine.

Wolfram Demonstrations Project »

Explore thousands of free applications across science, mathematics, engineering, technology, business, art, finance, social sciences, and more.

Computerbasedmath.org »

Join the initiative for modernizing math education.

Online Integral Calculator »

Solve integrals with Wolfram|Alpha.

Step-by-step Solutions »

Walk through homework problems step-by-step from beginning to end. Hints help you try the next step on your own.

Wolfram Problem Generator »

Unlimited random practice problems and answers with built-in Step-by-step solutions. Practice online or make a printable study sheet.

Wolfram Education Portal »

Collection of teaching and learning tools built by Wolfram education experts: dynamic textbook, lesson plans, widgets, interactive Demonstrations, and more.

Wolfram Language »

Knowledge-based programming for everyone.