20 / 90

Day 20: 偏導數與梯度向量

一次只對一個變數求導,組裝梯度向量,並證明共享依賴路徑的貢獻會相加。每個論斷都用手算、有限差分或直接代入檢驗。

AI 數學與微積分/代數 480 分鐘主動學習(8 小時專注學習)
01 120 分鐘

偏導數:凍結其餘所有變數

只有在記錄預測與觀察證據之後才允許求助。

先修條件

Day 19 的連鎖律練習;若純量法則不熟,先開啟當日恢復連結再繼續。

學習目標

把偏導數定義為凍結其他變數後沿單軸的普通導數,手算多項式的兩個偏導數,並用有限差分確認。

操作說明

學習來源:在本活動現有的閱讀與練習時段內,參考 MIT OCW 18.02SC Multivariable Calculus 的 Part 2: Partial Derivatives; differentiation, chain rule and gradient sessions,用自己的話解釋一處與本地任務的聯繫。保留現有練習與驗收檢查;若外部資料無法存取,使用課程自寫的解釋。對 f(x, y) = x^2 y + 3y - x,凍結 y 對 x 求導:∂f/∂x = 2xy - 1。凍結 x 對 y 求導:∂f/∂y = x^2 + 3。在點 (2, 1):f = 4*1 + 3 - 2 = 5,∂f/∂x = 4 - 1 = 3,∂f/∂y = 4 + 3 = 7。先用中央差分檢驗前請預測:(f(2.00001, 1) - f(1.99999, 1)) / 0.00002 趨近 3,y 方向切片趨近 7。

練習與預測記錄

手算並數值驗證:(a) f(x, y) = x^2 y + 3y - x 在 (2, 1) 處的兩個偏導數;(b) f(x, y) = x y^2 在 (3, 2) 處的兩個偏導數。每一步求導都記錄被凍結的變數。

獨立掌握標準

無幫助下算出兩個函數的全部偏導數,說明每行凍結了哪個變數,且 3、7、4、12 四個值都與你親自執行的有限差分一致。

權威來源資源與出處

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

MIT OCW 18.02SC Multivariable Calculus

作者/機構: MIT OpenCourseWare (Prof. Denis Auroux) | 原始連結 ↗

相關章節/時間戳: Part 2: Partial Derivatives; differentiation, chain rule and gradient sessions

驗證版本與日期: Fall 2010 (Verified: 2026-10-30)

選擇理由:

Rigorous university-lecture treatment that lets motivated learners go deeper on partial derivatives and the gradient after the OpenStax primary text.

來源先修知識:

Single-variable calculus and coordinate geometry

安全回退(離線韌性):

All required formulas, worked examples, and numeric checks are contained in the localized lesson text.

候選來源比較與選擇分析 (2)
OpenStax Calculus Volume 3 ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Chosen as the primary written reference; MIT OCW is the deeper lecture companion.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

More accessible pacing but less rigorous than the Auroux lectures for the path-sum chain rule.

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

OpenStax Calculus Volume 3

作者/機構: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | 原始連結 ↗

相關章節/時間戳: Section 4.3 Partial Derivatives: definition, notation, and worked examples

驗證版本與日期: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選擇理由:

Openly licensed primary definition of the partial derivative matching the day's slice-and-differentiate method.

來源先修知識:

Single-variable derivatives and the chain rule (Study Days 16-19).

安全回退(離線韌性):

The lesson contains complete local derivations, worked answers, and a finite-difference check.

候選來源比較與選擇分析 (2)
MIT OCW 18.02SC Multivariable Calculus (Prof. Denis Auroux) ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

02 120 分鐘

梯度向量指向最陡上升方向

獨立練習:先預測並保留已記錄的無協助嘗試;之後的任何幫助屬於單獨的「協助式補救」階段,須再通過一次新的同等無協助檢查,該概念才算獨立證據。

先修條件

完成上一項活動;若受阻請使用列出的恢復連結。

學習目標

把偏導數組裝為梯度向量,正規化為單位方向,並驗證沿梯度方向的方向導數等於梯度的模長。

操作說明

梯度是 ∇f = (∂f/∂x, ∂f/∂y)。對 f(x, y) = x^2 + y^2,∇f = (2x, 2y)。在 (3, 4) 處:∇f = (6, 8),模長 sqrt(36 + 64) = 10,單位方向 (0.6, 0.8)。關鍵事實:沿梯度方向的方向導數等於其模長。計算前先預測小 h 時 (f(3 + 0.6h, 4 + 0.8h) - f(3, 4)) / h 的值;它應趨近 10。 若在保留的嘗試之後求助,按「協助式補救」處理:原嘗試保持不變,在稱為已補救之前須通過一次新的同等無協助檢查。

