σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
σμimplied vol · KKmax(S−K,0)udβρᵢⱼfat tailsPnL · drawdownyield · TdSₜ = μSₜ dt + σSₜ dWₜC = S·N(d₁) − K·e⁻ʳᵀ·N(d₂)σₚ² = wᵀΣwd₁ = [ln(S/K) + (r + σ²⁄2)T] ⁄ σ√T∂V/∂t + ½σ²S²·∂²V/∂S² + rS·∂V/∂S − rV = 0Sharpe = (Rₚ − R_f) ⁄ σₚVaR₉₉ = μ − 2.33σρ = Cov(X,Y) ⁄ σₓσᵧE[Rₚ] = Σ wᵢ·E[Rᵢ]φ(x) = e^(−x²/2) ⁄ √2πE[Rᵢ] = R_f + βᵢ(E[Rₘ] − R_f)dXₜ = θ(μ − Xₜ)dt + σ dWₜσ²ₜ = ω + α·ε²ₜ₋₁ + β·σ²ₜ₋₁C − P = S − K·e⁻ʳᵀΔ = ∂V/∂S Γ = ∂²V/∂S²p = (e^(rΔt) − d) ⁄ (u − d)rₜ = ln(Pₜ ⁄ Pₜ₋₁)E[Xₜ₊₁ | ℱₜ] = Xₜf* = (bp − q) ⁄ bz = (x − μ) ⁄ σP(N=k) = λᵏe^(−λ) ⁄ k!Θ = −∂V/∂Tν = S·φ(d₁)·√Tmin wᵀΣw s.t. wᵀμ = μ*∫Σ∂∞λ
uantCraft AcademyRoadmapsSkills
Ctrl K
AO
+1.2k Learners
LoginJoin ↗
RoadmapsSkills
AO
+1.2k Learners
Login
  • English
  • Français
  • Español
  • العربية
  • Português
  • Deutsch
  • 日本語
  • 中文
Calculus skill›Module 4 · Optimization and sensitivities›Topic 4.1·~45 minIntermediate

The Jacobian and Hessian

Skill positionModule 4 of 4 · Topic 1 of 3
4.1 The Jacobian and Hessian
—Lab score— / 100Total XP—Streak—

Many outputs, many inputs

A function FFF can map several inputs to several outputs, for example risk factors to the values of several positions. Its Jacobian JJJ is the matrix of all first partial derivatives, with entry Jij=∂Fi∂xjJ_{ij}=\frac{\partial F_i}{\partial x_j}Jij​=∂xj​∂Fi​​. It is the best linear approximation: for a small move Δ\DeltaΔ, F(x+Δ)≈F(x)+JΔF(\mathbf{x}+\Delta)\approx F(\mathbf{x})+J\DeltaF(x+Δ)≈F(x)+JΔ.

J=(∂F1∂x∂F1∂y∂F2∂x∂F2∂y)J=\begin{pmatrix}\frac{\partial F_1}{\partial x} & \frac{\partial F_1}{\partial y}\\[2pt] \frac{\partial F_2}{\partial x} & \frac{\partial F_2}{\partial y}\end{pmatrix}J=(∂x∂F1​​∂x∂F2​​​∂y∂F1​​∂y∂F2​​​)(1)

For one output fff, the second derivatives form the Hessian HHH, with Hij=∂2f∂xi∂xjH_{ij}=\frac{\partial^2 f}{\partial x_i\partial x_j}Hij​=∂xi​∂xj​∂2f​. For smooth functions it is symmetric. It describes curvature: f(x+Δ)≈f+∇f⋅Δ+12ΔTHΔf(\mathbf{x}+\Delta)\approx f+\nabla f\cdot\Delta+\tfrac{1}{2}\Delta^{T}H\Deltaf(x+Δ)≈f+∇f⋅Δ+21​ΔTHΔ. Where ∇f=0\nabla f=0∇f=0, a positive definite HHH marks a local minimum, a negative definite HHH a local maximum, and a mixed one a saddle point. Newton's method for optimisation uses HHH to take better steps than plain gradient descent.

