ArticleslgStudy

computer science

Golden-section search

Golden-section search is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Golden-section search rather than just read about it. In short: The golden-section search is a technique for finding an extremum (minimum or maximum) of a function inside a specified interval. For a strictly unimodal function with an extremum inside the interval, it will find that extremum, while for an interval containing multiple extrema (possibly including the interval boundaries), it will converge to one of them.

Golden-section search — main illustration
Golden-section search — illustration

Key takeaways

  • Golden-section search belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Golden-section search to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Golden-section search from memory before moving on to harder problems.

Reference excerpt

The golden-section search is a technique for finding an extremum (minimum or maximum) of a function inside a specified interval. For a strictly unimodal function with an extremum inside the interval, it will find that extremum, while for an interval containing multiple extrema (possibly including the interval boundaries), it will converge to one of them. If the only extremum on the interval is on a boundary of the interval, it will converge to that boundary point. The method operates by successively narrowing the range of values on the specified interval, which makes it relatively slow, but very robust. The technique derives its name from the fact that the algorithm maintains the function values for four points whose three interval widths are in the ratio φ:1:φ, where φ is the golden ratio. These ratios are maintained for each iteration and are maximally efficient. Excepting boundary points, when searching for a minimum, the central point is always less than or equal to the outer points, assuring that a minimum is contained between the outer points. The converse is true when searching for a maximum. The algorithm is the limit of Fibonacci search (also described below) for many function evaluations. Fibonacci search and golden-section search were discovered by Kiefer (1953) (see also Avriel and Wilde (1966)).

Basic idea The discussion here is posed in terms of searching for a minimum (searching for a maximum is similar) of a unimodal function. Unlike finding a zero, where two function evaluations with opposite sign are sufficient to bracket a root, when searching for a minimum, three values are necessary. The golden-section search is an efficient way to progressively reduce the interval locating the minimum. The key is to observe that regardless of how many points have been evaluated, the minimum lies within the interval defined by the two points adjacent to the point with the least value so far evaluated. The diagram above illustrates a single step in the technique for finding a minimum. The functional values of f(x) are on the vertical axis, and the horizontal axis is the x parameter. The value of f(x) has already been evaluated at the three points: x1, x2, and x3. Since f2 is smaller than either f1 or f3, it is clear that a minimum lies inside the interval from x1 to x3. The next step in the minimization process is to "probe" the function by evaluating it at a new value of x, namely x4. It is most efficient to choose x4 somewhere inside the largest interval, i.e. between x2 and x3. From the diagram, it is clear that if the function yields f4a>f(x2), then a minimum lies between x1 and x4, and the new triplet of points will be x1, x2, and x4. However, if the function yields the value f4b<f(x2), then a minimum lies between x2 and x3, and the new triplet of points will be x2, x4, and x3. Thus, in either case, we can construct a new narrower search interval that is guaranteed to contain the function's minimum.

Probe point selection From the diagram above, it is seen that the new search interval will be either between x1 and x4 with a length of a + c, or between x2 and x3 with a length of b. The golden-section search requires that these intervals be equal. If they are not, a run of "bad luck" could lead to the wider interval being used many times, thus slowing down the rate of convergence. To ensure that b = a + c, the algorithm should choose x4=x1+(x3−x2). However, there still remains the question of where x2 should be placed in relation to x1 and x3. The golden-section search chooses the spacing between these points in such a way that these points have the same proportion of spacing as the subsequent triple x1,x2,x4 or x2,x4,x3. By maintaining the same proportion of spacing throughout the algorithm, we avoid a situation in which x2 is very close to x1 or x3 and guarantee that the interval width shrinks by the same constant proportion in each step. Mathematically, to ensure that the spacing after evaluating f(x4) is proportional to the spacing prior to that evaluation, if f(x4) is f4a and our new triplet of points is x1, x2, and x4, then we want

ca=ab. However, if f(x4) is f4b and our new triplet of points is x2, x4, and x3, then we want

cb−c=ab. Eliminating c from these two simultaneous equations yields

