σμ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
  • 日本語
  • 中文
Optimization skill›Module 3 · Convexity and curvature›Topic 3.2·~55 minIntermediate

Newton and quasi-Newton methods

Skill positionModule 3 of 5 · Topic 2 of 2
3.2 Newton and quasi-Newton methods
—Lab score— / 100Total XP—Streak—

Using curvature

Gradient descent only knows the slope. Newton's method also uses the curvature: it replaces fff near the current point by the quadratic that has the same value, gradient and Hessian, and jumps straight to that quadratic's minimum. The step is w←w−H−1g\mathbf w\leftarrow\mathbf w-H^{-1}\mathbf gw←w−H−1g. On an exactly quadratic function this lands on the minimum in a single step, whatever the condition number. Near the minimum of any smooth function, convergence is quadratic: the error is roughly squared at each step, so the number of correct digits about doubles.

wk+1=wk−H(wk)−1∇f(wk),∥wk+1−w∗∥ ≲ C ∥wk−w∗∥2\mathbf w_{k+1}=\mathbf w_k-H(\mathbf w_k)^{-1}\nabla f(\mathbf w_k),\qquad \lVert\mathbf w_{k+1}-\mathbf w^{*}\rVert\ \lesssim\ C\,\lVert\mathbf w_k-\mathbf w^{*}\rVert^{2}wk+1​=wk​−H(wk​)−1∇f(wk​),∥wk+1​−w∗∥ ≲ C∥wk​−w∗∥2(1)
Newton on e^x − 2xMinimise f(x)=ex−2xf(x)=e^x-2xf(x)=ex−2x, whose minimum is at x∗=ln⁡2=0.693147x^{*}=\ln2=0.693147x∗=ln2=0.693147. Here f′=ex−2f'=e^x-2f′=ex−2 and f′′=exf''=e^xf′′=ex. From x0=0x_0=0x0​=0: x1=0−(−1)/1=1x_1=0-(-1)/1=1x1​=0−(−1)/1=1, then x2=1−0.7183/2.7183=0.7358x_2=1-0.7183/2.7183=0.7358x2​=1−0.7183/2.7183=0.7358, x3=0.6940x_3=0.6940x3​=0.6940 and x4=0.693148x_4=0.693148x4​=0.693148. The errors 0.307, 0.0426, 0.0009, 4⋅10−70.307,\ 0.0426,\ 0.0009,\ 4\cdot10^{-7}0.307, 0.0426, 0.0009, 4⋅10−7 shrink faster than any fixed factor. In two variables, for f=(x−1)2+2(y+2)2f=(x-1)^2+2(y+2)^2f=(x−1)2+2(y+2)2 at (3,0)(3,0)(3,0) we have g=(4,8)\mathbf g=(4,8)g=(4,8) and H=diag(2,4)H=\mathrm{diag}(2,4)H=diag(2,4), so the step is −H−1g=(−2,−2)-H^{-1}\mathbf g=(-2,-2)−H−1g=(−2,−2) and one step reaches the minimum (1,−2)(1,-2)(1,−2).

Newton's method has a price. With nnn parameters the Hessian has n2n^2n2 entries and solving with it costs about n3n^3n3 operations, which is fine for hundreds of parameters and impossible for millions. Far from the minimum, or where HHH is not positive definite, the Newton step can even point uphill, so practical versions damp the step with a line search. Quasi-Newton methods keep most of the speed without the cost. BFGS builds an approximation of the inverse Hessian from the observed changes s=wk+1−wk\mathbf s=\mathbf w_{k+1}-\mathbf w_ks=wk+1​−wk​ and y=gk+1−gk\mathbf y=\mathbf g_{k+1}-\mathbf g_ky=gk+1​−gk​, forcing the secant condition Bs=yB\mathbf s=\mathbf yBs=y. It needs only gradients, costs O(n2)O(n^2)O(n2) per step and converges superlinearly. L-BFGS stores just the last mmm pairs, typically 5 to 20, so memory is O(mn)O(mn)O(mn). It is the usual workhorse for smooth calibrations and maximum-likelihood fits, such as the default optimizers in SciPy.

  • Newton: w←w−H−1g\mathbf w\leftarrow\mathbf w-H^{-1}\mathbf gw←w−H−1g; one step on a quadratic, quadratic convergence near the minimum.
  • BFGS: learns an inverse-Hessian approximation from gradient differences, so no second derivatives are needed.
  • L-BFGS: keeps only the last few pairs, so it scales to many parameters.
Newton needs a safeguardPure Newton can overshoot or diverge from a poor starting point. Library implementations add a line search or a trust region, and they fall back to a gradient step when the Hessian is not positive definite. Do not hand-roll a bare Newton loop for a calibration without these.

Lab · what's graded

  • The first Newton step15 pts
  • The second Newton step15 pts
  • A Newton step in two variables15 pts
  • Steps on a quadratic15 pts
  • The secant condition15 pts
  • Methods and ideas10 pts
  • Why exact Newton is avoided for huge problems15 pts
0/ 7 answered
Tasks
1Numeric answer15 ptsNot answered

Minimise f(x)=ex−2xf(x)=e^x-2xf(x)=ex−2x by Newton's method from x0=0x_0=0x0​=0. With f′=ex−2f'=e^x-2f′=ex−2 and f′′=exf''=e^xf′′=ex, what is x1x_1x1​?

x1=x1 =x1=accepted: ± 0.01
2Numeric answer15 ptsNot answered

Continue from x1=1x_1=1x1​=1. Using e1=2.71828e^1=2.71828e1=2.71828, what is x2x_2x2​? Give it to four decimals.

x2=x2 =x2=accepted: ± 0.001
3Numeric answer15 ptsNot answered

For f=(x−1)2+2(y+2)2f=(x-1)^2+2(y+2)^2f=(x−1)2+2(y+2)2 at (3,0)(3,0)(3,0) the gradient is (4,8)(4,8)(4,8) and H=diag(2,4)H=\mathrm{diag}(2,4)H=diag(2,4). After one Newton step, what is the yyy-coordinate?

y=y =y=accepted: ± 0.01
4Choice15 ptsNot answered

How many Newton steps does it take to minimise a strictly convex quadratic function exactly?

5Choice15 ptsNot answered

With s=wk+1−wk\mathbf s=\mathbf w_{k+1}-\mathbf w_ks=wk+1​−wk​ and y=gk+1−gk\mathbf y=\mathbf g_{k+1}-\mathbf g_ky=gk+1​−gk​, which relation does a BFGS Hessian approximation BBB enforce?

6Match10 ptsNot answered

Match each method with its key idea.

Pick the partner of each item on the left.

Gradient descent
Newton
BFGS
L-BFGS
7Explain in words15 ptsNot answered

In one or two sentences, explain why exact Newton's method is not used for problems with millions of parameters.

Math modeKeyboard or LaTeX inputTask 1 of 7 · 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