20 / 90

Day 20: Partial derivatives and the gradient vector

Differentiate one variable at a time, assemble the gradient vector, and prove that shared dependency paths add contributions. Every claim is checked by hand against a finite difference or a direct substitution.

AI Mathematics & Calculus 480 active minutes (8 hours focused study)
01 120 min

Partial derivatives: hold every other variable constant

Assistance allowed only after prediction and observed evidence are recorded.

Prerequisites

Day 19 chain rule drills; if the scalar rule is shaky, open the day-level recovery link before continuing.

Learning Objective

Define the partial derivative as the ordinary derivative along one axis with all other variables frozen, compute both partials of a polynomial by hand, and confirm them with finite differences.

Instructions

Study source: within this activity's existing reading/practice time, use MIT OCW 18.02SC Multivariable Calculus, Part 2: Partial Derivatives; differentiation, chain rule and gradient sessions, then explain one connection to the local task in your own words. Keep the local exercise and acceptance checks; use its original explanation if the external source is unavailable. For f(x, y) = x^2 y + 3y - x, freeze y and differentiate in x: ∂f/∂x = 2xy - 1. Freeze x and differentiate in y: ∂f/∂y = x^2 + 3. At the point (2, 1): f = 4*1 + 3 - 2 = 5, ∂f/∂x = 4 - 1 = 3, ∂f/∂y = 4 + 3 = 7. Predict these before checking with central differences: (f(2.00001, 1) - f(1.99999, 1)) / 0.00002 approaches 3, and the y-slice approaches 7.

Practice & Prediction Log

Compute by hand and verify numerically: (a) both partials of f(x, y) = x^2 y + 3y - x at (2, 1); (b) both partials of f(x, y) = x y^2 at (3, 2). Record the frozen variable for every differentiation.

Independent Mastery Criterion

You compute both partials for both functions unaided, state which variable was frozen in each line, and your four values 3, 7, 4, 12 all match a finite-difference check you ran yourself.

Authoritative Source Resources & Provenance

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

MIT OCW 18.02SC Multivariable Calculus

Author: MIT OpenCourseWare (Prof. Denis Auroux) | Original Source Link ↗

Relevant Section / Range: Part 2: Partial Derivatives; differentiation, chain rule and gradient sessions

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

Selection Rationale:

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

Source Prerequisites:

Single-variable calculus and coordinate geometry

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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

Author: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | Original Source Link ↗

Relevant Section / Range: Section 4.3 Partial Derivatives: definition, notation, and worked examples

Verified Version & Date: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

Selection Rationale:

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

Source Prerequisites:

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

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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 min

The gradient vector points up the steepest slope

Independent practice: predict first and preserve the recorded unaided attempt; any later help is a separate assisted-recovery phase, and a fresh equivalent unaided check is required before the idea counts as independent evidence.

Prerequisites

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

Learning Objective

Assemble partials into the gradient vector, normalize it into a unit direction, and verify that the directional slope along the gradient equals its norm.

Instructions

The gradient is ∇f = (∂f/∂x, ∂f/∂y). For f(x, y) = x^2 + y^2, ∇f = (2x, 2y). At (3, 4): ∇f = (6, 8), norm sqrt(36 + 64) = 10, unit direction (0.6, 0.8). The key fact: the directional slope along the gradient equals its norm. Predict (f(3 + 0.6h, 4 + 0.8h) - f(3, 4)) / h for small h before computing; it should approach 10. If you use help after the preserved attempt, treat it as assisted recovery: keep the original attempt unchanged, and pass a fresh equivalent unaided check before calling the idea remediated.

Practice & Prediction Log

Compute by hand: (a) ∇f and its norm for f(x, y) = x^2 + y^2 at (3, 4), then verify the directional slope along the unit gradient approaches the norm; (b) ∇f and its norm for f(x, y) = xy + y^2 at (1, 2).

Independent Mastery Criterion

Unaided, you produce both gradients (6, 8) and (2, 5), both norms 10 and sqrt(29) ≈ 5.385, and you verify numerically that the slope along the unit gradient equals the norm for part (a).

Authoritative Source Resources & Provenance

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

OpenStax Calculus Volume 3

Author: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | Original Source Link ↗

Relevant Section / Range: Section 4.6: the gradient is the direction of maximum increase with magnitude equal to that rate

Verified Version & Date: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

