22 / 90

Day 22: Vectors, Dot Products, and Matrices as Linear Maps

Study vectors and matrices geometrically and numerically: linear combinations, dot products, and matrix-vector products; connect every object to model weight matrices and embedding tables. Every activity records prediction, observation, review, and recovery inside the 480-minute ledger.

Mathematics & Algorithmic Foundations 480 active minutes (8 hours focused study)
01 120 min

Vectors as arrows, lists, and embeddings

Assistance allowed only after prediction and observed evidence are recorded.

Prerequisites

Complete Day 21 review; use the listed recovery link if any concept below is missing.

Learning Objective

Represent a vector both as an arrow in the plane and as an ordered list of numbers; compute addition, scalar multiplication, and linear combinations component-wise, then connect a token embedding to a vector in d dimensions.

Instructions

A vector v = (v1, v2, ..., vd) is both an arrow in d-dimensional space and a row of numbers. Addition and scalar multiplication act component-wise. A linear combination a*v + b*w mixes two vectors; the span is every point reachable by such mixes. In a language model, each token id selects one row of an embedding table E of shape V x d, so that row is a vector in R^d.

Practice & Prediction Log

Let v = (1, 2) and w = (3, -1). Before computing anything, predict: (a) v + w; (b) 2*v; (c) the linear combination 2*v - w. Then verify by hand and in code.

Independent Mastery Criterion

Your prediction table matches every computed coordinate, you can describe the parallelogram geometry of v + w, and you can state in one sentence why an embedding-table row is a vector.

Authoritative Source Resources & Provenance

linking 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Essence of Linear Algebra

Author: Grant Sanderson (3Blue1Brown) | Original Source Link ↗

Relevant Section / Range: Chapters 1-2: Vectors and linear combinations, span and basis vectors

Verified Version & Date: 2016-2023 (Verified: 2026-10-30)

Selection Rationale:

Unequaled geometric and visual intuition for vectors, linear transformations, matrix multiplication, and inverses before tensor operations.

Source Prerequisites:

High-school coordinate geometry

Safe Fallback (Offline Resilience):

Geometric explanations, worked formulas, and coordinate exercises are fully provided as original lesson text.

Compared Candidate Sources & Selection Analysis (2)
MIT OCW 18.06 Linear Algebra (Prof. Gilbert Strang) ↗ compared_alternative [CC BY-NC-SA 4.0]

Established textbook/lecture approach, strong mathematical rigor alongside 3Blue1Brown visual intuition.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Theoretical determinant-free proof structure is mathematically elegant but less aligned with computational tensor engineering.

linking CC BY-NC-SA 4.0 noncommercial share-alike

18.06 Linear Algebra (Prof. Gilbert Strang)

Author: MIT OpenCourseWare (Prof. Gilbert Strang) | Original Source Link ↗

Relevant Section / Range: Lecture 1: The geometry of linear equations (row and column pictures)

Verified Version & Date: Spring 2010 (Verified: 2026-10-30)

Selection Rationale:

Established row-picture and column-picture treatment of linear systems, matrix products, and invertibility; rigorous complement to the 3Blue1Brown visual series.

Source Prerequisites:

High-school algebra and coordinate geometry

Safe Fallback (Offline Resilience):

All row/column-picture derivations and worked examples are written as original lesson text and run offline.

