1. What Is a Matrix?
A matrix is a rectangular array of numbers (or other mathematical objects) arranged in horizontal rows and vertical columns. The individual numbers inside a matrix are called its entries (or elements).
Formal Definition
A matrix with $m$ rows and $n$ columns is called an $m \times n$ matrix (read "$m$ by $n$"). We say the matrix has order (or dimensions) $m \times n$.
$$A = \begin{pmatrix} a_{11} & a_{12} & \cdots & a_{1n} \\ a_{21} & a_{22} & \cdots & a_{2n} \\ \vdots & \vdots & \ddots & \vdots \\ a_{m1} & a_{m2} & \cdots & a_{mn} \end{pmatrix}$$Double-Index Notation — Make It Reflex
The entry in the $i$-th row and $j$-th column is written $a_{ij}$. The convention is always row first, column second. This is non-negotiable:
- $a_{23}$ means "row 2, column 3" — never the other way around.
- The full matrix can be written compactly as $A = (a_{ij})$ where $1 \le i \le m$ and $1 \le j \le n$.
Equality of Matrices
Two matrices $A = (a_{ij})$ and $B = (b_{ij})$ are equal if and only if:
- They have the same dimensions ($m \times n$), and
- Every corresponding entry is equal: $a_{ij} = b_{ij}$ for all $i, j$.
If even one entry differs, or if the dimensions don't match, the matrices are not equal.
2. Where Do Matrices Come From?
A matrix is a storage format — its real power comes from the operations we define on it. But first, let's see where they arise naturally.
Any data table is a matrix. For example, sales figures for 3 products over 4 quarters form a $3 \times 4$ matrix.
The system:
$$\begin{cases} 2x + 3y = 7 \\ 5x - y = 4 \end{cases}$$has coefficient matrix $\begin{pmatrix} 2 & 3 \\ 5 & -1 \end{pmatrix}$.
(We'll use this idea extensively when we study systems of linear equations.)
A row vector is a $1 \times n$ matrix: $\begin{pmatrix} 3 & -1 & 7 \end{pmatrix}$
A column vector is an $m \times 1$ matrix: $\begin{pmatrix} 3 \\ -1 \\ 7 \end{pmatrix}$
Vectors are just matrices with one dimension equal to 1.
A 2D rotation by angle $\theta$ can be encoded as:
$$R = \begin{pmatrix} \cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{pmatrix}$$(We'll develop the theory behind this later — for now, just note that a $2 \times 2$ array can describe a geometric action.)