練習與預測記錄

手算:(a) f(x, y) = x^2 + y^2 在 (3, 4) 處的 ∇f 及模長,並驗證沿單位梯度方向的方向導數趨近模長;(b) f(x, y) = xy + y^2 在 (1, 2) 處的 ∇f 及模長。

獨立掌握標準

無幫助下給出兩個梯度 (6, 8) 與 (2, 5)、兩個模長 10 與 sqrt(29) ≈ 5.385,並對 (a) 數值驗證沿單位梯度方向的斜率等於模長。

權威來源資源與出處

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

OpenStax Calculus Volume 3

作者/機構: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | 原始連結 ↗

相關章節/時間戳: Section 4.6: the gradient is the direction of maximum increase with magnitude equal to that rate

驗證版本與日期: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選擇理由:

States and proves the steepest-ascent property verified numerically in the exercise.

來源先修知識:

Partial derivatives (day-20-act-01).

安全回退(離線韌性):

The exercise derives the norm equality locally and checks it with a finite difference.

候選來源比較與選擇分析 (2)
MIT OCW 18.02SC Multivariable Calculus (Prof. Denis Auroux) ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

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

Gradient Descent, How Neural Networks Learn

作者/機構: Grant Sanderson (3Blue1Brown) | 原始連結 ↗

相關章節/時間戳: Chapter 2 video: the gradient points in the direction of steepest increase

驗證版本與日期: 2017 video release (verified 2026-10-30)

選擇理由:

Visual motivation for why gradient descent moves downhill, connecting the math to later optimization days.

來源先修知識:

Partial derivative intuition from the previous activity.

安全回退(離線韌性):

The steepest-ascent fact is stated and verified numerically in the local content.

候選來源比較與選擇分析 (2)
OpenStax Calculus Volume 3 Section 4.6 ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Chosen as the primary written source proving the steepest-ascent theorem; 3Blue1Brown supplies the ML-motivation layer.

Khan Academy: The gradient ↗ compared_alternative [Proprietary (free course)]

Free interactive drills on the same gradient concept; the 3Blue1Brown video was retained for its visual-first derivation of steepest descent.

03 120 分鐘

多變數連鎖律:共享路徑的貢獻相加

只有在記錄預測與觀察證據之後才允許求助。

先修條件

完成上一項活動;若受阻請使用列出的恢復連結。

學習目標

應用多變數連鎖律 dz/dt = (∂f/∂x)(dx/dt) + (∂f/∂y)(dy/dt),用直接代入驗證,並證明同一變數出現在兩條路徑上時貢獻是兩次而非一次。

操作說明

設 z = f(x, y) = xy,其中 x = t^2,y = 3t。連鎖律給出 dz/dt = y * 2t + x * 3 = 6t^2 + 3t^2 = 9t^2。先代入檢驗:z = 3t^3,dz/dt = 9t^2——一致。再看共享變數情形:L = a*b,b = a + 1。a 透過兩條路徑影響 L:直接進入第一個因子(貢獻 b),再透過 b 進入第二個因子(貢獻 a * db/da = a * 1)。總計 dL/da = b + a = 2a + 1。只算一條路徑就是可複用變數的反例。

練習與預測記錄

計算並驗證:(a) z = xy,x = t^2,y = 3t 時 t = 2 處的 dz/dt——分別用連鎖律和代入 z = 3t^3;(b) L = a*b,b = a + 1 時 a = 3 處的 dL/da,寫出兩條路徑的貢獻以及只算單條路徑的錯誤答案。

獨立掌握標準

為每題寫出兩條路徑的乘積項,用獨立方法確認 36 和 7,並能用一句話解釋可複用變數為何必須對貢獻求和而非只取其一。

權威來源資源與出處

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

OpenStax Calculus Volume 3

作者/機構: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | 原始連結 ↗

相關章節/時間戳: Section 4.5: dz/dt equals the sum of partial-derivative products over all paths

驗證版本與日期: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選擇理由:

Primary statement of the tree-diagram rule that the day's shared-path counterexample verifies.

來源先修知識:

Scalar chain rule (day-19) and partial derivatives (day-20-act-01).

安全回退(離線韌性):

Both worked examples are derived locally and cross-checked against direct substitution.

