Matrices
Types and Basic Operations
A matrix is a rectangular array of numbers arranged in rows and columns. A matrix with $m$ rows and $n$ columns is said to have order $m\times n$, and the entry in row $i$, column $j$ is written $a_{ij}$. Matrices give us a compact language for systems of equations, transformations and data tables.
Special types
| Type | Defining condition |
|---|---|
| Row matrix | only one row ($1\times n$) |
| Column matrix | only one column ($m\times 1$) |
| Square matrix | $m=n$ |
| Diagonal matrix | square, all off-diagonal entries $0$ |
| Scalar matrix | diagonal with all diagonal entries equal |
| Identity $I_n$ | scalar matrix with diagonal entries $1$ |
| Zero matrix $O$ | every entry $0$ |
Equality of matrices
Two matrices are equal only if they have the same order and every corresponding entry is equal: $A=B \iff a_{ij}=b_{ij}$ for all $i,j$. This single idea turns one matrix equation into a set of scalar equations — the standard way "find $x,y$" problems are solved.
How many entries?
An $m\times n$ matrix has $mn$ entries. If you must build a matrix with exactly $12$ entries, the possible orders are the factor pairs of $12$: $1\times12,\ 2\times6,\ 3\times4,\ 4\times3,\ 6\times2,\ 12\times1$ — six in all.
Equality entry-by-entry gives $x+y=7$ and $x-y=3$. Adding: $2x=10\Rightarrow x=5$; then $y=2$.
$a_{11}=\tfrac{(2)^2}{2}=2,\ a_{12}=\tfrac{(3)^2}{2}=\tfrac92,\ a_{21}=\tfrac{9}{2},\ a_{22}=\tfrac{(4)^2}{2}=8$. So $A=\begin{bmatrix} 2 & \tfrac92\\[2pt] \tfrac92 & 8\end{bmatrix}$.
There are $2\times3=6$ positions and each independently has $2$ choices, giving $2^{6}=64$ matrices.
$7$ is prime, so the only factor pairs are $1\times7$ and $7\times1$ — just two possible orders.
- Order $m\times n$ means $m$ rows, $n$ columns; entry $a_{ij}$ sits in row $i$, column $j$.
- Diagonal $\subset$ scalar $\subset$ identity is the nesting for square matrices with the obvious extra conditions.
- $A=B$ requires equal order and equal corresponding entries.
- An $m\times n$ matrix has $mn$ entries; possible orders for $N$ entries = factor pairs of $N$.
Multiplication and Transpose
Matrices can be added, scaled and multiplied, but each operation has rules about when it is defined.
Addition and scalar multiplication
Two matrices can be added only if they have the same order; you add corresponding entries. Multiplying by a scalar $k$ multiplies every entry by $k$. These behave just like ordinary algebra: addition is commutative and associative, and $k(A+B)=kA+kB$.
Matrix multiplication
The product $AB$ is defined only when the number of columns of $A$ equals the number of rows of $B$. If $A$ is $m\times n$ and $B$ is $n\times p$, then $AB$ is $m\times p$, with
$$(AB)_{ij}=\sum_{k=1}^{n} a_{ik}\,b_{kj}\quad(\text{row }i \text{ of }A \text{ times column }j \text{ of }B).$$
What is — and is not — true
- Not commutative: usually $AB\ne BA$; one product may exist while the other does not.
- Associative & distributive: $A(BC)=(AB)C$ and $A(B+C)=AB+AC$.
- Zero divisors exist: $AB=O$ does not imply $A=O$ or $B=O$.
- $AI=IA=A$ for a conformable identity matrix.
$AB=\begin{bmatrix}1\cdot2+2\cdot1 & 1\cdot0+2\cdot3\\ 3\cdot2+4\cdot1 & 3\cdot0+4\cdot3\end{bmatrix}=\begin{bmatrix}4 & 6\\ 10 & 12\end{bmatrix}.$
$BA=\begin{bmatrix}2\cdot1+0\cdot3 & 2\cdot2+0\cdot4\\ 1\cdot1+3\cdot3 & 1\cdot2+3\cdot4\end{bmatrix}=\begin{bmatrix}2 & 4\\ 10 & 14\end{bmatrix}.$ Since $AB=\begin{bmatrix}4&6\\10&12\end{bmatrix}\ne BA$, multiplication is not commutative.
$AB=\begin{bmatrix}1\cdot2+2\cdot(-1) & 1\cdot(-4)+2\cdot2\\ 2\cdot2+4\cdot(-1) & 2\cdot(-4)+4\cdot2\end{bmatrix}=\begin{bmatrix}0&0\\0&0\end{bmatrix}.$ A striking fact: $AB=O$ although neither $A$ nor $B$ is the zero matrix.
$2A=\begin{bmatrix}2&-2\\0&4\end{bmatrix}$, $3B=\begin{bmatrix}0&3\\3&3\end{bmatrix}$, so $2A-3B=\begin{bmatrix}2&-5\\-3&1\end{bmatrix}.$
- Add/subtract only same-order matrices, entrywise; scalar $k$ multiplies every entry.
- $AB$ exists iff (cols of $A$) $=$ (rows of $B$); result is (rows of $A$)$\times$(cols of $B$).
- $(AB)_{ij}=\sum_k a_{ik}b_{kj}$ — row times column.
- Multiplication is associative and distributive but not commutative.
- $AB=O$ does not force $A=O$ or $B=O$ (zero divisors).
Symmetric, Skew and Invertible
The transpose $A^{T}$ (also written $A'$) of a matrix is obtained by interchanging its rows and columns: $(A^{T})_{ij}=a_{ji}$. If $A$ is $m\times n$, then $A^{T}$ is $n\times m$.
Rules of transpose
- $(A^{T})^{T}=A$
- $(A+B)^{T}=A^{T}+B^{T}$
- $(kA)^{T}=kA^{T}$
- Reversal law: $(AB)^{T}=B^{T}A^{T}$
Symmetric and skew-symmetric
A square matrix is symmetric if $A^{T}=A$ (so $a_{ij}=a_{ji}$), and skew-symmetric if $A^{T}=-A$ (so $a_{ij}=-a_{ji}$, forcing every diagonal entry to be $0$). A key theorem: every square matrix splits uniquely as
$$A=\underbrace{\tfrac12\left(A+A^{T}\right)}_{\text{symmetric}}+\underbrace{\tfrac12\left(A-A^{T}\right)}_{\text{skew-symmetric}}.$$
Invertible matrices
A square matrix $A$ is invertible if there exists $B$ with $AB=BA=I$; then $B=A^{-1}$ is unique. Such an inverse exists precisely when $\det A\ne 0$ (proved in the Determinants chapter). The reversal law also holds: $(AB)^{-1}=B^{-1}A^{-1}$.
Swap rows and columns: $A^{T}=\begin{bmatrix}1&4\\2&5\\3&6\end{bmatrix}$ (a $3\times2$ matrix).
$A^{T}=\begin{bmatrix}0&-2\\2&0\end{bmatrix}=-A$. The diagonal entries are $0$ as required, so $A$ is skew-symmetric.
$A^{T}=\begin{bmatrix}2&1\\3&4\end{bmatrix}$. Symmetric part $\tfrac12(A+A^{T})=\begin{bmatrix}2&2\\2&4\end{bmatrix}$; skew part $\tfrac12(A-A^{T})=\begin{bmatrix}0&1\\-1&0\end{bmatrix}$. Their sum is $A$.
For a diagonal matrix invert each diagonal entry: $A^{-1}=\begin{bmatrix}\tfrac12&0\\0&\tfrac13\end{bmatrix}$. Check: $AA^{-1}=I$.
- $A^{T}$ swaps rows and columns; $(A^{T})^{T}=A$ and $(AB)^{T}=B^{T}A^{T}$.
- Symmetric: $A^{T}=A$. Skew-symmetric: $A^{T}=-A$ (diagonal entries all $0$).
- Every square matrix $=$ symmetric part $\tfrac12(A+A^{T})$ $+$ skew part $\tfrac12(A-A^{T})$.
- $A$ is invertible $\iff \det A\ne0$; the inverse is unique and $(AB)^{-1}=B^{-1}A^{-1}$.