Single-Variable Calculus, Limits & Taylor Series
Limits, L'Hôpital's Rule & Mean Value Theorems
Open Full Lesson →Lagrange's Mean Value Theorem: If f is continuous on [a, b] and differentiable on (a, b), there exists at least one c in (a, b) such that f'(c) = (f(b) - f(a)) / (b - a).
Must-Remember Principles:- —L'Hôpital's Rule: If lim f(x)/g(x) yields 0/0 or inf/inf, then lim f(x)/g(x) = lim f'(x)/g'(x).
- —Exponential Indeterminate Forms (1^inf, 0^0, inf^0): Take natural log: y = f(x)^{g(x)} => ln(y) = g(x) * ln(f(x)), then evaluate limit and exponentiate.
- —Rolle's Theorem: If f is continuous on [a, b], differentiable on (a, b), and f(a) = f(b), then there exists c in (a, b) where f'(c) = 0.
- —Cauchy's MVT: [f(b) - f(a)] / [g(b) - g(a)] = f'(c) / g'(c) for some c in (a, b).
Critical Pitfalls & Exam Traps:- ×Never apply L'Hôpital's rule unless the expression is confirmed to be an indeterminate form (0/0 or inf/inf). Differentiating when the denominator limit is non-zero yields incorrect results.
- ×For 1^inf limits, lim [1 + g(x)]^{1/g(x)} = e as g(x) -> 0. Specifically, lim_{x -> a} [f(x)]^{g(x)} = exp( lim_{x -> a} g(x) * [f(x) - 1] ).
Single-Variable Calculus, Limits & Taylor Series
Taylor Series Expansions & Single-Variable Extrema
Open Full Lesson →Taylor Series at x = a: f(x) = Sum_{k=0}^infinity [ f^{(k)}(a) / k! ] * (x - a)^k. Second-order approximation: f(x) ≈ f(a) + f'(a)(x - a) + (1/2) f''(a)(x - a)^2.
Must-Remember Principles:- —Standard Maclaurin Expansions (a = 0):
- — e^x = 1 + x + x^2 / 2! + x^3 / 3! + ...
- — ln(1 + x) = x - x^2 / 2 + x^3 / 3 - x^4 / 4 + ... (for -1 < x <= 1).
- — sin x = x - x^3 / 3! + x^5 / 5! - ...
- — cos x = 1 - x^2 / 2! + x^4 / 4! - ...
- — 1 / (1 - x) = 1 + x + x^2 + x^3 + ... (for |x| < 1).
- —First Derivative Test: f'(c) = 0. If f' changes + to -, local max; if - to +, local min.
- —Second Derivative Test: f'(c) = 0. If f''(c) > 0, local min; if f''(c) < 0, local max; if f''(c) = 0, test is inconclusive.
Critical Pitfalls & Exam Traps:- ×f''(c) = 0 does NOT automatically imply an inflection point. For f(x) = x^4 at x = 0, f''(0) = 0, but x = 0 is a strict local minimum (not an inflection point).
- ×On closed intervals [a, b], ALWAYS check the boundary endpoints f(a) and f(b) alongside internal critical points when finding global extrema.
Multivariable Calculus, Gradients & Hessians
Partial Derivatives, Gradients & Directional Derivatives
Open Full Lesson →Directional Derivative: D_u f(x) = grad(f(x)) . u for ANY unit vector ||u|| = 1. Maximum rate of increase is ||grad(f(x))|| in direction u = grad(f) / ||grad(f)||.
Must-Remember Principles:- —Gradient Vector: grad(f) = [ df/dx1, df/dx2, ..., df/dxn ]^T.
- —Steepest Descent Direction: -grad(f) points in the direction of maximum instantaneous decrease.
- —Tangent Plane Equation at (x0, y0): z - z0 = (df/dx)(x - x0) + (df/dy)(y - y0).
- —Jacobian Matrix J for F: R^n -> R^m: J_{ij} = dF_i / dx_j (size m x n).
- —Chain Rule: d/dt f(x(t), y(t)) = (df/dx)*(dx/dt) + (df/dy)*(dy/dt) = grad(f) . [dx/dt, dy/dt]^T.
Critical Pitfalls & Exam Traps:- ×Always check that direction vector v is normalized: u = v / ||v||. Using a non-unit vector scales the derivative incorrectly by ||v||.
- ×Directional derivative is ZERO in directions orthogonal to the gradient (tangent to level curves).
Multivariable Calculus, Gradients & Hessians
Multivariate Taylor Approximations & Hessian Classification
Open Full Lesson →Critical Point Classification: At critical point grad(f) = 0, Hessian H Positive Definite (all lambda_i > 0) => Local Min; H Negative Definite (all lambda_i < 0) => Local Max; H Indefinite => Saddle Point.
Must-Remember Principles:- —Hessian Matrix H: H_{ij} = d^2 f / (dx_i dx_j). Symmetric for C^2 continuous functions.
- —Second-Order Multivariate Taylor: f(x + Delta x) ≈ f(x) + grad(f)^T Delta x + (1/2) Delta x^T H Delta x.
- —2D Discriminant Test: D = f_{xx} f_{yy} - (f_{xy})^2 = det(H).
- — If D > 0 and f_{xx} > 0: Local Minimum.
- — If D > 0 and f_{xx} < 0: Local Maximum.
- — If D < 0: Saddle Point (indefinite Hessian).
- — If D = 0: Test is Inconclusive (higher-order terms decide).
Critical Pitfalls & Exam Traps:- ×A saddle point is NOT a local extremum. Optimization algorithms can get stuck at saddle points if gradients vanish.
- ×If det(H) > 0, the eigenvalues share the same sign, which matches the sign of f_{xx}. If det(H) < 0, eigenvalues have opposite signs (saddle point).
Convex Sets, Functions & Lagrangian Duality
Convex Sets, Convex Functions & Jensen's Inequality
Open Full Lesson →Global Optimality: For a convex function f defined on a convex set C, EVERY local minimum is guaranteed to be a GLOBAL minimum.
Must-Remember Principles:- —Convex Set: For all x, y in C and theta in [0, 1], theta * x + (1 - theta) * y in C.
- —Convex Function Definition: f(theta * x + (1 - theta) * y) <= theta * f(x) + (1 - theta) * f(y).
- —First-Order Convexity Condition: f(y) >= f(x) + grad(f(x))^T (y - x) for all x, y in dom(f).
- —Second-Order Convexity Condition: Hessian H(x) is Positive Semi-Definite (H(x) >= 0, all eigenvalues >= 0) for all x in dom(f).
- —Jensen's Inequality: For any convex function f and random variable X, f(E[X]) <= E[f(X)].
- —Strict Convexity: If H(x) is Positive Definite (all eigenvalues > 0), the global minimum is UNIQUE.
Critical Pitfalls & Exam Traps:- ×The intersection of any arbitrary family of convex sets is ALWAYS convex; the union of convex sets is generally NOT convex.
- ×A linear function f(x) = c^T x is both convex AND concave (Hessian is zero matrix).
Convex Sets, Functions & Lagrangian Duality
Lagrangian Duality, Dual Problem & Slater's Condition
Open Full Lesson →Weak Duality: Dual optimal value d* <= Primal optimal value p* ALWAYS holds (duality gap p* - d* >= 0). Strong duality (d* = p*) holds for convex problems under Slater's condition.
Must-Remember Principles:- —Primal Problem: min f0(x) s.t. f_i(x) <= 0 (i=1..m), h_j(x) = 0 (j=1..p).
- —Lagrangian: L(x, lambda, nu) = f0(x) + Sum_{i=1}^m lambda_i f_i(x) + Sum_{j=1}^p nu_j h_j(x).
- —Lagrange Dual Function: g(lambda, nu) = inf_x L(x, lambda, nu).
- —Concavity Theorem: g(lambda, nu) is ALWAYS concave, even if the primal problem f0 is non-convex.
- —Dual Problem: max g(lambda, nu) s.t. lambda >= 0.
- —Slater's Constraint Qualification: If primal problem is convex and there exists a strictly feasible point x_tilde (f_i(x_tilde) < 0 for all non-affine inequalities), then Strong Duality holds (d* = p*).
Critical Pitfalls & Exam Traps:- ×The dual function g(lambda, nu) provides a LOWER BOUND on the primal optimal value p* for ANY feasible lambda >= 0.
- ×Do not forget the non-negativity constraint on inequality dual multipliers: lambda >= 0.
Constrained Optimization & KKT Conditions
The Method of Lagrange Multipliers
Open Full Lesson →Lagrange Multiplier Condition: At an equality constrained extremum of f(x) s.t. g(x) = 0, the gradient of the objective is parallel to the gradient of the constraint: grad(f) = lambda * grad(g).
Must-Remember Principles:- —Lagrangian Function: L(x, lambda) = f(x) - lambda * g(x).
- —Stationary System: grad_x L = 0 and grad_lambda L = 0 (recovering g(x) = 0).
- —Multiple Constraints: grad(f) = Sum_{j=1}^k lambda_j * grad(g_j).
- —Shadow Price Interpretation: df* / dc = lambda, where c is the perturbation in constraint g(x) = c.
Critical Pitfalls & Exam Traps:- ×The constraint gradient grad(g) must be non-zero at the candidate point (Regularity condition / Constraint qualification).
Constrained Optimization & KKT Conditions
Karush-Kuhn-Tucker (KKT) Conditions & Complementary Slackness
Open Full Lesson →KKT Conditions: For min f0(x) s.t. f_i(x) <= 0: 1. Stationarity: grad(f0) + Sum lambda_i grad(f_i) = 0; 2. Primal: f_i(x) <= 0; 3. Dual: lambda_i >= 0; 4. Complementary Slackness: lambda_i * f_i(x) = 0.
Must-Remember Principles:- —Complementary Slackness: lambda_i * f_i(x*) = 0 for all i.
- — Active Constraint: f_i(x*) = 0 => lambda_i >= 0 (constraint acts as an equality boundary).
- — Inactive Constraint: f_i(x*) < 0 => lambda_i = 0 (constraint has no effect on optimal location).
- —Convexity & Sufficiency: If f0 and all f_i are convex, KKT conditions are BOTH necessary and sufficient for global optimality.
- —SVM Connection: In Support Vector Machines, data points with lambda_i > 0 are precisely the SUPPORT VECTORS lying on the margin boundaries.
Critical Pitfalls & Exam Traps:- ×Never set lambda_i < 0 for minimization problems with f_i(x) <= 0 constraints (violates Dual Feasibility).
- ×When solving KKT systems, split into cases based on which inequality constraints are active (lambda_i > 0, f_i = 0) versus inactive (lambda_i = 0, f_i < 0).
Numerical Optimization & Gradient Dynamics
Gradient Descent, Learning Rates & Convergence
Open Full Lesson →Gradient Descent Step Size Bound: For an L-smooth convex function (||grad(f(x)) - grad(f(y))|| <= L ||x - y||), Gradient Descent converges iff step size alpha < 2 / L, with optimal convergence rate at alpha = 1 / L.
Must-Remember Principles:- —Gradient Descent Update: x_{k+1} = x_k - alpha * grad(f(x_k)).
- —Lipschitz Smoothness L: Equivalent to ||H(x)||_2 <= L (maximum eigenvalue lambda_max(H) <= L).
- —Descent Lemma: f(x_{k+1}) <= f(x_k) - alpha * (1 - L*alpha / 2) * ||grad(f(x_k))||^2.
- —Convergence Rates: O(1/k) for general convex functions; Linear convergence O(c^k) for strongly convex functions.
- —Condition Number kappa: kappa = lambda_max(H) / lambda_min(H). If kappa >> 1, gradient descent oscillates across ravines.
Critical Pitfalls & Exam Traps:- ×If learning rate alpha >= 2 / L, gradient descent will OSCILLATE AND DIVERGE along the axis of maximum curvature.
- ×Linear convergence in optimization literature means the error satisfies ||x_{k+1} - x*|| <= c ||x_k - x*|| with c < 1 (which corresponds to exponential decay in engineering terms).
Numerical Optimization & Gradient Dynamics
Second-Order Optimization & Newton's Method
Open Full Lesson →Newton's Method: x_{k+1} = x_k - [H(x_k)]^{-1} * grad(f(x_k)). Exactly reaches the minimum of ANY positive definite quadratic function in PRECISELY ONE STEP.
Must-Remember Principles:- —Newton Step: Delta x_nt = - [H(x)]^{-1} * grad(f(x)).
- —Quadratic Convergence: Once near the minimum, error satisfies ||x_{k+1} - x*|| <= M ||x_k - x*||^2 (number of accurate digits doubles every step).
- —Affine Invariance: Newton's step is completely invariant to linear coordinate transformations (unlike gradient descent).
- —Computational Cost: Inverting Hessian H (d x d) costs O(d^3) per iteration, limiting pure Newton's method in deep learning.
- —Non-Convex Failure: If Hessian H is not positive definite, Newton's step can jump toward local maxima or saddle points.
Critical Pitfalls & Exam Traps:- ×Newton's method finds roots of grad(f) = 0. If H has negative eigenvalues, Newton's method will happily step TOWARD A LOCAL MAXIMUM.