Compared Candidate Sources & Selection Analysis (3)
3Blue1Brown: Essence of Linear Algebra ↗ compared_selected_for_days_22_24 [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

Selected as co-primary: geometric visualizations paired with Strang's algebraic rigor.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Determinant-free theoretical treatment is elegant but further from the computational shape accounting required here.

Immersive Linear Algebra (online interactive book) ↗ compared_rejected_for_days_22_24 [Free online (site terms; no OSI/CC license declared)]

Interactive figures are attractive, but the absence of a declared open license makes rights disposition unclear; kept out of the resource set.

02 120 min

Dot products: alignment, projections, and attention scores

Independent practice: record predictions before checking results; assistance only after evidence is logged.

Prerequisites

Complete the previous activity; use the listed recovery link if blocked.

Learning Objective

Compute the dot product u.v = sum_i u_i*v_i, interpret it as a scaled projection measuring alignment between two vectors, and recognize it as the query-key score inside attention.

Instructions

Multiply corresponding coordinates and sum the products. Geometrically u.v = |u| |v| cos(theta). For nonzero vectors, the sign gives the angle class: positive means acute, zero means right (orthogonal), and negative means obtuse. The magnitude also scales with both norms, so a large positive value alone does not mean the vectors point the same way - use the normalized cosine for directional similarity. A zero vector has no defined angle. An attention score is exactly a dot product between a query row and a key row of the model's weight output.

Practice & Prediction Log

Let u = (2, 1, 0) and v = (1, 3, 4). Predict: (a) u.v; (b) cos(theta) = u.v / (|u| |v|); (c) for query q = (1, 0, 1) and keys k1 = (1, 0, 1), k2 = (0, 1, 0), which attention score q.k is larger?

Independent Mastery Criterion

Unaided, you reproduce all three numeric results, explain why an orthogonal pair scores 0, and name where dot products appear in attention scores and cosine similarity.

Authoritative Source Resources & Provenance

linking 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Essence of Linear Algebra

Author: Grant Sanderson (3Blue1Brown) | Original Source Link ↗

Relevant Section / Range: Chapter 7 (Dot products and duality) and Chapter 1 vector arithmetic

Verified Version & Date: 2016-2023 (Verified: 2026-10-30)

Selection Rationale:

Unequaled geometric and visual intuition for vectors, linear transformations, matrix multiplication, and inverses before tensor operations.

Source Prerequisites:

High-school coordinate geometry

Safe Fallback (Offline Resilience):

Geometric explanations, worked formulas, and coordinate exercises are fully provided as original lesson text.

Compared Candidate Sources & Selection Analysis (2)
MIT OCW 18.06 Linear Algebra (Prof. Gilbert Strang) ↗ compared_alternative [CC BY-NC-SA 4.0]

Established textbook/lecture approach, strong mathematical rigor alongside 3Blue1Brown visual intuition.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Theoretical determinant-free proof structure is mathematically elegant but less aligned with computational tensor engineering.

linking CC BY-NC-SA 4.0 noncommercial share-alike

18.06 Linear Algebra (Prof. Gilbert Strang)

Author: MIT OpenCourseWare (Prof. Gilbert Strang) | Original Source Link ↗

Relevant Section / Range: Lecture 3: multiplication as row-column dot products

Verified Version & Date: Spring 2010 (Verified: 2026-10-30)

Selection Rationale:

Established row-picture and column-picture treatment of linear systems, matrix products, and invertibility; rigorous complement to the 3Blue1Brown visual series.

Source Prerequisites:

High-school algebra and coordinate geometry

Safe Fallback (Offline Resilience):

All row/column-picture derivations and worked examples are written as original lesson text and run offline.

Compared Candidate Sources & Selection Analysis (3)
3Blue1Brown: Essence of Linear Algebra ↗ compared_selected_for_days_22_24 [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

Selected as co-primary: geometric visualizations paired with Strang's algebraic rigor.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Determinant-free theoretical treatment is elegant but further from the computational shape accounting required here.

Immersive Linear Algebra (online interactive book) ↗ compared_rejected_for_days_22_24 [Free online (site terms; no OSI/CC license declared)]

Interactive figures are attractive, but the absence of a declared open license makes rights disposition unclear; kept out of the resource set.

03 120 min

A matrix is a linear transformation of space

Assistance allowed only after prediction and observed evidence are recorded.

Prerequisites

Complete the previous activity; use the listed recovery link if blocked.

Learning Objective

Apply a matrix to a vector two ways - the row-dot-product picture and the column-picture - and predict the geometric effect of reflection, rotation, and a general weight matrix.

Instructions

An m x d matrix times a d-vector yields an m-vector. Row picture: each output entry is a dot product between a matrix row and the input. Column picture: A*x = x1*col1 + x2*col2 + ..., a linear combination of the matrix columns. A model weight matrix W of shape d_out x d_in is a linear map transforming a hidden-state vector x, exactly like the maps below. A weight matrix is also a rank-2 tensor; Days 23-24 extend this shape reasoning to higher ranks.

Practice & Prediction Log

Take x = (2, 1). Predict the output of each matrix before computing: (a) reflection A = [[1,0],[0,-1]]; (b) 90-degree rotation R = [[0,-1],[1,0]]; (c) W = [[2,0],[1,3]] using both the row and column pictures.

Independent Mastery Criterion

Both pictures give identical results in your written trace, you predicted the flip and rotation before computing, and you state the shapes of W, x, and W*x (2x2 . 2 -> 2).

Authoritative Source Resources & Provenance

linking 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Essence of Linear Algebra

Author: Grant Sanderson (3Blue1Brown) | Original Source Link ↗

Relevant Section / Range: Chapter 3: Linear transformations and matrices

Verified Version & Date: 2016-2023 (Verified: 2026-10-30)

Selection Rationale:

Unequaled geometric and visual intuition for vectors, linear transformations, matrix multiplication, and inverses before tensor operations.

Source Prerequisites:

High-school coordinate geometry

Safe Fallback (Offline Resilience):

Geometric explanations, worked formulas, and coordinate exercises are fully provided as original lesson text.

Compared Candidate Sources & Selection Analysis (2)
MIT OCW 18.06 Linear Algebra (Prof. Gilbert Strang) ↗ compared_alternative [CC BY-NC-SA 4.0]

Established textbook/lecture approach, strong mathematical rigor alongside 3Blue1Brown visual intuition.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Theoretical determinant-free proof structure is mathematically elegant but less aligned with computational tensor engineering.

linking CC BY-NC-SA 4.0 noncommercial share-alike

18.06 Linear Algebra (Prof. Gilbert Strang)

Author: MIT OpenCourseWare (Prof. Gilbert Strang) | Original Source Link ↗

Relevant Section / Range: Lectures 1-2: column picture and elimination as linear maps

Verified Version & Date: Spring 2010 (Verified: 2026-10-30)

Selection Rationale:

Established row-picture and column-picture treatment of linear systems, matrix products, and invertibility; rigorous complement to the 3Blue1Brown visual series.

Source Prerequisites:

High-school algebra and coordinate geometry

Safe Fallback (Offline Resilience):

All row/column-picture derivations and worked examples are written as original lesson text and run offline.

Compared Candidate Sources & Selection Analysis (3)
3Blue1Brown: Essence of Linear Algebra ↗ compared_selected_for_days_22_24 [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

Selected as co-primary: geometric visualizations paired with Strang's algebraic rigor.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Determinant-free theoretical treatment is elegant but further from the computational shape accounting required here.

Immersive Linear Algebra (online interactive book) ↗ compared_rejected_for_days_22_24 [Free online (site terms; no OSI/CC license declared)]

Interactive figures are attractive, but the absence of a declared open license makes rights disposition unclear; kept out of the resource set.

04 120 min

Independent mastery: vector algebra and matrix-vector products

Independent Mastery Check (no AI assistance).

Prerequisites

Complete the previous activity; use the listed recovery link if blocked.

Learning Objective

Without assistance, predict and verify a linear combination, a dot product, and a matrix-vector product; write a recovery note naming the rule behind any miss.

Instructions

Closed book: predict first, compute second, compare. If a result surprises you, record which rule was misapplied and note the recovery link (Day 21 review or the listed sources).

Practice & Prediction Log

Tasks: (a) dot product e1.e2 for e1 = (1, 2, 2), e2 = (2, -1, 2); (b) W'*x for W' = [[1,2],[0,1]], x = (3, 1); (c) write the full shape ledger for (b).

Independent Mastery Criterion

All three predictions verified unaided; the shape ledger and one sentence connecting W*x to a model weight matrix applied to a hidden state are written in your own words.

Authoritative Source Resources & Provenance

linking 3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions No video, audio, transcript or frame redistribution permitted

Essence of Linear Algebra

Author: Grant Sanderson (3Blue1Brown) | Original Source Link ↗

Relevant Section / Range: Chapters 1-4 review: vectors, combinations, transformations

Verified Version & Date: 2016-2023 (Verified: 2026-10-30)

Selection Rationale:

Unequaled geometric and visual intuition for vectors, linear transformations, matrix multiplication, and inverses before tensor operations.

Source Prerequisites:

High-school coordinate geometry

Safe Fallback (Offline Resilience):

Geometric explanations, worked formulas, and coordinate exercises are fully provided as original lesson text.

Compared Candidate Sources & Selection Analysis (2)
MIT OCW 18.06 Linear Algebra (Prof. Gilbert Strang) ↗ compared_alternative [CC BY-NC-SA 4.0]

Established textbook/lecture approach, strong mathematical rigor alongside 3Blue1Brown visual intuition.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Theoretical determinant-free proof structure is mathematically elegant but less aligned with computational tensor engineering.

linking CC BY-NC-SA 4.0 noncommercial share-alike

18.06 Linear Algebra (Prof. Gilbert Strang)

Author: MIT OpenCourseWare (Prof. Gilbert Strang) | Original Source Link ↗

Relevant Section / Range: Lecture 1-3 problem sets

Verified Version & Date: Spring 2010 (Verified: 2026-10-30)

Selection Rationale:

Established row-picture and column-picture treatment of linear systems, matrix products, and invertibility; rigorous complement to the 3Blue1Brown visual series.

Source Prerequisites:

High-school algebra and coordinate geometry

Safe Fallback (Offline Resilience):

All row/column-picture derivations and worked examples are written as original lesson text and run offline.

Compared Candidate Sources & Selection Analysis (3)
3Blue1Brown: Essence of Linear Algebra ↗ compared_selected_for_days_22_24 [3Blue1Brown copyright (all rights reserved); site FAQ permits only short clips under stated conditions]

Selected as co-primary: geometric visualizations paired with Strang's algebraic rigor.

Linear Algebra Done Right (Sheldon Axler) ↗ compared_rejected_for_curriculum [CC BY-NC (4th edition, Open Access)]

Determinant-free theoretical treatment is elegant but further from the computational shape accounting required here.

Immersive Linear Algebra (online interactive book) ↗ compared_rejected_for_days_22_24 [Free online (site terms; no OSI/CC license declared)]

Interactive figures are attractive, but the absence of a declared open license makes rights disposition unclear; kept out of the resource set.