Continue **reading** Section 3.1 (partitioned matrices) and Section 3.2 for next class.
Work through recommended homework questions.

**Quiz 4** is this week, and will focus on the material in Section
2.4 (networks) and the parts of 3.1 and 3.2 we finish today.

**Office hour:** Today, 3:00-3:30, MC103B.

**Help Centers:** Monday-Friday 2:30-6:30 in MC 106.

The entry in the $i$th row and $j$th column of $A$ is usually written $a_{ij}$ or sometimes $A_{ij}$.

The **diagonal entries** are $a_{11}, a_{22}, \ldots$

If $A$ is square and the __non__diagonal entries are all zero, then
$A$ is called a **diagonal matrix**.

**Definition:** A diagonal matrix with all diagonal entries equal is
called a **scalar matrix**. A scalar matrix with diagonal entries all
equal to $1$ is an **identity matrix**.

All of these are scalar matrices:
$$
\kern-8ex
% The Rules create some space below the matrices:
\mystack{
I_3 = \bmat{rrr}
1 & 0 & 0 \\
0 & 1 & 0 \\
0 & 0 & 1
\emat
\Rule{0pt}{0pt}{18pt}
}{\text{identity matrix}}
\quad
\mystack{
\bmat{rrr}
3 & 0 & 0 \\
0 & 3 & 0 \\
0 & 0 & 3
\emat
\Rule{0pt}{0pt}{18pt}
}{\text{scalar}}
\quad
\mystack{
O = \bmat{rrr}
0 & 0 & 0 \\
0 & 0 & 0 \\
0 & 0 & 0
\emat
\Rule{0pt}{0pt}{18pt}
}{\text{zero matrix}}
$$
**Note:** Identity $\implies$ scalar $\implies$ diagonal $\implies$ square.

**Definition:** If $A$ and $B$ are __both__ $m \times n$ matrices,
then their **sum** $A + B$ is the $m \times n$ matrix obtained by adding the
corresponding entries of $A$ and $B$:
$A + B = [a_{ij} + b_{ij}]$.

**Definition:** If $A$ is an $m \times n$ matrix and $c$ is a scalar,
then the **scalar multiple** $cA$ is the $m \times n$ matrix obtained
by multiplying each entry by $c$:
$cA = [c \, a_{ij}]$.

(a) $A + B = B + A$ (comm.) | (b) $(A + B) + C = A + (B + C)$ (assoc.) |

(c) $A + O = A$ | (d) $A + (-A) = O$ |

(e) $c(A+B) = cA + cB$ (dist.) | (f) $(c+d)A = cA + dA$ (dist.) |

(g) $c(dA) = (cd)A$ | (h) $1A = A$ |

Compare to Theorem 1.1.

This means that __all of the concepts for vectors transfer to matrices__.

E.g., manipulating matrix equations: $$ \kern-8ex 2(A+B) - 3(2B - A) = 2A + 2B -6B +3A = 5A - 4B . $$

We define a **linear combination** to be a matrix of the form:
$$ c_1 A_1 + c_2 A_2 + \cdots + c_k A_k .$$

And we can define the **span** of a set of matrices to be
the set of all their linear combinations.

And we can say that the matrices $A_1, A_2, \ldots, A_k$ are
**linearly independent** if
$$ c_1 A_1 + c_2 A_2 + \cdots + c_k A_k = O$$
has only the trivial solution $c_1 = \cdots = c_k = 0$, and
are **linearly dependent** otherwise.

Our techniques for vectors also apply to answer questions such as:

**Example 3.16 (a):** Suppose
$$
\kern-8ex
\small
A_1 = \bmat{rr} 0 & 1 \\ -1 & 0 \emat,
\
A_2 = \bmat{rr} 1 & 0 \\ 0 & 1 \emat,
\
A_3 = \bmat{rr} 1 & 1 \\ 1 & 1 \emat,
\
B = \bmat{rr} 1 & 4 \\ 2 & 1 \emat
$$
Is $B$ a linear combination of $A_1$, $A_2$ and $A_3$?

That is, are there scalars $c_1$, $c_2$ and $c_3$ such that $$ \kern-6ex c_1 \bmat{rr} 0 & 1 \\ -1 & 0 \emat + c_2 \bmat{rr} 1 & 0 \\ 0 & 1 \emat + c_3 \bmat{rr} 1 & 1 \\ 1 & 1 \emat = \bmat{rr} 1 & 4 \\ 2 & 1 \emat ? $$ Rewriting the left-hand side gives $$ \bmat{rr} c_2+c_3 & c_1+c_3 \\ -c_1+c_3 & c_2+c_3 \emat = \bmat{rr} 1 & 4 \\ 2 & 1 \emat $$ and this is equivalent to the system $$ \begin{aligned} \phantom{-c_1 + {}} c_2 + c_3\ &= 1 \\ \ph c_1 \phantom{{}+c_2} + c_3\ &= 4 \\ -c_1 \phantom{{}+c_2} + c_3\ &= 2 \\ \phantom{-c_1 + {}} c_2 + c_3\ &= 1 \\ \end{aligned} $$ and we can use row reduction to determine that there is a solution, and to find it if desired: $c_1 = 1, c_2 = -2, c_3 = 3$, so $A_1 - 2A_2 + 3A_3 = B$.

