Ch.03
Matrices and Data: Structural Representation of Many Vectors
Math diagram by chapter
Select a chapter to see its diagram below. View the flow of intermediate math at a glance.
Purple columns highlight in turn. Each column is a vector of the same length; placing three columns next to each other forms one matrix. The right panel shows and which column is active. Reading by rows gives one line per sample (a common data convention).
A matrix is a rectangular grid of numbers—one sheet. In machine learning, one row is often one sample (one person, one image) and one column is one feature. This chapter connects vectors (Ch.01) and dot products (Ch.02) to how they appear many times at once inside a matrix, and sets up matrix multiplication and linear layers (Ch.04).
Matrices and data batches: putting many vectors on one sheet
If a vector is numbers in a line, a matrix stacks several such lines into a rectangle. Size means rows meet columns. Notation varies (sometimes rows are samples, sometimes columns)—always check the shape first.
Think of a matrix as one spreadsheet: each cell is a number; a whole column can be one feature vector; a whole row can be one record. The same table changes meaning depending on which direction you read.
Core facts:
1. Shape: means rows and columns of real entries.
2. Entries: the value at row , column is .
3. Transpose: is with .
4. Columns as vectors: columns can be written .
5. Add / scale: for the same shape, and .
This chapter focuses on reading stacked vectors safely and matching dimensions before full matrix multiplication.
In deep learning, weights are often matrices (or 2D slices of tensors). One layer’s linear map is “many dot products at once”; batching stacks samples along a row/column. In machine learning, the design matrix stacks feature vectors into one data table.
One‑line summary: a matrix bundles many vectors on one sheet; whether rows or columns are samples follows convention. The transpose swaps axes to match dimensions. Row dot products from Ch.02 become the coordinates of . Next: matrix multiplication and linear maps.
Ch.01 gave vectors; Ch.02 gave dot products for one interaction. Ch.03 extends that interaction to whole tables. Matrices are the language of losses, gradients, and weight updates.
Real data is usually many samples × many features. Stating the shape makes the layout explicit; wrong shapes silently break code.
Training data is often a design matrix; linear models are written as matrix–vector products. Logistic/softmax, linear SVM, and matrix‑factorization recommendations all use batched vector operations.
Columns span a subspace (column space); fitting data to a lower dimension is projection to a subspace (later chapters).
The table below lists symbols and dimension rules for problem solving. Worked patterns illustrate typical steps.
- Symbol
- Meaning rows and columns
- Symbol
- Meaningentry at row , column
- Symbol
- Meaningtranspose:
- Symbolcolumn
- Meaningcolumn of as a vector
- Symbolsame shape
- Meaning only if dimensions match
- Symbol (preview)
- Meaningvector of row– dot products
| Symbol | Meaning |
|---|---|
| rows and columns | |
| entry at row , column | |
| transpose: | |
| column | column of as a vector |
| same shape | only if dimensions match |
| (preview) | vector of row– dot products |
Details
① Shape Always check dimensions before add/multiply.
② Transpose Swaps sample/feature axes when needed.
③ Row/column view Meaning depends on the problem setup.
④ Ch.02 link Each row dotted with gives one coordinate of .
Practice problems
Below are 10 problems sampled from a bank of 60 (4 easy · 3 medium · 3 hard; order easy→medium→hard). Each item is multiple choice—pick the option number.
Which property matches a zero matrix?
1 / 10