Multiplication of Matrices

DEFINITION 1.2.8 (Matrix Multiplication / Product)   Let $ A=[a_{ij}]$ be an $ m \times n$ matrix and $ B= [b_{ij}]$ be an $ n \times r$ matrix. The product $ A B$ is a matrix $ C =
[c_{ij}]$ of order $ m \times r,$ with

$\displaystyle c_{ij} = \sum\limits_{k=1}^n a_{ik}
b_{kj} = a_{i1} b_{1j} + a_{i2} b_{2j} + \cdots + a_{in} b_{nj}.$

That is, if $ A_{m \times n} = \left[\begin{array}{cccc} & & \cdots & \\ & & \cdots & \\
a_...
...a_{i2} & \cdots & a_{in} \\ & & \cdots & \\ & & \cdots & \\
\end{array}\right]$ and $ B_{n \times r} = \left[\begin{array}{ccc} \cdots & b_{1j} & \cdots \\
\cdots ...
... \\ \vdots & \vdots & \vdots \\
\cdots & b_{mj} & \cdots \\ \end{array}\right]$ then

$\displaystyle A B = [(AB)_{ij}]_{m \times r} {\mbox{ and }} (AB)_{ij} = a_{i1} b_{1j} + a_{i2} b_{2j} + \cdots + a_{in} b_{nj}.$

Observe that the product $ A B$ is defined if and only if
THE NUMBER OF COLUMNS OF MATHEND000# THE NUMBER OF ROWS OF MATHEND000#

For example, if $ A=
\begin{bmatrix}1 & 2 & 3 \\ 2 & 4 & 1 \end{bmatrix}$ and $ B
= \begin{bmatrix}1 & 2 & 1\\ 0 & 0 & 3 \\ 1 & 0 & 4
\end{bmatrix}$ then

$\displaystyle A B$ $\displaystyle =$ $\displaystyle \begin{bmatrix}1 +0+ 3 & 2+0+0 & 1 + 6
+ 12 \\ 2 + 0+1 & 4+0+0 & 2 + 12 + 4 \end{bmatrix} =
\begin{bmatrix}4 & 2 & 19 \\ 3 & 4 & 18
\end{bmatrix}$  
  $\displaystyle =$ $\displaystyle \begin{bmatrix}1 \cdot (1 \ 2 \ 1) + 2 \cdot (0 \ 0 \ 3 ) + 3 \cd...
...
2 \cdot (1 \ 2 \ 1) + 4 \cdot (0 \ 0 \ 3 ) + 1 \cdot (1 \ 0 \ 4)
\end{bmatrix}$ (1.2.1)
  $\displaystyle =$ $\displaystyle \left[\begin{array}{c} \left(\begin{array}{c} 1 \\ 2 \end{array}\...
... 0
+ \left(\begin{array}{c} 3 \\ 1 \end{array}\right) \cdot 1\end{array}\right.$  
    $\displaystyle \hspace{.75in} \left(\begin{array}{c} 1 \\ 2 \end{array}\right) \...
...rray}\right) \cdot 0 + \left(\begin{array}{c} 3 \\ 1 \end{array}\right) \cdot 0$  
    $\displaystyle \hspace{1.5in} \left. \begin{array}{c} \left(\begin{array}{c} 1 \...
... + \left(\begin{array}{c} 3 \\ 1 \end{array}\right) \cdot 4 \end{array}\right].$ (1.2.2)

Observe the following:
  1. In this example, while $ A B$ is defined, the product $ B A$ is not defined.

    However, for square matrices $ A$ and $ B$ of the same order, both the product $ A B$ and $ B A$ are defined.

  2. The product $ A B$ corresponds to operating on the rows of the matrix $ B$ (see 1.2.1), and
  3. The product $ A B$ also corresponds to operating on the columns of the matrix $ A$ (see 1.2.2).

DEFINITION 1.2.9   Two square matrices $ A$ and $ B$ are said to commute if $ A B = B
A.$

Remark 1.2.10  
  1. Note that if $ A$ is a square matrix of order $ n$ then $ A
I_n = I_n A.$ Also, a scalar matrix of order $ n$ commutes with any square matrix of order $ n$ .
  2. In general, the matrix product is not commutative. For example, consider the following two matrices $ A = \begin{bmatrix}1 & 1 \\ 0 & 0 \end{bmatrix}$ and $ B = \begin{bmatrix}1 & 0 \\ 1 & 0 \end{bmatrix}$ . Then check that the matrix product

    $\displaystyle A B = \begin{bmatrix}2 & 0 \\ 0 & 0 \end{bmatrix} \neq \begin{bmatrix}