Selection Rationale:

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

Source Prerequisites:

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

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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

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

Relevant Section / Range: Chapter 2 video: the gradient points in the direction of steepest increase

Verified Version & Date: 2017 video release (verified 2026-10-30)

Selection Rationale:

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

Source Prerequisites:

Partial derivative intuition from the previous activity.

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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 min

Multivariable chain rule: shared paths add contributions

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 the multivariable chain rule dz/dt = (∂f/∂x)(dx/dt) + (∂f/∂y)(dy/dt), verify it by direct substitution, and prove that a variable used on two paths contributes twice — not once.

Instructions

Let z = f(x, y) = xy with x = t^2, y = 3t. The chain rule gives dz/dt = y * 2t + x * 3 = 6t^2 + 3t^2 = 9t^2. Check by substituting first: z = 3t^3, so dz/dt = 9t^2 — identical. Then the shared-variable case: L = a*b with b = a + 1. Treat a as reaching L through two paths: directly into the first factor (contribution b) and through b into the second factor (contribution a * db/da = a * 1). Total dL/da = b + a = 2a + 1. Counting only one path is the reusable-variable counterexample.

Practice & Prediction Log

Compute and verify: (a) dz/dt at t = 2 for z = xy, x = t^2, y = 3t — both by the chain rule and by substituting z = 3t^3; (b) dL/da at a = 3 for L = a*b, b = a + 1, showing both path contributions and the wrong single-path answer.

Independent Mastery Criterion

You show both path products for each problem, get 36 and 7 confirmed by an independent method, and can explain in one sentence why the reusable-variable answer must sum contributions rather than pick one.

Authoritative Source Resources & Provenance

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

OpenStax Calculus Volume 3

Author: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | Original Source Link ↗

Relevant Section / Range: Section 4.5: dz/dt equals the sum of partial-derivative products over all paths

Verified Version & Date: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

Selection Rationale:

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

Source Prerequisites:

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

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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

Author: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | Original Source Link ↗

Relevant Section / Range: Section 3.6: scalar chain rule used to check each path product

Verified Version & Date: OpenStax Calculus Volume 1 web edition (verified 2026-10-30)

Selection Rationale:

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

Source Prerequisites:

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

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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 min

Independent mastery check: gradients, verification, and edge cases

Independent Mastery Check (no AI assistance).

Prerequisites

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

Learning Objective

Under closed-book conditions, compute a gradient and its norm, verify the steepest-ascent property numerically, and identify a point where the gradient does not exist.

Instructions

No notes or AI during the check. Part 1: compute ∇f and ||∇f|| for f(x, y) = x^2 + 2y^2 at (1, 1). Part 2: verify numerically that stepping along the unit gradient raises f fastest — the directional slope equals the norm. Part 3: f(x, y) = |x| + |y| at (0, 0): show that both partial derivatives fail to exist there by comparing slopes arriving from the left and the right along each axis.

Practice & Prediction Log

Submit: the gradient and its norm for Part 1, your verification numbers for Part 2, the conflicting slopes for Part 3, and one sentence explaining why the gradient is undefined at that point.

Independent Mastery Criterion

All three parts correct unaided: (2, 4) with norm 2*sqrt(5) ≈ 4.4721 verified directionally, and the -1/+1 slope conflict correctly explained, plus an honest recovery note for anything missed.

Authoritative Source Resources & Provenance

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

OpenStax Calculus Volume 3

Author: OpenStax, Rice University (Gilbert Strang, Edwin Herman, et al.) | Original Source Link ↗

Relevant Section / Range: Section 4.6: gradient exists only where the partial derivatives exist

Verified Version & Date: OpenStax Calculus Volume 3 web edition (verified 2026-10-30)

Selection Rationale:

Frames the nondifferentiable edge case in the mastery check.

Source Prerequisites:

Partial derivatives and the multivariable chain rule.

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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

Author: Python Software Foundation | Original Source Link ↗

Relevant Section / Range: Section 3.1.1 Numbers: arithmetic used by the finite-difference checks

Verified Version & Date: Python 3.12 documentation (verified 2026-10-30)

Selection Rationale:

Reference for the verification arithmetic used in the mastery check.

Source Prerequisites:

Able to run a short Python file from the terminal.

Safe Fallback (Offline Resilience):

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

Compared Candidate Sources & Selection Analysis (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.