Matrix Multiplication

Digital Handwritten Lesson

1. Introduction

  • Any whole, natural, rational, irrational, or integer numbers can be multiplied with any other numbers.
  • Same is not true with matrices — not every pair of matrices can be multiplied.
  • Only compatible matrices can be multiplied.

So, how do we know which matrices are compatible?

 

Activity

Given Matrices

$$A = \begin{bmatrix} 1 & 2 & 3 \\ 4 & 5 & 6 \\ 7 & 8 & 9 \end{bmatrix}_{3\times3}, \quad B = \begin{bmatrix} 10 & 12 \\ 11 & 13 \\ 14 & 15 \end{bmatrix}_{3\times2}$$
📌 Matrix A has 3 columns
📌 Matrix B has 3 rows
∴ No. of columns in A = No. of rows in B  (both = 3)

 

Conclusion

Product $AB$ exists — we can multiply $A$ and $B$. Hence, $A$ and $B$ are compatible matrices for product $AB$.

 

Definition

Two matrices which can be multiplied together are called Compatible Matrices.

 

Compatibility Criteria

$$\text{No. of columns in } 1^{st} \text{ matrix} = \text{No. of rows in } 2^{nd} \text{ matrix}$$

Order of Product Matrix

$$\text{Order of }AB = \text{Rows of }1^{st}\text{ matrix} \times \text{Columns of }2^{nd}\text{ matrix}$$


 

2. Worked Examples

Multiplication of 1×1 Matrices

$$A = [1],\quad B = [2],\quad AB = [a_{11}]_{1\times1}$$ $$AB = [1][2] = [1\times2] = [2]_{1\times1}$$

 

Multiplication of 2×2 Matrices

$$A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}_{2\times2},\quad B = \begin{bmatrix}4 & 5\\6 & 7\end{bmatrix}_{2\times2},\quad AB = \begin{bmatrix}ab_{11} & ab_{12}\\ab_{21} & ab_{22}\end{bmatrix}_{2\times2}$$

How to find each element:

  • $ab_{11}$ = (1st row of $A$) · (1st col of $B$) $= 1\times4 + 2\times6 = 4+12 = 16$
  • $ab_{12}$ = (1st row of $A$) · (2nd col of $B$) $= 1\times5 + 2\times7 = 5+14 = 19$
  • $ab_{21}$ = (2nd row of $A$) · (1st col of $B$) $= 3\times4 + 4\times6 = 12+24 = 36$
  • $ab_{22}$ = (2nd row of $A$) · (2nd col of $B$) $= 3\times5 + 4\times7 = 15+28 = 43$
$$AB = \begin{bmatrix}4+12 & 5+14\\12+24 & 15+28\end{bmatrix} = \begin{bmatrix}16 & 19\\36 & 43\end{bmatrix}_{2\times2}$$

 

Multiplication of 2×2 with 2×1

$$A = \begin{bmatrix}1 & 2\\3 & 4\end{bmatrix}_{2\times2},\quad B = \begin{bmatrix}5\\6\end{bmatrix}_{2\times1},\quad AB = \begin{bmatrix}ab_{11}\\ab_{21}\end{bmatrix}_{2\times1}$$
  • $ab_{11} = 1\times5 + 2\times6 = 5+12 = 17$
  • $ab_{21} = 3\times5 + 4\times6 = 15+24 = 39$
$$AB = \begin{bmatrix}1\times5+2\times6\\3\times5+4\times6\end{bmatrix} = \begin{bmatrix}17\\39\end{bmatrix}_{2\times1}$$

 

Multiplication of 3×1 and 1×3

$$A = \begin{bmatrix}1\\2\\3\end{bmatrix}_{3\times1},\quad B = \begin{bmatrix}4 & 5 & 6\end{bmatrix}_{1\times3},\quad AB = \begin{bmatrix}ab_{11}&ab_{12}&ab_{13}\\ab_{21}&ab_{22}&ab_{23}\\ab_{31}&ab_{32}&ab_{33}\end{bmatrix}_{3\times3}$$
  • $ab_{11}=1\times4=4,\quad ab_{12}=1\times5=5,\quad ab_{13}=1\times6=6$
  • $ab_{21}=2\times4=8,\quad ab_{22}=2\times5=10,\quad ab_{23}=2\times6=12$
  • $ab_{31}=3\times4=12,\quad ab_{32}=3\times5=15,\quad ab_{33}=3\times6=18$
