On this page
Sometimes you can calculate a function's value but cannot easily differentiate it, and you still want its lowest point. For one variable, golden section search is the classic answer, and it rests on one piece of algebra you can check by hand.
What is golden section search?
Golden section search is a technique for finding the minimum or maximum of a function inside a given interval (Wikipedia: Golden-section search). It needs the function to be unimodal on that interval: it falls to a single lowest point and then rises, with no second dip. The method was described by J. Kiefer in the 1953 paper Sequential minimax search for a maximum, in the Proceedings of the American Mathematical Society.
The idea is a bracket. You know the minimum lies somewhere in [a, b]. Pick two interior points x1 < x2 and compare their values:
If f(x1) < f(x2), the minimum cannot lie to the right of x2, so the new bracket is [a, x2].
Otherwise it cannot lie to the left of x1, so the new bracket is [x1, b].
Unimodality makes this safe: if the minimum were right of x2, f would still be falling between x1 and x2, so f(x1) would be the larger value.
Why does the golden ratio make point reuse possible?
Place each test point a fraction r of the width from the far end: x1 = b − r(b − a) and x2 = a + r(b − a). Suppose you keep [a, x2], which has width r(b − a). The old x1 is still inside it, at a distance (1 − r)(b − a) from a. To reuse it as the new right-hand test point, it must sit at r times the new width from a, which is r·r(b − a).
So 1 − r = r², or r² + r − 1 = 0. The positive root is r = (√5 − 1)/2 ≈ 0.618, the reciprocal of the golden ratio φ ≈ 1.618. The Wikipedia article notes that the bracket shrinks by a factor of φ − 1 each iteration, and that this choice of ratios is the only one that keeps the proportions the same from step to step (Wikipedia: Golden-section search).
The first step needs two evaluations; every later step needs only one. With equal thirds, by contrast, keeping [0, 2/3] of [0, 1] puts the next test points at 2/9 and 4/9, so the old point at 1/3 is wasted.
Worked example: minimise (x − 2)² + 1 on [0, 5]
The true minimum is f(2) = 1, so you can check each step. Take r = 0.618034.
Start with [0, 5]. Test x1 = 1.9098 and x2 = 3.0902: f(x1) = 1.0081 and f(x2) = 2.1885. The left value is lower, so keep [0, 3.0902].
Reuse 1.9098, now as x2. New x1 = 1.1803, with f = 1.6718, which is higher, so keep [1.1803, 3.0902].
Reuse 1.9098 as x1. New x2 = 2.3607, with f = 1.1301. Keep [1.1803, 2.3607].
Reuse 1.9098 as x2. New x1 = 1.6312, with f = 1.1360. Keep [1.6312, 2.3607].
Reuse 1.9098 as x1. New x2 = 2.0820, with f = 1.0067. This is now the lower value, so keep [1.9098, 2.3607].
After six evaluations, the bracket is 0.4508 wide (5 × 0.618⁵) and still contains x = 2. Continue until the width is below the accuracy you need, then report the best point tested.
Golden section search vs ternary search: which is faster?
Ternary search tests the points one third and two thirds of the way across the bracket and keeps two thirds of it (Wikipedia: Ternary search). Both points are new at every step, so each evaluation shrinks the bracket by √(2/3) ≈ 0.816 on average, against 0.618 for golden section. On the example above, ternary search's first six evaluations leave a bracket of 5 × (2/3)³ ≈ 1.48, more than three times as wide.
To shrink a bracket by a factor of 1,000, golden section search needs 16 evaluations (2 to start, then 14 more). Ternary search needs 18 steps of two evaluations each: 36 in all. The ternary search article itself calls golden section search similar, and useful when evaluating f takes most of the time.
A quick way to choose:
Slow evaluations (a simulation, a measurement): golden section search.
Cheap evaluations and simplest code, as in a programming contest: ternary search is fine.
You can differentiate f: solving f′(x) = 0 is usually more direct.
More than one dip on the interval: neither method is reliable. Split the interval first.
How do you practise optimisation methods like this?
Write the loop yourself; printing the bracket at each step shows the 0.618 shrink. Then derive 1 − r = r² without notes.
If the ideas underneath feel shaky, the Fermi Concept Library has every concept in mathematics and computing, each with its own lesson and its place in the map. For practice, the Fermi Problem Library has worked problems with a step-by-step solver that explains the reasoning rather than printing an answer.



