22 / 90

第 22 日:ベクトル、内積、そして線形写像としての行列

ベクトルと行列を幾何学的にも数値的にも学ぶ:線形結合、内積、行列とベクトルの積。すべての対象をモデルの重み行列と埋め込みテーブルに結びつける。各活動で予測、観察、復習、回復を480分の台帳に記録する。

数学とアルゴリズム基礎 480 アクティブ分(8時間の集中学習)
01 120 分

矢印・数列・埋め込みとしてのベクトル

予測と観察の証跡を記録した後のみ支援を利用できる。

前提条件

第 21 日の復習を完了すること。不足する概念があれば記載の回復リンクを使う。

学習目標

ベクトルを平面上の矢印と順序付き数列の両方で表現し、成分ごとの加算・スカラー倍・線形結合を計算し、トークン埋め込みが d 次元のベクトルであることを結びつける。

手順

ベクトル v = (v1, v2, ..., vd) は d 次元空間の矢印であると同時に数の並びでもある。加算とスカラー倍は成分ごとに行う。線形結合 a*v + b*w は2つのベクトルを混ぜるもので、張る空間(span)はそのような混合で到達できる全ての点。言語モデルでは各トークンIDが shape V x d の埋め込みテーブル E の1行を選ぶ。その行は R^d のベクトルである。

演習と予測記録

v = (1, 2)、w = (3, -1) とする。計算前に予測せよ:(a) v + w;(b) 2*v;(c) 線形結合 2*v - w。次に手計算とコードで検証する。

独立習得基準

予測表が全ての計算成分と一致し、v + w の平行四辺形の幾何を説明でき、埋め込みテーブルの行がベクトルである理由を一文で述べられる。

公式ソースリソースと権利証跡

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

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapters 1-2: Vectors and linear combinations, span and basis vectors

検証バージョンと日付: 2016-2023 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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)

著者・提供機関: MIT OpenCourseWare (Prof. Gilbert Strang) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Lecture 1: The geometry of linear equations (row and column pictures)

検証バージョンと日付: Spring 2010 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school algebra and coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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 分

内積:整列・射影・アテンションスコア

独立演習:結果確認前に予測を記録し、証跡を記した後のみ支援を利用。

前提条件

前の活動を完了すること。詰まったら記載の回復リンクを使う。

学習目標

内積 u.v = sum_i u_i*v_i を計算し、2つのベクトルの整列度を測るスケール付き射影として解釈し、アテンション内部のクエリ・キースコアとして認識する。

手順

対応する成分同士を掛けて合計する。幾何学的には u.v = |u| |v| cos(theta)。ゼロでないベクトルでは、符号が角度の種類を示す:正は鋭角、ゼロは直角(直交)、負は鈍角。大きさは両方のノルムにも比例するので、大きな正の値だけでは同方向とは言えない——方向の近さは正規化したコサインで測る。ゼロベクトルには定義された角度がない。アテンションスコアはまさにモデルの重み出力から得たクエリ行とキー行の内積である。

演習と予測記録

u = (2, 1, 0)、v = (1, 3, 4) とする。予測せよ:(a) u.v;(b) cos(theta) = u.v / (|u| |v|);(c) クエリ q = (1, 0, 1) とキー k1 = (1, 0, 1)、k2 = (0, 1, 0) で、内積 q.k が大きいのはどちらか?

独立習得基準

支援なしで3つの数値結果を再現し、直交する組が 0 になる理由を説明し、アテンションスコアとコサイン類似度での内積の使われ方を挙げられる。

公式ソースリソースと権利証跡

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

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 7 (Dot products and duality) and Chapter 1 vector arithmetic

検証バージョンと日付: 2016-2023 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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)

著者・提供機関: MIT OpenCourseWare (Prof. Gilbert Strang) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Lecture 3: multiplication as row-column dot products

検証バージョンと日付: Spring 2010 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school algebra and coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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 分

行列は空間の線形変換である

予測と観察の証跡を記録した後のみ支援を利用できる。

前提条件

前の活動を完了すること。詰まったら記載の回復リンクを使う。

学習目標

行の内積による見方と列による見方の2通りで行列をベクトルに作用させ、反射・回転・一般の重み行列の幾何的効果を予測する。

手順

m x d 行列と d ベクトルの積は m ベクトルを返す。行の見方:各出力成分は行と入力の内積。列の見方:A*x = x1*col1 + x2*col2 + ...、行列の列の線形結合。shape d_out x d_in のモデル重み行列 W は、隠れ状態ベクトル x を変換する線形写像であり、以下の写像と同じである。重み行列は階数2のテンソルでもあり、第 23-24 日でこの shape 推論をより高い階数へ一般化する。

演習と予測記録

x = (2, 1) とする。計算前に各行列の出力を予測せよ:(a) 反射 A = [[1,0],[0,-1]];(b) 90度回転 R = [[0,-1],[1,0]];(c) W = [[2,0],[1,3]] を行と列の両方の見方で。

独立習得基準

記述したトレースで2つの見方が同じ結果を出し、計算前に反転と回転を予測し、W・x・W*x の shape(2x2 . 2 -> 2)を述べられる。

公式ソースリソースと権利証跡

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

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapter 3: Linear transformations and matrices

検証バージョンと日付: 2016-2023 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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)

著者・提供機関: MIT OpenCourseWare (Prof. Gilbert Strang) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Lectures 1-2: column picture and elimination as linear maps

検証バージョンと日付: Spring 2010 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school algebra and coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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 分

独立習得:ベクトル代数と行列・ベクトル積

独立習得チェック(AI支援なし)。

前提条件

前の活動を完了すること。詰まったら記載の回復リンクを使う。

学習目標

支援なしで線形結合、内積、行列・ベクトル積を予測し検証する。間違いがあれば誤用した規則を名指しした回復メモを書く。

手順

閉書で行う:まず予測、次に計算、最後に比較。意外な結果が出たら、どの規則を誤用したかを記録し、回復リンク(第 21 日の復習または記載のソース)をメモする。

演習と予測記録

課題:(a) e1 = (1, 2, 2)、e2 = (2, -1, 2) の内積 e1.e2;(b) W' = [[1,2],[0,1]]、x = (3, 1) での W'*x;(c) (b) の完全な shape 台帳を書く。

独立習得基準

3つの予測を無支援で検証済み。shape 台帳と、W*x が隠れ状態に作用するモデル重み行列であることの一文を自分の言葉で書けている。

公式ソースリソースと権利証跡

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

著者・提供機関: Grant Sanderson (3Blue1Brown) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Chapters 1-4 review: vectors, combinations, transformations

検証バージョンと日付: 2016-2023 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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)

著者・提供機関: MIT OpenCourseWare (Prof. Gilbert Strang) | オリジナル出所URL ↗

該当セクション・タイムスタンプ: Lecture 1-3 problem sets

検証バージョンと日付: Spring 2010 (Verified: 2026-10-30)

選定理由:

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

ソース前提知識:

High-school algebra and coordinate geometry

安全フォールバック(オフライン回復性):

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

比較対象候補リソースと選定評価 (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.