Mul­ti­ply­ing two matri­ces is not done entry by entry. Instead each row of the first matrix is com­bined with each col­umn of the sec­ond. The rule looks strange at first, but it is exactly what is needed to work out totals such as a shop­ping bill, and it is what turns a sys­tem of equa­tions into a sin­gle matrix equa­tion. This les­son explains the rule, when a prod­uct exists, and the laws it does and does not obey.

Row times col­umn

Start with a row matrix times a col­umn matrix of the same length. Mul­ti­ply the match­ing entries and add:

[321][52110180]=[3×52+2×110+1×180]=[556]\begin{bmatrix} 3 & 2 & 1 \end{bmatrix}\begin{bmatrix} 52 \\ 110 \\ 180 \end{bmatrix} = \begin{bmatrix} 3 \times 52 + 2 \times 110 + 1 \times 180 \end{bmatrix} = \begin{bmatrix} 556 \end{bmatrix}

This is a bill: buy­ing 33 kg of rice at ₹52, 22 kg of dal at ₹110 and 11 kg of oil at ₹180 costs ₹556.

The prod­uct of two matri­ces

If AA is of order m×nm \times n and BB is of order n×pn \times p, the prod­uct ABAB is the m×pm \times p matrix whose entry in row ii and col­umn jj is

(row i of A)×(column j of B)\text{(row } i \text{ of } A) \times \text{(column } j \text{ of } B)

worked out as above: mul­ti­ply match­ing entries and add.

When does ABAB exist? Only when the num­ber of columns of AA equals the num­ber of rows of BB. A use­ful pic­ture:

(m×n‾)×(n‾×p)→m×p(m \times \underline{n}) \times (\underline{n} \times p) \to m \times p

The inner num­bers must match; the outer num­bers give the order of the prod­uct.

Exam­ple 1

Find ABAB and BABA for A=[1234]A = \begin{bmatrix} 1 & 2 \\ 3 & 4 \end{bmatrix} and B=[5678]B = \begin{bmatrix} 5 & 6 \\ 7 & 8 \end{bmatrix}.

AB=[1×5+2×71×6+2×83×5+4×73×6+4×8]=[19224350]AB = \begin{bmatrix} 1 \times 5 + 2 \times 7 & 1 \times 6 + 2 \times 8 \\ 3 \times 5 + 4 \times 7 & 3 \times 6 + 4 \times 8 \end{bmatrix} = \begin{bmatrix} 19 & 22 \\ 43 & 50 \end{bmatrix}

BA=[5×1+6×35×2+6×47×1+8×37×2+8×4]=[23343146]BA = \begin{bmatrix} 5 \times 1 + 6 \times 3 & 5 \times 2 + 6 \times 4 \\ 7 \times 1 + 8 \times 3 & 7 \times 2 + 8 \times 4 \end{bmatrix} = \begin{bmatrix} 23 & 34 \\ 31 & 46 \end{bmatrix}

So AB≠BAAB \neq BA. Matrix mul­ti­pli­ca­tion is not com­mu­ta­tive: the order of the fac­tors mat­ters.

Exam­ple 2

Let C=[1203−14]C = \begin{bmatrix} 1 & 2 & 0 \\ 3 & -1 & 4 \end{bmatrix} (2×32 \times 3) and E=[2103−12]E = \begin{bmatrix} 2 & 1 \\ 0 & 3 \\ -1 & 2 \end{bmatrix} (3×23 \times 2). Find CECE and ECEC.

CECE has order 2×22 \times 2:

CE=[2+0+01+6+06+0−43−3+8]=[2728]CE = \begin{bmatrix} 2 + 0 + 0 & 1 + 6 + 0 \\ 6 + 0 - 4 & 3 - 3 + 8 \end{bmatrix} = \begin{bmatrix} 2 & 7 \\ 2 & 8 \end{bmatrix}

ECEC has order 3×33 \times 3:

