Linear Algebra
3.18 min read

Matrix Basics

A matrix is a rectangular array of numbers arranged in rows and columns. An m×nm \times n matrix has mm rows and nn columns. The entry in row ii and column jj is written aija_{ij}.

Matrices are more than just arrays — they encode linear transformations. Every m×nm \times n matrix defines a function from Rn\mathbb{R}^n to Rm\mathbb{R}^m. This is the central fact of Chapter 3.

The columns of a matrix are vectors in Rm\mathbb{R}^m. We often write A=[a1a2an]A = [\mathbf{a}_1 \mid \mathbf{a}_2 \mid \cdots \mid \mathbf{a}_n] to emphasize the column structure.

Formal View

Definition 3.1 — Matrix
An m×nm \times n matrix AA is a rectangular array A=(aij)A = (a_{ij}) where aijRa_{ij} \in \mathbb{R}, 1im1 \leq i \leq m, 1jn1 \leq j \leq n. The identity matrix InI_n has aii=1a_{ii} = 1 and aij=0a_{ij} = 0 for iji \neq j.

Why This Matters

Matrices are the fundamental data structure for encoding linear transformations and systems of equations.

  • Adjacency matrices encode graphs: aij=1a_{ij} = 1 if there is an edge from node ii to node jj
  • Covariance matrices in statistics encode relationships between variables
  • In deep learning, weight matrices encode learned transformations between layers

Quiz

Question 1

A matrix AA has entry a23=5a_{23} = 5. This entry is in:

Common Mistakes

  • Confusing rows and columns in the entry notation aija_{ij} — first index is always the row.
  • Writing the size as n×mn \times m instead of m×nm \times n (rows × columns).