$$AB = \begin{bmatrix}4&5&6\\8&10&12\\12&15&18\end{bmatrix}_{3\times3}$$

 

Multiplication of 1×2 and 2×1

$$A = \begin{bmatrix}4 & 6\end{bmatrix}_{1\times2},\quad B = \begin{bmatrix}5\\6\end{bmatrix}_{2\times1}$$

Order of product matrix $AB$ is $1\times1$.

$$AB = \begin{bmatrix}4 & 6\end{bmatrix}\begin{bmatrix}5\\6\end{bmatrix} = [4\times5 + 6\times6] = [20+36] = [56]_{1\times1}$$

 

Multiplication of 1×2 and 2×2

$$A = \begin{bmatrix}6 & 7\end{bmatrix}_{1\times2},\quad B = \begin{bmatrix}1 & 2\\4 & 5\end{bmatrix}_{2\times2}$$

Order of product matrix $AB$ is $1\times2$.

$$AB = \begin{bmatrix}6\times1+7\times4 & 6\times2+7\times5\end{bmatrix} = \begin{bmatrix}6+28 & 12+35\end{bmatrix} = \begin{bmatrix}34 & 47\end{bmatrix}_{1\times2}$$

 

3. Properties of Matrix Multiplication

1 Matrix Multiplication is NOT Commutative  ($AB \neq BA$ in general)

Let

$$A = \begin{bmatrix}1&2\\3&4\end{bmatrix},\quad B = \begin{bmatrix}5&6\\7&8\end{bmatrix}$$

Compute $AB$:

$$AB = \begin{bmatrix}1\times5+2\times7 & 1\times6+2\times8\\3\times5+4\times7 & 3\times6+4\times8\end{bmatrix}$$ $$= \begin{bmatrix}5+14 & 6+16\\15+28 & 18+32\end{bmatrix} = \begin{bmatrix}19&22\\43&50\end{bmatrix}$$

Compute $BA$:

$$BA = \begin{bmatrix}5\times1+6\times3 & 5\times2+6\times4\\7\times1+8\times3 & 7\times2+8\times4\end{bmatrix}$$ $$= \begin{bmatrix}5+18 & 10+24\\7+24 & 14+32\end{bmatrix} = \begin{bmatrix}23&34\\31&46\end{bmatrix}$$
$$AB = \begin{bmatrix}19&22\\43&50\end{bmatrix} \neq \begin{bmatrix}23&34\\31&46\end{bmatrix} = BA$$
$\therefore\; AB \neq BA$  ∴ Matrix multiplication is NOT commutative.
 
2 Matrix Multiplication is Associative  [$A(BC) = (AB)C$]
$$A = \begin{bmatrix}1&2\\3&4\end{bmatrix},\quad B = \begin{bmatrix}5&6\\7&8\end{bmatrix},\quad C = \begin{bmatrix}4&8\\6&7\end{bmatrix}$$

Step 1: Find $BC$

$$BC = \begin{bmatrix}5\times4+6\times6 & 5\times8+6\times7\\7\times4+8\times6 & 7\times8+8\times7\end{bmatrix} = \begin{bmatrix}20+36 & 40+42\\28+48 & 56+56\end{bmatrix} = \begin{bmatrix}56&82\\76&112\end{bmatrix}$$

Step 2: Find $A(BC)$

$$A(BC) = \begin{bmatrix}1&2\\3&4\end{bmatrix}\begin{bmatrix}56&82\\76&112\end{bmatrix} = \begin{bmatrix}1\times56+2\times76 & 1\times82+2\times112\\3\times56+4\times76 & 3\times82+4\times112\end{bmatrix} = \begin{bmatrix}208&306\\472&694\end{bmatrix}$$

Step 3: Find $AB$

$$AB = \begin{bmatrix}1&2\\3&4\end{bmatrix}\begin{bmatrix}5&6\\7&8\end{bmatrix} = \begin{bmatrix}19&22\\43&50\end{bmatrix}$$

Step 4: Find $(AB)C$

$$(AB)C = \begin{bmatrix}19&22\\43&50\end{bmatrix}\begin{bmatrix}4&8\\6&7\end{bmatrix} = \begin{bmatrix}19\times4+22\times6 & 19\times8+22\times7\\43\times4+50\times6 & 43\times8+50\times7\end{bmatrix} = \begin{bmatrix}208&306\\472&694\end{bmatrix}$$
$\therefore\; A(BC) = (AB)C = \begin{bmatrix}208&306\\472&694\end{bmatrix}$
∴ Matrix multiplication satisfies the Associative Property.
 
