Proofs: Golden-section search
These are the human proofs of Golden-section search, at full length.
Golden-section search keeps the minimum in its interval and reuses one point per step full
This proof shows: correctness.
We use the pseudocode of the page, with . The number is the positive root of , so and . Let be strictly unimodal for a minimum on with mode : strictly decreasing on the points and strictly increasing on the points . The comparison lemma for a minimum reads, for : implies ; implies ; implies . Its proof is the one for a maximum with replaced by .
Claim. GOLDEN-MIN evaluates exactly times. Before line L8, and, in exact arithmetic, . The returned point is within of .
Invariant. Before each test of line L5, with :
- ;
- and , so ;
- and .
Initialization. Line L2 sets and . Since , the order holds. Line L3 sets the values. Item 1 holds by the assumption on .
Maintenance, case (line L6). By the lemma, , so , the new interval. Its left end is and its length is . The new is the old , the correct inner point, and its value is the old . The new is computed as , and is evaluated there once.
Maintenance, case (line L7). If , the lemma gives ; if , it gives . In both cases , the new interval. Its left end is and its length is . From we get , so , which is the old . So the old is the correct new , with value . The new is computed as , and is evaluated there once.
In both cases the invariant holds again with .
Termination and result. The loop runs times, with one evaluation each, after the two of line L3: evaluations. Before line L8, and . Line L8 applies the same case analysis once more without a new evaluation: or , both of length . The midpoint of an interval of length that holds is within half that length of .
Remark on floating point. Items 2 and 3 hold only up to rounding, because the reused point keeps its old computed value. The proof of item 1 uses only that and are the values at two points of and that the new interval is or . So the minimum stays in the interval in floating point as long as the computed points keep the order , which holds until the interval holds only a few doubles. Rounding affects the length bound, not the bracket.
Why the ratio must be . Suppose a method uses inner points at the fractions and of each interval, with , and wants the kept inner point to be an inner point of the next interval. After keeping , the new length is and the old sits at from . For it to be at the fraction of the new interval we need , that is , so .