A Jacobian and a Hessian by handFor F(x,y)=(x2y, x+y2)F(x,y)=(x^2y,\ x+y^2)F(x,y)=(x2y, x+y2): J=(2xyx212y)J=\begin{pmatrix}2xy & x^2\\ 1 & 2y\end{pmatrix}J=(2xy1​x22y​), so at (1,2)(1,2)(1,2) it is (4114)\begin{pmatrix}4&1\\1&4\end{pmatrix}(41​14​) with determinant 15: small areas are scaled by about 15. For f(x,y)=x2y+y2f(x,y)=x^2y+y^2f(x,y)=x2y+y2: fxx=2yf_{xx}=2yfxx​=2y, fxy=2xf_{xy}=2xfxy​=2x, fyy=2f_{yy}=2fyy​=2, so at (1,2)(1,2)(1,2) the Hessian is (4222)\begin{pmatrix}4&2\\2&2\end{pmatrix}(42​22​).
  • Jacobian: the matrix of first partials of a vector function; the best linear model of it.
  • Hessian: the symmetric matrix of second partials of a scalar function; its curvature.
  • Positive definite Hessian at a critical point: a local minimum.
Do not estimate a Hessian by finite differences if you can avoid itSecond differences divide tiny differences by h2h^2h2, which magnifies rounding noise. Prefer formulas or automatic differentiation, and when you must use differences, check that the result is symmetric.

Lab · what's graded

  • The Jacobian at a point20 pts
  • The Hessian at a point20 pts
  • The determinant of the Jacobian15 pts
  • Reading a Hessian15 pts
  • The linear approximation15 pts
  • What each matrix describes15 pts
0/ 6 answered
Tasks
1Matrix · vector20 ptsNot answered

Let F(x,y)=(x2y, x+y2)F(x,y)=(x^2y,\ x+y^2)F(x,y)=(x2y, x+y2). Fill in the Jacobian J(1,2)J(1,2)J(1,2).

J(1,2)=J(1,2) =J(1,2)=
2Matrix · vector20 ptsNot answered

For f(x,y)=x2y+y2f(x,y)=x^2y+y^2f(x,y)=x2y+y2, fill in the Hessian H(1,2)H(1,2)H(1,2).

H(1,2)=H(1,2) =H(1,2)=
3Numeric answer15 ptsNot answered

Compute det⁡J(1,2)\det J(1,2)detJ(1,2) for the Jacobian (4114)\begin{pmatrix}4&1\\1&4\end{pmatrix}(41​14​). It is the factor by which FFF scales small areas near (1,2)(1,2)(1,2).

det⁡J=\det J =detJ=accepted: ± 0.001
4Choice15 ptsNot answered

At a point where ∇f=0\nabla f=0∇f=0, the Hessian is (2006)\begin{pmatrix}2&0\\0&6\end{pmatrix}(20​06​). What kind of point is it?

5Numeric answer15 ptsNot answered

Here F(1,2)=(2,5)F(1,2)=(2,5)F(1,2)=(2,5) and J(1,2)=(4114)J(1,2)=\begin{pmatrix}4&1\\1&4\end{pmatrix}J(1,2)=(41​14​) for F(x,y)=(x2y, x+y2)F(x,y)=(x^2y,\ x+y^2)F(x,y)=(x2y, x+y2). Use F(x+Δ)≈F(x)+JΔF(\mathbf{x}+\Delta)\approx F(\mathbf{x})+J\DeltaF(x+Δ)≈F(x)+JΔ to estimate the first component of F(1.1, 2.0)F(1.1,\,2.0)F(1.1,2.0).

F1=F_1 =F1​=accepted: ± 0.001
6Explain in words15 ptsNot answered

In two or three sentences, say what the Jacobian and the Hessian each describe about a function.

Math modeKeyboard or LaTeX inputTask 1 of 6 · Ctrl ⏎ to check

Log in to run your code.

Every lecture is free to read. Create an account or log in to run code, run tests and submit this lab.

  • In-browser IDE with a bash terminal — nothing to install
  • Instant grading, XP and your place on the skill
Create an accountLog in
OR
Continue with GitHub