1 & 1 \\ 1 & 1 \end{bmatrix} = B A.$

THEOREM 1.2.11   Suppose that the matrices $ A, \;B$ and $ C$ are so chosen that the matrix multiplications are defined.
  1. Then $ (A B) C = A (B C).$ That is, the matrix multiplication is associative.
  2. For any $ k \in {\mathbb{R}}, \; (k A) B = k ( A B) = A ( k B).$
  3. Then $ A(B + C) = A B + A C.$ That is, multiplication distributes over addition.
  4. If $ A$ is an $ n \times n$ matrix then $ A I_n = I_n A = A.$
  5. For any square matrix $ A$ of order $ n$ and $ D={\mbox{diag}}(d_1, d_2, \ldots, d_n),$ we have
    • the first row of $ D A$ is $ d_1$ times the first row of $ A;$
    • for $ 1 \leq i \leq n,$ the $ i^{\mbox{th}}$ row of $ D A$ is $ d_i$ times the $ i^{\mbox{th}}$ row of $ A.$
    A similar statement holds for the columns of $ A$ when $ A$ is multiplied on the right by $ D.$

Proof. Part 1. $ \;\;$ Let $ A= [a_{ij}]_{m \times n}, \; B= [b_{ij}]_{n \times p}$ and $ C = [c_{ij}]_{p \times q}.$ Then

$\displaystyle (BC)_{kj} = \sum_{\ell=1}^p b_{k \ell} c_{\ell j} \;\; {\mbox{ and }} \;\;
(AB)_{i\ell} = \sum_{k=1}^n a_{i k} b_{k \ell}.$

Therefore,
$\displaystyle \bigl( A(BC) \bigr)_{ij}$ $\displaystyle =$ $\displaystyle \sum_{k=1}^n a_{ik} \bigl(BC\bigr)_{kj} =
\sum_{k=1}^n a_{ik} \bigl( \sum_{\ell=1}^p b_{k\ell} c_{\ell j}\bigr)$  
  $\displaystyle =$ $\displaystyle \sum_{k=1}^n \sum_{\ell=1}^p a_{ik} \bigl( b_{k\ell}c_{\ell j}\bigr)
= \sum_{k=1}^n \sum_{\ell=1}^p \bigl( a_{ik} b_{k\ell} \bigr) c_{\ell j}$  
  $\displaystyle =$ $\displaystyle \sum_{\ell=1}^p \bigl(\sum_{k=1}^n a_{ik} b_{k\ell} \bigr) c_{\ell j}
= \sum_{\ell=1}^t \bigl(AB \bigr)_{i\ell}c_{\ell j}$  
  $\displaystyle =$ $\displaystyle \bigl( (AB)C \bigr)_{ij}.$  

Part 5. $ \;\;$ For all $ j = 1, 2, \ldots, n,$ we have

$\displaystyle (D A)_{ij} = \sum_{k=1}^n d_{ik} a_{kj} = d_i a_{ij}$

as $ d_{ik} = 0$ whenever $ i \neq k.$ Hence, the required result follows.

The reader is required to prove the other parts. height6pt width 6pt depth 0pt

EXERCISE 1.2.12  
  1. Let $ A$ and $ B$ be two matrices. If the matrix addition $ A + B$ is defined, then prove that $ (A + B)^t = A^t + B^t$ . Also, if the matrix product $ A B$ is defined then prove that $ (AB)^t = B^t A^t$ .
  2. Let $ A = [a_1, a_2, \ldots, a_n]$ and $ B = \begin{bmatrix}b_1 \\ b_2 \\
\vdots \\ b_n \end{bmatrix}.$ Compute the matrix products $ A B$ and $ B A.$
  3. Let $ n$ be a positive integer. Compute $ A^n$ for the following matrices:

    $\displaystyle \begin{bmatrix}1 & 1 \\ 0 & 1 \end{bmatrix}, \hspace{.25in}
\begi...
...hspace{.25in}
\begin{bmatrix}1 & 1 & 1 \\ 1 & 1 & 1 \\ 1 & 1 & 1 \end{bmatrix}.$

    Can you guess a formula for $ A^n$ and prove it by induction?
  4. Find examples for the following statements.
    1. Suppose that the matrix product $ A B$ is defined. Then the product $ B A$ need not be defined.
    2. Suppose that the matrix products $ A B$ and $ B A$ are defined. Then the matrices $ A B$ and $ B A$ can have different orders.
    3. Suppose that the matrices $ A$ and $ B$ are square matrices of order $ n.$ Then $ A B$ and $ B A$ may or may not be equal.

A K Lal 2007-09-12