候選來源比較與選擇分析 (2)
MIT OCW 18.02SC Multivariable Calculus (Prof. Denis Auroux) ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

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

OpenStax Calculus Volume 1

作者/機構: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | 原始連結 ↗

相關章節/時間戳: Section 3.6: scalar chain rule used to check each path product

驗證版本與日期: OpenStax Calculus Volume 1 web edition (verified 2026-10-30)

選擇理由:

Recovery reference for the single-variable products inside the multivariable sum.

來源先修知識:

Derivative rules for powers and polynomials (Study Days 16-18).

安全回退(離線韌性):

Day 19 content already covers the scalar rule; this link is optional review.

候選來源比較與選擇分析 (3)
MIT OpenCourseWare 18.01SC Single Variable Calculus ↗ compared_selected_for_visual_practice [CC BY-NC-SA 4.0]

Strong exercises and transcripts, but the noncommercial share-alike terms and course navigation make OpenStax the primary stable text.

Paul's Online Math Notes: Calculus I ↗ compared_rejected_for_reuse [All Rights Reserved]

Useful reference, but rights and redistribution terms are less suitable for embedded recovery material.

SciPy Numerical Differentiation Documentation ↗ compared_selected_for_numerics [BSD-3-Clause]

A primary API reference for numerical derivative step-size behavior; it complements rather than replaces the hand derivation.

04 120 分鐘

獨立掌握檢查:梯度、驗證與邊界情形

獨立掌握檢查(不使用 AI 協助)。

先修條件

完成上一項活動;若受阻請使用列出的恢復連結。

學習目標

在閉卷條件下計算梯度及其模長,數值驗證最陡上升性質,並指出梯度不存在的點。

操作說明

檢查期間不看筆記、不用 AI。第 1 部分:計算 f(x, y) = x^2 + 2y^2 在 (1, 1) 處的 ∇f 和 ||∇f||。第 2 部分:數值驗證沿單位梯度方向前進時 f 上升最快——方向導數等於模長。第 3 部分:f(x, y) = |x| + |y| 在 (0, 0) 處:比較沿各軸從左、從右逼近的斜率,說明兩個偏導數在該點都不存在。

練習與預測記錄

提交:第 1 部分的梯度與模長、第 2 部分的驗證數值、第 3 部分的矛盾斜率,以及一句解釋該點梯度為何無定義。

獨立掌握標準

無幫助下三部分全部正確:(2, 4) 且模長 2*sqrt(5) ≈ 4.4721 經方向驗證,-1/+1 斜率矛盾得到正確解釋,另附對遺漏內容的誠實恢復記錄。

權威來源資源與出處

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

OpenStax Calculus Volume 3

作者/機構: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | 原始連結 ↗

相關章節/時間戳: Section 4.6: gradient exists only where the partial derivatives exist

驗證版本與日期: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

選擇理由:

Frames the nondifferentiable edge case in the mastery check.

來源先修知識:

Partial derivatives and the multivariable chain rule.

安全回退(離線韌性):

The edge case is analyzed locally with directional slopes that disagree.

候選來源比較與選擇分析 (2)
MIT OCW 18.02SC Multivariable Calculus (Prof. Denis Auroux) ↗ compared_selected_for_day20 [CC BY-NC-SA 4.0]

Selected as the lecture-depth companion for partial derivatives; OpenStax Volume 3 remains the written primary reference.

Khan Academy: Multivariable Calculus ↗ compared_alternative [CC BY-NC-SA 4.0]

Strong visual coverage of gradients, but the OpenStax text better matches the lesson's theorem-plus-hand-check structure.

linking PSF License Version 2

The Python Tutorial: Numbers and Expressions

作者/機構: Python Software Foundation | 原始連結 ↗

相關章節/時間戳: Section 3.1.1 Numbers: arithmetic used by the finite-difference checks

驗證版本與日期: Python 3.12 documentation (verified 2026-10-30)

選擇理由:

Reference for the verification arithmetic used in the mastery check.

來源先修知識:

Able to run a short Python file from the terminal.

安全回退(離線韌性):

The verification snippets are embedded and run on a standard Python install.

候選來源比較與選擇分析 (2)
math — Mathematical functions ↗ compared_alternative [PSF License Version 2]

Extends the operator set to transcendental functions; kept as a follow-on once the arithmetic expressions are fluent.

The Python Tutorial: Floating Point Arithmetic Issues ↗ compared_alternative [PSF License Version 2]

Explains binary float representation limits; deferred to the numerics days where tolerance reasoning is rehearsed.