Matrix operations

We spent some time learning about vectors and operations on vectors: scalar product, vector sum and dot product. Then we learned about matrices, and the matrix-vector product operation, which connects matrices and vectors. This led to several lessons on matrix-vector-product equations, row echelon form and gaussian elimination. Now it's time to look at operations on the matrices themselves. Can we add two matrices? Can we multiply two matrices?

First we have scalar product, i.e. the product of a scalar and a matrix, and the sum of two matrices. These are straightforward because they operate elementwise.

Observe that we can always view an $m\times n$ matrix as a vector with $mn$ elements and, as long as we remember the dimension, we can bounce back and forth between the matrix view and the vector view. The reason this observation is important is because addition and scalar multiplication are the same in either view. (Hopefully this is easy to see.) That means that the associativity rules for scalar multiplication and sum that we have for vectors carries over to matrices, and we get that for free without having to do new proofs!

If $A$ and $B$ are $m \times n$ matrices, and $c$ and $d$ are scalars, then
  1. $c\cdot (d\cdot A) = (c\cdot d)\cdot A$
  2. matrix addition is commutative and associative
  3. $c\cdot(A + B) = c\cdot A + c\cdot B$

ACTIVITY ← we might skip for time
Prove the following theorem

If $A$ and $B$ are $m \times n$ matrices and $\boldsymbol{v}$ is a vector, $(A + B)\cdot \boldsymbol{v} = A\cdot\boldsymbol{v} + B\cdot\boldsymbol{v}$.

ACTIVITY
In-class activity on matrix multiplication. Note: this is really important stuff!

Is matrix multiplication commutative? In class I asked you to figure this out and prove either yes or no. The answer is no!, and to disprove all we need to do is find a counter example: just one pair $A$ and $B$ such that $AB \neq BA$. In fact, almost any pair you chose works. Some work because the dimensions do not match up properly when you switch the order. But I suggest you write down two random 2x2 matrixes and try multiplying them in both orders. You will almost certainly see different results! So matrix multuplication is not commutative, not even if we restrict ourselves to square matrices.

Is matrix multiplication associative? The answer is yes!, but the proof is tedious and not very informative. If you write out the symbolic expressions for the $i,j$th element of $(AB)C$ and $A(BC)$ you'll see that they are equal. I won't make you do it because of the tedium.

Recall our definition of the unit vectors:
The $i$th unit vector in vector space $R^n$, denoted $\boldsymbol{e_i}$, is the vector that is $1$ in its $i$th component and zero everywhere else. If it is not clear by context, we will specify whether it is a row or column vector.
and the identity matrix:
The $n\times n$ identity matrix, denoted by $I_n$, is the matrix whose $i$th row is $\boldsymbol{e_i}$, the $i$th unit (row) vector. Note that this also means that the $i$th column is the $i$th unit (column) vector.
In fact, we have the following theorem:

If $A$ is an $n\times n$ matrix, then $I_n\cdot A = A$.

The ring of nxn matrices

For a fixed $n$, one can show that the $n\times n$ matrices is a ring, with matrix sum and product as addition and multiplication, the all zero matrix as additive identity, and $I_n$ as multiplicative identity. The interesting thing ... this (as you showed in the activity) is a non-commutative ring!

Christopher W Brown