โœ… Checkpoint: first-order derivatives

By Better Wise

Quiz

  1. For f(x, y) = x^2 y + 3y^2, which vector is โˆ‡f(1, 2)?
    • (4, 13)
    • (2, 6)
    • (13, 4)
    • (4, 7)
  2. What is the shape of the Jacobian of F: R^n to R^m, and what does row i contain?
    • m x n, and row i is the transposed gradient of output f_i
    • m x m, and row i is the gradient of output f_i
    • m x n, and row i is the gradient of input x_i
    • n x m, and row i is the gradient of input i
  3. For f = g โˆ˜ h with h: R^n to R^m and g: R^m to R^k, which expression is the Jacobian J_f(x)?
    • J_g(h(x)) J_h(x)
    • J_h(h(x)) J_g(x)
    • J_g(x) J_h(x)
    • J_h(x) J_g(h(x))
  4. Which statements about the gradient โˆ‡f(x) of a scalar function f: R^n to R are correct? Select all that apply.
    • Its norm equals the slope of f along the gradient direction.
    • It has the same shape as x, with one entry per input coordinate.
    • It points in the direction of steepest increase of f at x.
    • A zero gradient at a point proves the point is a local minimum.
    • It is orthogonal to the level set of f through x.
  5. Which statements about the chain rule for composed functions are correct? Select all that apply.
    • The shape test (k x m)(m x n) = k x n catches reversed products.
    • The outer Jacobian J_g is evaluated at the input x.
    • For a scalar-valued composition, โˆ‡f(x) = J_h(x)^T โˆ‡g(h(x)).
    • An elementwise map t = ฯ†(a) has a diagonal Jacobian diag(ฯ†'(a_i)).
    • The affine map a = Wx + b has Jacobian W, independent of x.
  6. The central-difference estimate of one gradient component is (f(x + h e_i) - f(x - h e_i)) / (2h), and its truncation error is of order ____.
  7. For F: R^n to R^m, the Jacobian J_F has shape ____ (write it as m x n with your numbers).
  8. For f = g โˆ˜ h with g scalar-valued, the gradient is โˆ‡f(x) = J_h(x)^T ____.
  9. Derive by hand the gradient of f(x, y) = (x - 2)^2 + 3(y + 1)^2 + xy, then verify each component with a central difference in Python at the point (1, -1). Describe your derivation, your numeric check, and the relative error you observed.
  10. Take h(x1, x2) = (x1 x2, x1 + x2^2) and g(y1, y2) = y1 y2, so f = g โˆ˜ h. Build the Jacobian product by hand, then confirm the resulting gradient numerically. Explain each step of the chain and how you checked it.

Sign in to submit answers.