EC=[2+34−10+40+90−30+12−1+6−2−20+8]=[5349−3125−48]EC = \begin{bmatrix} 2 + 3 & 4 - 1 & 0 + 4 \\ 0 + 9 & 0 - 3 & 0 + 12 \\ -1 + 6 & -2 - 2 & 0 + 8 \end{bmatrix} = \begin{bmatrix} 5 & 3 & 4 \\ 9 & -3 & 12 \\ 5 & -4 & 8 \end{bmatrix}

Here CECE and ECEC do not even have the same order.

Exam­ple 3

Ravi buys 33 kg of rice, 22 kg of dal and 11 kg of oil. The prices per kg at two shops are given by the columns of [5260110104180170]\begin{bmatrix} 52 & 60 \\ 110 & 104 \\ 180 & 170 \end{bmatrix} (rows: rice, dal, oil). Where is his shop­ping cheaper?

[321][5260110104180170]=[556558]\begin{bmatrix} 3 & 2 & 1 \end{bmatrix}\begin{bmatrix} 52 & 60 \\ 110 & 104 \\ 180 & 170 \end{bmatrix} = \begin{bmatrix} 556 & 558 \end{bmatrix}

The bill is ₹556 at the first shop and ₹558 at the sec­ond, so the first shop is cheaper by ₹2.

Laws of mul­ti­pli­ca­tion

When­ever the prod­ucts exist:

  1. (AB)C=A(BC)(AB)C = A(BC) (asso­cia­tive law)
  2. A(B+C)=AB+ACA(B + C) = AB + AC and (A+B)C=AC+BC(A + B)C = AC + BC (dis­trib­u­tive laws)
  3. AI=IA=AAI = IA = A for a square matrix AA and the iden­tity matrix II of the same order
  4. k(AB)=(kA)B=A(kB)k(AB) = (kA)B = A(kB) for a scalar kk

Two famil­iar laws of num­bers fail for matri­ces:

  • In gen­eral AB≠BAAB \neq BA (Exam­ple 1).
  • AB=OAB = O does not force A=OA = O or B=OB = O. For exam­ple,

[1111][1−1−11]=[1−1−1+11−1−1+1]=[0000]\begin{bmatrix} 1 & 1 \\ 1 & 1 \end{bmatrix}\begin{bmatrix} 1 & -1 \\ -1 & 1 \end{bmatrix} = \begin{bmatrix} 1 - 1 & -1 + 1 \\ 1 - 1 & -1 + 1 \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}

even though nei­ther fac­tor is the zero matrix.

Pow­ers of a square matrix

For a square matrix, A2=AAA^2 = AA, A3=A2AA^3 = A^2A, and so on.

Exam­ple 4

If A=[2112]A = \begin{bmatrix} 2 & 1 \\ 1 & 2 \end{bmatrix}, show that A2−4A+3I=OA^2 - 4A + 3I = O.

A2=[4+12+22+21+4]=[5445]A^2 = \begin{bmatrix} 4 + 1 & 2 + 2 \\ 2 + 2 & 1 + 4 \end{bmatrix} = \begin{bmatrix} 5 & 4 \\ 4 & 5 \end{bmatrix}

A2−4A+3I=[5445]−[8448]+[3003]=[0000]A^2 - 4A + 3I = \begin{bmatrix} 5 & 4 \\ 4 & 5 \end{bmatrix} - \begin{bmatrix} 8 & 4 \\ 4 & 8 \end{bmatrix} + \begin{bmatrix} 3 & 0 \\ 0 & 3 \end{bmatrix} = \begin{bmatrix} 0 & 0 \\ 0 & 0 \end{bmatrix}

