MATH 110 - Day 10

2024-10-02 10:05:35 -0400 EDT


Multiplying matrixes

Let $A = [a_1, a_2, … a_K], 1 \times k$ matrix
Let $B = [b_1, b_2, … b_K], k \times 1$ matrix

Regard A and B as vectors $ \in \mathbb{R}^k$

Definition: $ A \cdot B = [a_1b_1 + a_2b_2 + … + a_kb_k]$, 1 x 1 matrix

More General Definition:

Let $A = m \times k$ matrix
Let $B = k \times m$ matrix

such that:
$R_i =$ the $i$th row of A
$C_j =$ the $j$th column of A

we can define the product:
$R_i C_j = [a_{i1}b_{1j} + a_{i2}b_{j2} + … + a_{ik}b_{jk}]$


Example:

Let $ A = \left[ \begin{array}{rrr} 1 & 0 & 2 \\ -1 & 4 & -2 \\ 7 & 1 & 3 \\ -4 & 2 & 1 \end{array} \right] $

Let $ B = \left[ \begin{array}{rrr} 1 & -1 \\ -2 & 3 \\ -1 & 2 \\ \end{array} \right] $

$AB$ is well defined and a $ 4 \times 2$ matrix; $BA$ is not well defined

$ AB = \left[ \begin{array}{rrr} 1 & 0 & 2 \\ -1 & 4 & -2 \\ 7 & 1 & 3 \\ -4 & 2 & 1 \end{array} \right] \left[ \begin{array}{rrr} 1 & -1 \\ -2 & 3 \\ -1 & 2 \\ \end{array} \right] $

$= \left[ \begin{array}{rrrrrrrrrr} (1(1) & + & 0(-2) & + & 2(-1)) & (1(-1) & + & 0(3) & + & 2(2)) \\ (-1(1) & + & 4(-2) & - & 2(-1)) & (-1(-1) & + & 4(3) & - & 2(2)) \\ (7(1) & + & 1(-2) & + & 3(-1)) & (7(-1) & + & 1(3) & + & 3(2)) \\ (-4(1) & + & 2(-2) & + & 1(-1)) & (-4(-1) & + & 2(3) & + & 1(2)) \end{array} \right] $

$ = \left[ \begin{array}{rrrrrrrrrr} (1 \ + \ 0 \ - \ 2) \ (-1 \ + \ 0 \ + \ 4) \\ (-1 \ - \ 8 \ + \ 2) \ (1 \ + \ 12 \ - \ 4) \\ (7 \ - \ 2 \ - \ 3) \ (-7 \ + \ 3 \ + \ 6) \\ (-4 \ - \ 4 \ -\ 1) \ (4 \ + \ 6 \ + \ 2) \end{array} \right] = \left[ \begin{array}{rrrrrrrrrr} -1 & 3 \\ -7 & 9 \\ 2 & 2 \\ -1 & 12 \end{array} \right] $

Note: Matrix multiplication is not commutative (i.e. $AB \neq BA$). Even when $AB$ and $BA$ are well defined, they are still not equal.

Note: The Cancellation laws are not valid for matrix multiplication: $AB = AC \not\Rightarrow B = C$ (that also means $AB = 0 \not \Rightarrow A = \vec{0}$ or $B = \vec{0}$)