This works exactly as if we had written the matrices as column vectors and asked the same question.

See also Examples 3.16(b), 3.17 and 3.18 in text.

**Definition:** If $A$ is $m \times \red{n}$ and $B$ is $\red{n} \times r$, then the **product**
$C = AB$ is the $m \times r$ matrix whose $i,j$ entry is
$$
\kern-6ex
c_{ij}
= a_{i\red{1}} b_{\red{1}j} + a_{i\red{2}} b_{\red{2}j} + \cdots + a_{i\red{n}} b_{\red{n}j}
= \sum_{\red{k}=1}^{n} a_{i\red{k}} b_{\red{k}j} .
$$
This is the dot product of the $i$th row of $A$ with the $j$th column of $B$.

$$ \mystack{A}{m \times n} \ \ \mystack{B}{n \times r} \mystack{=}{\strut} \mystack{AB}{m \times r} $$

We write $A^1 = A$ and $A^0 = I_n$.

We will see in a moment that $(AB)C = A(BC)$, so the expression for $A^k$ is unambiguous. And it follows that $$ A^r A^s = A^{r+s} \qquad\text{and}\qquad (A^r)^s = A^{rs} $$ for all nonnegative integers $r$ and $s$.

For the most part, matrix multiplication behaves like multiplication of real numbers, but there are several differences:

**Example 3.13 on board:** Powers of
$$
B = \bmat{rr} 0 & -1 \\ 1 & 0 \emat
$$

**Question:**
Is there a nonzero matrix $A$ such that $A^2 = O$?

Yes. For example, take
$$
\kern-4ex
A = \bmat{rr} 0 & 1 \\ 0 & 0 \emat
\qquad\text{or}\qquad
A = \bmat{rr} 2 & 4 \\ -1 & -2 \emat .
$$

**Challenge problems:** (1) Find a $3 \times 3$ matrix $A$ such that $A^2 \neq O$
but $A^3 = O$.

(2) Find a $2 \times 2$ matrix $A$ such that $A \neq I_2$ but $A^3 = I_2$.

I'll come back to these next class.

**Example on board:** Tell me the entries of two $2 \times 2$ matrices
$A$ and $B$, and let's compute $AB$ and $BA$.

We can have $A \neq O$ but $A^k = O$ for some $k > 1$.

We can have $B \neq \pm I$, but $B^4 = I$.

We can have $AB \neq BA$.

We can have $B \neq \pm I$, but $B^4 = I$.

We can have $AB \neq BA$.

These are good material for true/false questions...

But most expected properties **do** hold:

(a) $A(BC) = (AB)C$ | (associativity) |

(b) $A(B + C) = AB + AC$ | (left distributivity) |

(c) $(A+B)C = AC + BC$ | (right distributivity) |

(d) $k(AB) = (kA)B = A(kB)$ | (no cool name) |

(e) $I_m A = A = A I_n$ if $A$ is $m \times n$ | (identity) |

The text proves (b) and half of (e). (c) and the other half of (e) are the same, with right and left reversed.

**Proof of (d):**
$$
\kern-8ex
\begin{aligned}
(k(AB))_{ij}\ &= k (AB)_{ij} = k (\row_i(A) \cdot \col_j(B)) \\
&= (k \, \row_i(A)) \cdot \col_j(B)
= \row_i(kA) \cdot \col_j(B) \\
&= ((kA)B)_{ij}
\end{aligned}
$$
so $k(AB) = (kA)B$. The other part of (d) is similar.$\quad\Box$

**Proof of (a):** (Using $A_{ij}$ notation for matrix entries.)
$$
\kern-8ex
%\small
\begin{aligned}
((AB)C)_{ij}\ &= \sum_k (AB)_{ik} C_{kj} = \sum_k \sum_l A_{il} B_{lk} C_{kj} \\
&= \sum_l \sum_k A_{il} B_{lk} C_{kj} = \sum_l A_{il} (BC)_{lj}
= (A(BC))_{ij}
\end{aligned}
$$
so $A(BC) = (AB)C$.$\quad\Box$

**Example on board:** $A I = A$.

**Example on board:**
Solve $$2 ( X - A) + (A + B)(B + I) = 0$$ for $X$ in terms of $A$ and $B$.

**Example 3.20:** If $A$ and $B$ are square matrices of the same
size, is $(A+B)^2 = A^2 + 2 AB + B^2$?

**Note:** Theorem 3.3 shows that a scalar matrix $kI_n$ commutes
with *every* $n \times n$ matrix $A$.
So
$$
\kern-8ex
(A + kI_n)^2 = A^2 + 2 A (k I_n) + (k I_n)^2 = \query{A^2 + 2 k A + k^2 I_n}
$$
($I_n$ is like the number $1$.)

**True/false:**
If $A$ is $2 \times 3$ and $B$ is $3 \times 2$, then
we always have $AB \neq BA$.

**True/false:**
Every $1 \times 1$ matrix is a scalar matrix.

It follows that all $1 \times 1$ matrices commute with each other.

**Note:** The non-commutativity of matrices is directly related
to **quantum mechanics**. Observables in quantum mechanics are
described by matrices, and if the matrices don't commute, then you
can't know both quantities at the same time!

**Next class:** more from Sections 3.1 and 3.2: Transpose, symmetric matrices,
partitioned matrices.