(ba)2−ba=1, or

ba=φ, where φ is the golden ratio:

φ=1+52=1.618033988… The appearance of the golden ratio in the proportional spacing of the evaluation points is how this search algorithm gets its name.

Termination condition Any number of termination conditions may be applied, depending upon the application. The interval ΔX = X4 − X1 is a measure of the absolute error in the estimation of the minimum X and may be used to terminate the algorithm. The value of ΔX is reduced by a factor of r = φ − 1 for each iteration, so the number of iterations to reach an absolute error of ΔX is about ln(ΔX/ΔX0) / ln(r), where ΔX0 is the initial value of ΔX. Because smooth functions are flat (their first derivative is close to zero) near a minimum, attention must be paid not to expect too great an accuracy in locating the minimum. The termination condition provided in the book Numerical Recipes in C is based on testing the gaps among x1, x2, x3 and x4, terminating when within the relative accuracy bounds

|x4−x1|<τ(|x2|+|x3|), where τ is a tolerance parameter of the algorithm, and |x| is the absolute value of x. The check is based on the bracket size relative to its central value, because that relative error in x is approximately proportional to the squared absolute error in f(x) in typical cases. For that same reason, the Numerical Recipes text recommends that τ=ε, where ε is the required absolute precision of f(x).

Algorithm Note! The examples here describe an algorithm that is for finding the minimum of a function. For maximum, the comparison operators need to be reversed.

Iterative algorithm

… excerpt ends here. Continue reading the full article.

Illustrations

Golden-section search: Diagram of a golden-section search. The initial triplet of x values is {x1, x2, x3}. If f(x4) = f4a, the triplet {x1, x2, x4} is chosen for the next iteration. If f(x4) = f4b, the triplet {x2, x4, x3} is chosen.
Diagram of a golden-section search. The initial triplet of x values is {x1, x2, x3}. If f(x4) = f4a, the triplet {x1, x2, x4} is chosen for the next iteration. If f(x4) = f4b, the triplet {x2, x4, x3} is chosen.
Golden-section search: Diagram of the golden section search for a minimum. The initial interval enclosed by X1 and X4 is divided into three intervals, and f[X] is evaluated at each of the four Xi. The two intervals containing the minimum of f(Xi) are then selected, and a third interval and functional value are calculated, and the process is repeated until termination conditions are met. The three interval widths are always in the ratio c:cr:c where r = φ − 1 = 0.618... and c = 1 − r = 0.382..., φ being the golden ratio. This choice of interval ratios is the only one that allows the ratios to be maintained during an iteration.
Diagram of the golden section search for a minimum. The initial interval enclosed by X1 and X4 is divided into three intervals, and f[X] is evaluated at each of the four Xi. The two intervals containing the minimum of f(Xi) are then selected, and a third interval and functional value are calculated, and the process is repeated until termination conditions are met. The three interval widths are always in the ratio c:cr:c where r = φ − 1 = 0.618... and c = 1 − r = 0.382..., φ being the golden ratio. This choice of interval ratios is the only one that allows the ratios to be maintained during an iteration.

Worked examples

Example 1 — a first encounter with Golden-section search

Start with the simplest possible case. Write down what Golden-section search claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Golden-section search before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Golden-section search ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Golden-section search

In research
Golden-section search appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Golden-section search in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Golden-section search is common in secondary-school and first-year university syllabi. It links to neighbouring topics Golden ratio, Optimization algorithms and methods, Search algorithms, so understanding it makes those chapters shorter.
In everyday life
Look for Golden-section search outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Golden-section search” →

How to study Golden-section search in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Golden-section search means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Golden-section search out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Golden-section search in simple terms?

The golden-section search is a technique for finding an extremum (minimum or maximum) of a function inside a specified interval. For a strictly unimodal function with an extremum inside the interval, it will find that extremum, while for an interval containing multiple extrema (possibly including t…

Why does Golden-section search matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Golden-section search?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Golden-section search.

Tags

  • Golden ratio
  • Optimization algorithms and methods
  • Search algorithms

Keep exploring