3 Matrix Multiplication is Distributive  [$A(B+C) = AB + AC$]
$$A = \begin{bmatrix}1&2\\3&4\end{bmatrix},\quad B = \begin{bmatrix}5&6\\7&8\end{bmatrix},\quad C = \begin{bmatrix}4&8\\6&7\end{bmatrix}$$

LHS: Find $A(B+C)$

$$B+C = \begin{bmatrix}5+4&6+8\\7+6&8+7\end{bmatrix} = \begin{bmatrix}9&14\\13&15\end{bmatrix}$$ $$A(B+C) = \begin{bmatrix}1&2\\3&4\end{bmatrix}\begin{bmatrix}9&14\\13&15\end{bmatrix} = \begin{bmatrix}1\times9+2\times13 & 1\times14+2\times15\\3\times9+4\times13 & 3\times14+4\times15\end{bmatrix}$$ $$= \begin{bmatrix}9+26&14+30\\27+52&42+60\end{bmatrix} = \begin{bmatrix}35&44\\79&102\end{bmatrix}$$

RHS: Find $AB + AC$

$$AB = \begin{bmatrix}19&22\\43&50\end{bmatrix}, \quad AC = \begin{bmatrix}1&2\\3&4\end{bmatrix}\begin{bmatrix}4&8\\6&7\end{bmatrix} = \begin{bmatrix}4+12&8+14\\12+24&24+28\end{bmatrix} = \begin{bmatrix}16&22\\36&52\end{bmatrix}$$ $$AB+AC = \begin{bmatrix}19+16&22+22\\43+36&50+52\end{bmatrix} = \begin{bmatrix}35&44\\79&102\end{bmatrix}$$
$\therefore\; A(B+C) = AB+AC = \begin{bmatrix}35&44\\79&102\end{bmatrix}$
∴ Matrix multiplication satisfies the Distributive Property.
 
4 Multiplicative Identity  [$AI = IA = A$]
$$A = \begin{bmatrix}1&2\\3&4\end{bmatrix},\quad I = \begin{bmatrix}1&0\\0&1\end{bmatrix}$$

$AI$:

$$AI = \begin{bmatrix}1\times1+2\times0 & 1\times0+2\times1\\3\times1+4\times0 & 3\times0+4\times1\end{bmatrix} = \begin{bmatrix}1&2\\3&4\end{bmatrix}$$

$IA$:

$$IA = \begin{bmatrix}1\times1+0\times3 & 1\times2+0\times4\\0\times1+1\times3 & 0\times2+1\times4\end{bmatrix} = \begin{bmatrix}1&2\\3&4\end{bmatrix}$$
$\therefore\; AI = IA = A$
The Identity Matrix $I$ acts like the number 1 in ordinary multiplication.
 
5 Transpose of a Product  [$(AB)^t = B^t A^t$]
$$A = \begin{bmatrix}1&2\\3&4\end{bmatrix},\quad B = \begin{bmatrix}5&6\\7&8\end{bmatrix}$$

Find $(AB)^t$:

$$AB = \begin{bmatrix}19&22\\43&50\end{bmatrix} \implies (AB)^t = \begin{bmatrix}19&43\\22&50\end{bmatrix}$$

Find $B^t A^t$:

$$A^t = \begin{bmatrix}1&3\\2&4\end{bmatrix},\quad B^t = \begin{bmatrix}5&7\\6&8\end{bmatrix}$$ $$B^t A^t = \begin{bmatrix}5&7\\6&8\end{bmatrix}\begin{bmatrix}1&3\\2&4\end{bmatrix} = \begin{bmatrix}5\times1+7\times2 & 5\times3+7\times4\\6\times1+8\times2 & 6\times3+8\times4\end{bmatrix}$$ $$= \begin{bmatrix}5+14 & 15+28\\6+16 & 18+32\end{bmatrix} = \begin{bmatrix}19&43\\22&50\end{bmatrix}$$
$\therefore\; (AB)^t = B^t A^t = \begin{bmatrix}19&43\\22&50\end{bmatrix}$
∴ The Reversal Rule for Transpose is verified.

 

4. Summary of Properties

Property Statement Holds?
Commutative $AB = BA$
Associative $A(BC) = (AB)C$
Distributive $A(B+C) = AB+AC$
Identity $AI = IA = A$
Transpose $(AB)^t = B^t A^t$

 

← Return to Chapter

Course material curated by Mr. Nripendraswar Acharya