Prac­tice

  1. If AA is 3×43 \times 4 and BB is 4×24 \times 2, does ABAB exist? What is its order? Does BABA exist?
  2. Find [123][456]\begin{bmatrix} 1 & 2 & 3 \end{bmatrix}\begin{bmatrix} 4 \\ 5 \\ 6 \end{bmatrix}.
  3. Find [456][123]\begin{bmatrix} 4 \\ 5 \\ 6 \end{bmatrix}\begin{bmatrix} 1 & 2 & 3 \end{bmatrix}.
  4. For A=[2013]A = \begin{bmatrix} 2 & 0 \\ 1 & 3 \end{bmatrix} and B=[14−12]B = \begin{bmatrix} 1 & 4 \\ -1 & 2 \end{bmatrix}, find ABAB and BABA.
  5. For A=[102011]A = \begin{bmatrix} 1 & 0 & 2 \\ 0 & 1 & 1 \end{bmatrix} and B=[123011]B = \begin{bmatrix} 1 & 2 \\ 3 & 0 \\ 1 & 1 \end{bmatrix}, find ABAB.
  6. If A=[1221]A = \begin{bmatrix} 1 & 2 \\ 2 & 1 \end{bmatrix}, show that A2−2A−3I=OA^2 - 2A - 3I = O.
  7. Find A2A^2 for A=[0100]A = \begin{bmatrix} 0 & 1 \\ 0 & 0 \end{bmatrix}. What does this show?
  8. For A=[1101]A = \begin{bmatrix} 1 & 1 \\ 0 & 1 \end{bmatrix}, find A2A^2 and A3A^3.
  9. Sita buys 44 pens and 33 note­books. Pens cost ₹10 and note­books ₹30 at one shop, and ₹12 and ₹28 at another. Use a matrix prod­uct to find her bill at each shop.

Answers

Show answers
  1. Yes: columns of AA (44) equal rows of BB (44), so ABAB is 3×23 \times 2. BABA would need the 22 columns of BB to match the 33 rows of AA, so it does not exist.
  2. [4+10+18]=[32]\begin{bmatrix} 4 + 10 + 18 \end{bmatrix} = \begin{bmatrix} 32 \end{bmatrix}.
  3. A 3×33 \times 3 matrix: [48125101561218]\begin{bmatrix} 4 & 8 & 12 \\ 5 & 10 & 15 \\ 6 & 12 & 18 \end{bmatrix}.
  4. AB=[28−210]AB = \begin{bmatrix} 2 & 8 \\ -2 & 10 \end{bmatrix} and BA=[61206]BA = \begin{bmatrix} 6 & 12 \\ 0 & 6 \end{bmatrix}.
  5. AB=[1+0+22+0+20+3+10+0+1]=[3441]AB = \begin{bmatrix} 1 + 0 + 2 & 2 + 0 + 2 \\ 0 + 3 + 1 & 0 + 0 + 1 \end{bmatrix} = \begin{bmatrix} 3 & 4 \\ 4 & 1 \end{bmatrix}.
  6. A2=[5445]A^2 = \begin{bmatrix} 5 & 4 \\ 4 & 5 \end{bmatrix}, and [5445]−[2442]−[3003]=O\begin{bmatrix} 5 & 4 \\ 4 & 5 \end{bmatrix} - \begin{bmatrix} 2 & 4 \\ 4 & 2 \end{bmatrix} - \begin{bmatrix} 3 & 0 \\ 0 & 3 \end{bmatrix} = O.
  7. A2=OA^2 = O, although A≠OA \neq O. A non-zero matrix can have a zero square.
  8. A2=[1201]A^2 = \begin{bmatrix} 1 & 2 \\ 0 & 1 \end{bmatrix} and A3=[1301]A^3 = \begin{bmatrix} 1 & 3 \\ 0 & 1 \end{bmatrix}.
  9. [43][10123028]=[130132]\begin{bmatrix} 4 & 3 \end{bmatrix}\begin{bmatrix} 10 & 12 \\ 30 & 28 \end{bmatrix} = \begin{bmatrix} 130 & 132 \end{bmatrix}: ₹130 at the first shop and ₹132 at the sec­ond.