Section 2.3 Matrix Multiplication
Definition: Let [latex]\vec{x}[/latex] be a vector in [latex]\mathbb{R}^p[/latex] and [latex]A[/latex] be a [latex]m \times n[/latex] matrix and [latex]B[/latex] be a [latex]n \times p[/latex] matrix then [latex]B\vec{x}[/latex] is a vector in [latex]\mathbb{R}^n[/latex] and then [latex]A(B\vec{x})[/latex] is a vector in [latex]\mathbb{R}^m[/latex]. We call [latex]A(B\vec{x})[/latex] the composition of mappings.
Notice: [latex]A(B\vec{x})[/latex] is only defined that the number of columns of [latex]A[/latex] is the number of rows of [latex]B[/latex].
Question: The composition [latex]A(B\vec{x})[/latex] is a matrix transformation that map from [latex]\mathbb{R}^p[/latex] to [latex]\mathbb{R}^m[/latex]. What is the matrix of the transformation?
Let [latex]A = \begin{bmatrix}\vec{a_{1}} & \cdots & \vec{a_{n}} \end{bmatrix}[/latex] and [latex]B = \begin{bmatrix}\vec{b_{1}} & \cdots & \vec{b_{p}} \end{bmatrix}[/latex], and [latex]\vec{x} = \begin{bmatrix}x_{1}\\\vdots\\x_{p}\end{bmatrix}[/latex] then [latex]B\vec{x} = x_{1}\vec{b_{1}}+\cdots+x_{p}\vec{b_{p}}[/latex]. We have
[latex]A(B\vec{x}) = A(x_{1}\vec{b_{1}} + \cdots + x_{p}\vec{b_{p}})\\ = x_{1}A\vec{b_{1}} + \cdots +x_{p}A\vec{b_{p}}\\ = \begin{bmatrix}A\vec{b_{1}}\cdots A\vec{b_{p}}\end{bmatrix}\begin{bmatrix}x_{1}\\\vdots\\x_{p}\end{bmatrix}\\ = (AB)\vec{x}[/latex]
It is naturally that we call the matrix [latex]\begin{bmatrix}A\vec{b_{1}}\cdots A\vec{b_{p}}\end{bmatrix}[/latex] the product of the matrices [latex]A[/latex] and [latex]B[/latex] which is written [latex]AB[/latex].
Definition: Let [latex]A[/latex] be a [latex]m \times n[/latex] matrix and [latex]B[/latex] be a [latex]n \times p[/latex] matrix with column vectors [latex]\vec{b_{1}}, \cdots, \vec{b_{p}}[/latex], then the product of [latex]A[/latex] and [latex]B[/latex] which is written [latex]AB[/latex] is the [latex]m \times p[/latex] matrix [latex]\begin{bmatrix}A\vec{b_{1}}\cdots A\vec{b_{p}}\end{bmatrix}[/latex].
Example 1: Find [latex]AB[/latex] and [latex]BA[/latex] if they are defined, where [latex]A = \begin{bmatrix} 1 & 2 & 3\\ 2 & -1 & 4 \end{bmatrix}[/latex] and [latex]B = \begin{bmatrix} 2 & 0 & -1 & 3\\ 0 & 4 & 6 & 2\\ 3 & 1 & 0 & 1 \end{bmatrix}[/latex].
Exercise 1: Find [latex]AB[/latex] and [latex]BA[/latex] if they are defined, where [latex]A = \begin{bmatrix} 1 & -2 & 0\\ 2 & 1 & 1\\ 3 & -2 & 0\\ 0 & 1 & 2\\ \end{bmatrix}[/latex] and [latex]B = \begin{bmatrix} 2 & 0 & -1 & 3\\ 0 & 4 & 6 & 2 \end{bmatrix}[/latex].
Definition: Given two vectors [latex]\vec{u}[/latex] and [latex]\vec{v}[/latex] in [latex]\mathbb{R}^n[/latex]. The scalar product or the dot product or inner product of [latex]\vec{u}[/latex] and [latex]\vec{v}[/latex] is [latex](\vec{u})^T\vec{v}[/latex]. The outer product of [latex]\vec{u}[/latex] and [latex]\vec{v}[/latex] is [latex](\vec{u}\vec{v})^T[/latex].
Example 2: Find the inner product and the outer product of [latex]\vec{u}=\begin{bmatrix}2\\1\end{bmatrix}[/latex] and [latex]\vec{v}=\begin{bmatrix}2\\1 \end{bmatrix}[/latex].
Exercise 2: Find the inner product and the outer product of [latex]\vec{u}=\begin{bmatrix}0\\1\\2\end{bmatrix}[/latex] and [latex]\vec{v}=\begin{bmatrix}-1\\0\\3\end{bmatrix}[/latex].
Theorem: (Dot Product Rule) Let [latex]A[/latex] and [latex]B[/latex] be matrices of sizes [latex]m \times n[/latex] and [latex]n \times p[/latex], respectively. Then the [latex](i, j)[/latex]-entry of [latex]AB[/latex] is the dot product of row [latex]i[/latex] of [latex]A[/latex] with column [latex]j[/latex] of [latex]B[/latex].
Example 3: Find [latex]AB[/latex] and [latex]BA[/latex] where [latex]A = \begin{bmatrix}1 & -1\\2 & 3\end{bmatrix}[/latex], and [latex]B = \begin{bmatrix}0 & 2\\4 & 5\end{bmatrix}[/latex]. What can you say about the relationship of [latex]AB[/latex] and [latex]BA[/latex]?
Exercise 3: Find [latex]AB[/latex] and [latex]AC[/latex] where [latex]A = \begin{bmatrix}3 & -6\\-1 & 2\end{bmatrix}[/latex], [latex]B = \begin{bmatrix}0 & 2\\4 & 5\end{bmatrix}[/latex], [latex]C = \begin{bmatrix}-3 & -5\\2 & 1\end{bmatrix}[/latex]. What can you say about the relationship of [latex]AB[/latex] and [latex]AC[/latex]? The relationship of [latex]B[/latex] and [latex]C[/latex]?
Remark: 1. In general [latex]AB \neq BA[/latex].
2. When [latex]AB = AC[/latex], we cannot conclude that [latex]B = C[/latex] as in exercise 3.
3. When [latex]AB = 0[/latex], we cannot conclude that [latex]A[/latex] or [latex]B[/latex] is 0.
Theorem: Let [latex]A[/latex] be a [latex]m \times n[/latex] matrix, [latex]B[/latex] and [latex]C[/latex] be matrices of the same size such that the products with [latex]A[/latex] are defined, and [latex]r[/latex] be a scalar. Then
a. [latex]A(BC)=(AB)C[/latex]
b. [latex]A(B + C)=AB + AC[/latex]
c. [latex](B + C)A=BA + CA[/latex]
d. [latex]r(AB)=(rA)B=A(rB)[/latex]
e. [latex]I_{m}A = A = AI_{n}[/latex] where I_{m} is the [latex]m \times m[/latex] identity matrix and [latex]I_{n}[/latex] is the [latex]n \times n[/latex] identity matrix.
f. [latex](AB)^T=B^T A^T[/latex]
Example 4: Find [latex]A^T[/latex], [latex]B^T[/latex] and [latex](BA)^T[/latex] where [latex]A = \begin{bmatrix}1 & 2 & 3\\-1 & 3 & 2\\0 & -1 & 1\end{bmatrix}[/latex], and [latex]B = \begin{bmatrix}2 & -1 & 3\\1 & 3 & 2\end{bmatrix}[/latex].
Exercise 4: Find [latex]A^T[/latex], [latex]B^T[/latex] and [latex](BA)^T[/latex] where [latex]A = \begin{bmatrix}2 & 3\\0 & 4\\-1 & 2\end{bmatrix}[/latex], and [latex]B = \begin{bmatrix}2 & -1\\1 & 3\end{bmatrix}[/latex].
Definition: Let [latex]A[/latex] be a [latex]n \times n[/latex] matrix then [latex]A^k[/latex] denotes the product of [latex]k[/latex] copies of [latex]A[/latex], i.e. [latex]A^k = A...A[/latex] for [latex]k[/latex] times
Example 5: Find [latex]A^3[/latex] where [latex]A = \begin{bmatrix}1 & 0 & 3\\-1 & 3 & 2\\0 & -1 & 1\end{bmatrix}[/latex].
Exercise 5: Find [latex]B^4[/latex] where [latex]B = \begin{bmatrix}2 & -1\\1 & 3\end{bmatrix}[/latex].
Group Work 1: Mark each statement True or False. Justify each answer.
a. If [latex]A[/latex] and [latex]B[/latex] are [latex]2 \times 2[/latex] matrix with columns [latex]\vec{a_{1}}, \vec{a_{2}}[/latex] and [latex]\vec{b_{1}}, \vec{b_{2}}[/latex]. Then the product [latex]AB = \begin{bmatrix}\vec{a_{1}}\vec{b_{1}} & \vec{a_{2}}\vec{b_{2}}\end{bmatrix}[/latex].
b. [latex]A(B+C) = AB + BC[/latex].
c. [latex]A^T + B^T = (A + B)^T[/latex].
d. The transpose of a product of matrices equals the product of their
transposes in the same order.
e. The first row of [latex]AB[/latex] is the first row of [latex]A[/latex] multiplied on the right by [latex]B[/latex].
f. [latex]A[/latex] is an [latex]n \times n[/latex] matrix , then [latex](A^2)^T = (A^T)^2[/latex].
g. [latex](ABC)^T=C^T A^T B^T[/latex].
Group Work 2: Find [latex]2 \times 2[/latex] nonzero matrices [latex]A[/latex] and [latex]B[/latex] such that
a. [latex]A^2 = 0[/latex]
b. [latex]A^2 = A[/latex]
Group Work 3: If [latex]A[/latex] is any matrix, show that both [latex]AA^T[/latex] and [latex]A^T A[/latex] are symmetric.
Group Work 4: In each case either show the statement is true, or give an example showing that it is false.
a. If [latex]A^2 = I[/latex], then [latex]A = I[/latex].
b. If [latex]AJ = A[/latex], then [latex]J = I[/latex].
c. If [latex]A[/latex] is symmetric, then [latex]I + A[/latex] is symmetric.
d. If [latex]AB = AC[/latex] and [latex]A \neq 0[/latex], then [latex]B = C[/latex].
e. If [latex]A \neq 0[/latex], then [latex]A^2 \neq 0[/latex].
f. If [latex]A[/latex] has a row of zeros, so also does [latex]BA[/latex] for all [latex]B[/latex].
g. If [latex]B[/latex] has a column of zeros, so also does [latex]AB[/latex].
h. If [latex]A[/latex] has a row of zeros, so also does [latex]AB[/latex].