Skip to content
Free public beta until December 4, 2026: every course is open, no card needed. After that, the first chapter of each course stays free and full access is a one-time $39 ($19 for up to 100 founding members chosen for helpful feedback). Your progress is kept. How the beta works

Recipe

Run golden-section search on a bracket

Use when: you have a unimodal f and a valid bracket [a,b], and want its minimum to a stated tolerance without ever differentiating f

Goal: a bracket narrower than the required tolerance, guaranteed to trap the minimum

Taught in Golden-section search

  1. 1

    Compute \rho=(3-\sqrt5)/2\approx0.381966, then x_1=a+\rho(b-a) and x_2=b-\rho(b-a).

    Example

    For [a,b]=[0,5]: \rho(5)\approx1.9098, so x_1\approx1.9098 and x_2\approx3.0902.

    Why: this fraction is the unique value making the surviving interior point automatically correct for the next, smaller bracket — the identity Step 3 relies on.

  2. 2

    Compute f(x_1) and f(x_2).

    Example

    For f(x)=(x-2)^2+1: f(1.9098)\approx1.0081 and f(3.0902)\approx2.1885. Since f(x_1)<f(x_2), keep [0,3.0902] and carry x_1 forward.

    • f(x_1)<f(x_2) — the minimum lies in [a,x_2]; discard [x_2,b]; keep x_1 as the new bracket's interior point.
    • f(x_1)>f(x_2) — the minimum lies in [x_1,b]; discard [a,x_1]; keep x_2 as the new bracket's interior point.
    • f(x_1)=f(x_2) — the minimum lies in [x_1,x_2]; discard both outer pieces.

    Why: whichever side loses the comparison cannot contain the minimum, by the same unimodality argument Section 5 proved for any valid bracket.

  3. 3

    In the new bracket, the carried-over point already sits at the correct golden-ratio fraction — confirm which side it's on (x_1 or x_2 of the new, smaller bracket) and compute only the other one fresh.

    ⚡ Shortcut

    Skip recomputing \rho(b-a) from scratch: the new bracket's missing point is just a_{\text{new}}+\rho(b_{\text{new}}-a_{\text{new}}) or b_{\text{new}}-\rho(b_{\text{new}}-a_{\text{new}}), using whichever formula matches the side that needs a fresh evaluation.

    Why: this is the entire efficiency payoff of using \rho specifically — any other split fraction would force recomputing BOTH interior points every iteration instead of one.

  4. 4

    Repeat Steps 2-3 on the new, narrower bracket until b-a is smaller than the required tolerance \varepsilon; report the final bracket's midpoint as the estimated minimizer.

    Why: the bracket width shrinks by the fixed factor 1-\rho\approx0.618 every iteration, so a target tolerance translates directly into a predictable stopping point instead of an open-ended search.

Common mistakes

  • Recomputing both interior points from scratch every iteration instead of reusing the surviving one — throws away the whole efficiency the golden ratio buys.
  • Discarding the wrong side: the surviving bracket is the one containing the SMALLER value, not the larger one.
  • Confusing \rho\approx0.382 with 1-\rho\approx0.618 when computing x_1 versus x_2 — swapping the two collapses the bracket toward the wrong end.
  • Stopping after a fixed number of iterations instead of checking the actual bracket width against the tolerance.