Bite 4.1.4 · Derivative-free Algorithms

The Fibonacci method in optimization: the optimal search hidden in a sequence

A derivative-free sequential algorithm whose optimal search strategy is built from the Fibonacci sequence.

Image by Venus Major · Unsplash

The Fibonacci Method (or Fibonacci Search) is a direct sequential algorithm for one-dimensional numerical optimization, closely related to the Golden Section Method. Like the latter, it discards part of the interval of uncertainty at each iteration without computing derivatives and reuses one of the two test points, so that, after the first iteration, a single new evaluation per step is enough. The difference is that the proportion used to divide the interval is not constant: it changes at every iteration, following the ratios of the Fibonacci sequence.

The sequence is named after Leonardo of Pisa, known as Fibonacci, who popularized it in his Liber Abaci (1202) with the famous problem of rabbit breeding:

\[F_0 = F_1 = 1, \qquad F_k = F_{k-1} + F_{k-2} \quad (k \geqslant 2)\]

that is, $1, 1, 2, 3, 5, 8, 13, 21, 34, \dots$

More than seven centuries later, in 1953, Jack Kiefer proved that, if the number of function evaluations is fixed in advance, Fibonacci search is the optimal sequential strategy (in the minimax sense) for locating the optimum of a unimodal function (Kiefer, 1953): no other strategy guarantees a smaller final interval with the same number of evaluations. Later, Douglass J. Wilde (1964) (Wilde, 1964) included it in his systematization of sequential search methods.

The Fibonacci algorithm

The goal of the algorithm is to minimize a continuous and unimodal function $f(x)$ within an initial interval $[a, b]$, using a number $n$ of function evaluations fixed in advance.

The idea: running through the sequence backwards

As in the Golden Section, two test points symmetric with respect to the center are placed in the current interval $[a_k, b_k]$. But now the proportion is given by two consecutive Fibonacci numbers. At iteration $k$:

\[x_1 = a_k + \frac{F_{n-k-1}}{F_{n-k+1}} (b_k - a_k) \quad \text{and} \quad x_2 = a_k + \frac{F_{n-k}}{F_{n-k+1}} (b_k - a_k)\]

If, for example, the region $[x_2, b_k]$ is discarded, the new interval has length:

\[L_{k+1} = \frac{F_{n-k}}{F_{n-k+1}} L_k\]

and, thanks to the property $F_{n-k+1} = F_{n-k} + F_{n-k-1}$, the old $x_1$ falls exactly on the position of the new $x_2$, so it can be reused. By symmetry, the same happens if the left part is discarded.

Chaining the reductions, after $n - 1$ iterations the length of the interval is:

\[L = \frac{F_{n-1}}{F_n} \cdot \frac{F_{n-2}}{F_{n-1}} \cdots \frac{F_1}{F_2} \cdot L_0 = \frac{b - a}{F_n}\]

That is, with $n$ evaluations the initial interval is divided by the $n$-th Fibonacci number.

The last step

In the last iteration the ratio is $\frac{F_1}{F_2} = \frac{1}{2}$, so the two test points coincide at the center of the interval and provide no information. To overcome this, as in Dichotomous Search, the new point is shifted a small distance $\delta > 0$ from the reused point. Therefore, the actual final length is:

\[L_n = \frac{b - a}{F_n} + \delta\]

Steps of the algorithm

  1. Choice of $n$: Given a tolerance $\varepsilon > 0$, choose the smallest $n$ such that: \(F_n \geqslant \frac{b - a}{\varepsilon}\) (assuming $\delta$ is negligible compared to $\varepsilon$).

  2. Initialization: Compute the two initial points: \(x_1 = a + \frac{F_{n-2}}{F_n}(b - a) \quad \text{and} \quad x_2 = a + \frac{F_{n-1}}{F_n}(b - a)\) and their values $f(x_1)$ and $f(x_2)$.

  3. Interval reduction rule (for $k = 1, \dots, n-1$):

    • If $f(x_1) < f(x_2)$, the minimum is not in $[x_2, b_k]$. The new interval is $[a_k, x_2]$, the old $x_1$ becomes the new $x_2$ and only a new $x_1$ is computed.
    • If $f(x_1) \geqslant f(x_2)$, the minimum is not in $[a_k, x_1]$. The new interval is $[x_1, b_k]$, the old $x_2$ becomes the new $x_1$ and only a new $x_2$ is computed.
    • In the second-to-last iteration, the new point is placed at a distance $\delta$ from the reused point.

Unlike the Golden Section, the stopping criterion is not the length of the interval, but having used up the $n$ planned evaluations.

Pseudocode

The structured algorithmic formulation is presented below. Instead of storing the whole sequence, the algorithm only keeps two consecutive Fibonacci numbers, $F0$ and $F1$ (with $F2$ as an auxiliary variable), which are run forwards to compute $F_n$ and then backwards at each iteration:

\begin{algorithm}
\caption{Fibonacci Search}
\begin{algorithmic}
\PROCEDURE{FibonacciSearch}{$$f, a, b, n, delta$$}
    \STATE $$F0 = 1$$
    \STATE $$F1 = 1$$
    \FOR{$$i = 2$$ \TO $$n$$}
        \STATE $$F2 = F1 + F0$$
        \STATE $$F0 = F1$$
        \STATE $$F1 = F2$$
    \ENDFOR
    \STATE $$ak = a$$
    \STATE $$bk = b$$
    \STATE $$x1 = ak + ((F1 - F0) / F1) * (bk - ak)$$
    \STATE $$x2 = ak + (F0 / F1) * (bk - ak)$$
    \STATE $$f1 = f(x1)$$
    \STATE $$f2 = f(x2)$$
    \FOR{$$k = 1$$ \TO $$n - 2$$}
        \STATE $$F2 = F1 - F0$$
        \STATE $$F1 = F0$$
        \STATE $$F0 = F2$$
        \IF{$$f1 < f2$$}
            \STATE $$bk = x2$$
            \STATE $$x2 = x1$$
            \STATE $$f2 = f1$$
            \IF{$$k < n - 2$$}
                \STATE $$x1 = ak + ((F1 - F0) / F1) * (bk - ak)$$
            \ELSE
                \STATE $$x1 = x2 - delta$$
            \ENDIF
            \STATE $$f1 = f(x1)$$
        \ELSE
            \STATE $$ak = x1$$
            \STATE $$x1 = x2$$
            \STATE $$f1 = f2$$
            \IF{$$k < n - 2$$}
                \STATE $$x2 = ak + (F0 / F1) * (bk - ak)$$
            \ELSE
                \STATE $$x2 = x1 + delta$$
            \ENDIF
            \STATE $$f2 = f(x2)$$
        \ENDIF
    \ENDFOR
    \IF{$$f1 < f2$$}
        \STATE $$bk = x2$$
    \ELSE
        \STATE $$ak = x1$$
    \ENDIF
    \STATE $$xopt = (ak + bk) / 2$$
    \RETURN $$xopt, f(xopt), [ak, bk]$$
\ENDPROCEDURE
\end{algorithmic}
\end{algorithm}

Numerical example

To study the behavior of the algorithm, let us consider the nonlinear function:

\[f(x) = x^2 - 3.2x + 3\]

on the interval $[a, b] = [0, 3]$. In order to compare with the Golden Section, we fix $n = 6$ evaluations and $\delta = 0.01$.

Analytically, the exact minimum is located at $x^* = 1.6$ with $f(1.6) = 0.44$.

The required Fibonacci numbers are $F_0, \dots, F_6 = 1, 1, 2, 3, 5, 8, 13$. Since the final interval will have length $\frac{3}{13} + \delta$, all test points fall on multiples of $\frac{3}{13} \approx 0.2308$.

Iteration 1:

  • Initial interval: $[a_0, b_0] = [0, 3]$ (Length $L_0 = 3.0$).
  • Test points (both are evaluated):
    • $x_1 = 0 + \frac{5}{13} \cdot 3 = 1.1538 \implies f(1.1538) = 0.6391$
    • $x_2 = 0 + \frac{8}{13} \cdot 3 = 1.8462 \implies f(1.8462) = 0.5006$
  • Decision: Since $f(x_1) > f(x_2)$, we discard the region $[0, 1.1538]$.
  • New interval: $[a_1, b_1] = [1.1538, 3.0]$ (Length $L_1 = 1.8462$).

Iteration 2:

  • Current interval: $[a_1, b_1] = [1.1538, 3.0]$.
  • Test points:
    • $x_1 = 1.8462$ (reused, it was the previous $x_2$) $\implies f(1.8462) = 0.5006$
    • $x_2 = 1.1538 + \frac{5}{8} \cdot 1.8462 = 2.3077 \implies f(2.3077) = 0.9408$ (the only new evaluation)
  • Decision: Since $f(x_1) < f(x_2)$, we discard the region $[2.3077, 3.0]$.
  • New interval: $[a_2, b_2] = [1.1538, 2.3077]$ (Length $L_2 = 1.1538$).

Proceeding in the same way, the following iterations are obtained, where the function value computed at each iteration is shown in bold (the other one is reused from the previous iteration):

Iter. $[a_k, b_k]$ Ratio $x_1$ $f(x_1)$ $x_2$ $f(x_2)$ New interval $L_{k+1}$
1 $[0, 3]$ $8/13$ $1.1538$ $\mathbf{0.6391}$ $1.8462$ $\mathbf{0.5006}$ $[1.1538, 3]$ $1.8462$
2 $[1.1538, 3]$ $5/8$ $1.8462$ $0.5006$ $2.3077$ $\mathbf{0.9408}$ $[1.1538, 2.3077]$ $1.1538$
3 $[1.1538, 2.3077]$ $3/5$ $1.6154$ $\mathbf{0.4402}$ $1.8462$ $0.5006$ $[1.1538, 1.8462]$ $0.6923$
4 $[1.1538, 1.8462]$ $2/3$ $1.3846$ $\mathbf{0.4864}$ $1.6154$ $0.4402$ $[1.3846, 1.8462]$ $0.4615$
5 $[1.3846, 1.8462]$ $1/2$ $1.6154$ $0.4402$ $1.6254$ $\mathbf{0.4406}$ $[1.3846, 1.6254]$ $0.2408$

In iteration 5 the ratio is $\frac{1}{2}$: the new point $x_2$ would coincide with the reused point $x_1 = 1.6154$, so it is placed at a distance $\delta$, at $x_2 = 1.6154 + 0.01 = 1.6254$.

Result: With 6 function evaluations (excluding the final evaluation of $f(x_{opt})$ in the pseudocode), the initial interval of length $3$ has been reduced to $\frac{3}{13} + 0.01 = 0.2408$, guaranteeing that the optimum $x^* = 1.6$ lies within $[1.3846, 1.6254]$. With the same number of evaluations, the Golden Section obtained an interval of length $0.2705$.

These iterations are shown graphically in the following figure:

Technical analysis: Fibonacci vs. Golden Section

The ratios used by the method move away from $\frac{1}{2}$ as the Fibonacci numbers grow, and they converge precisely to the inverse of the golden ratio:

\[\lim_{k \to \infty} \frac{F_{k-1}}{F_k} = \frac{\sqrt{5} - 1}{2} = \tau \approx 0.618\]

In the previous table we can see how the ratios $\frac{8}{13} \approx 0.615$, $\frac{5}{8} = 0.625$, $\frac{3}{5} = 0.6$, … oscillate around $\tau$. Therefore, in the first iterations the Fibonacci Method behaves almost exactly like the Golden Section, and the difference is concentrated in the last ones, where it takes advantage of knowing how many evaluations it has left.

Comparing the length of the final interval with $N$ evaluations:

  • Golden Section: $L_N = (b - a)\, \tau^{N-1}$.
  • Fibonacci: $L_N = \dfrac{b - a}{F_N}$ (plus $\delta$).

For large $N$, the ratio between both lengths is:

\[\frac{(b - a)\, \tau^{N-1}}{(b - a) / F_N} \longrightarrow \frac{\varphi^2}{\sqrt{5}} \approx 1.17\]

That is, the final interval of the Golden Section is approximately $17\%$ larger than that of Fibonacci. In practice, this advantage rarely saves more than one evaluation: for example, to reach a tolerance $\varepsilon = 10^{-4}$ on the interval $[0, 3]$ we need $F_n \geqslant 30{,}000$, that is, $n = 23$ evaluations ($F_{23} = 46{,}368$), the same as with the Golden Section.

Advantages and Limitations

  • Advantages:
    • Optimality: For a fixed number of evaluations, it is the sequential method that guarantees the smallest possible final interval.
    • A single evaluation per iteration: Like the Golden Section, it reuses one of the two test points at each iteration.
    • No derivatives: It only requires function evaluations. However, the guarantee on the interval requires the function to be continuous and unimodal.
  • Limitations:
    • Number of evaluations fixed in advance: If more precision is desired once the search has finished, it cannot simply be continued: the ratios depend on $n$, so the search would have to start over.
    • Parameter $\delta$: The last step requires shifting one of the points by a distance $\delta$, which must be small enough not to worsen the final interval, but large enough for $f(x_1)$ and $f(x_2)$ to be numerically distinguishable.
    • Sequential nature: Each evaluation depends on the result of the previous one, so it cannot be parallelized.

Comparison of one-dimensional search methods

The following table summarizes the main features of the principal derivative-free one-dimensional search methods: Uniform Search, Dichotomous Search, the Golden Section and the Fibonacci Method. The results of the example correspond to the function $f(x) = x^2 - 3.2x + 3$ on the interval $[0, 3]$:

  Uniform Search Dichotomous Search Golden Section Fibonacci
Type Simultaneous Sequential Sequential Sequential
New evaluations per iteration All at once $2$ $1$ ($2$ in the first) $1$ ($2$ in the first)
Final length with $N$ evaluations $\frac{2(b-a)}{N-1}$ $\approx \frac{b-a}{2^{N/2}}$ $(b-a)\,\tau^{N-1}$ $\frac{b-a}{F_N}$
Final interval in the example $1$ ($7$ evaluations) $0.55$ ($6$ evaluations) $0.2705$ ($6$ evaluations) $0.2408$ ($6$ evaluations)
Evaluations for $\varepsilon = 10^{-4}$ $60{,}001$ $32$ $23$ $23$
Parameters $n$ $\delta$ None $n$ and $\delta$
Must $N$ be fixed in advance? Yes No No Yes
Parallelizable? Yes Partially ($2$ at a time) No No

The Fibonacci Method closes the tour of derivative-free sequential search methods with an optimality result: if the budget of evaluations is fixed, there is no better strategy. That the optimal solution is written in a sequence born from a problem about rabbits more than eight hundred years ago, and that in the limit it turns into the golden ratio, is yet another example of the surprising connections hidden in mathematics.

References

  1. Article · 1953
    Sequential Minimax Search for a Maximum
    J. Kiefer
    Proceedings of the American Mathematical Society
    DOI
  2. Book · 1964
    Optimum Seeking Methods
    D.J. Wilde
    Prentice-Hall

Keep following the series

4.1 · Derivative-free Algorithms
4.1.1Uniform Search Algorithm 4.1.2Dichotomous Search Algorithm 4.1.3Golden Section Method 4.1.4Fibonacci Method
← Previous · 4.1.3Golden Section Method Chapter 4 Next · 4.2.1 →Bisection Method

How to cite

Cite this post

Martín-Campo, F. Javier (2026). The Fibonacci method in optimization: the optimal search hidden in a sequence. https://www.fjmartincampo.com/blog/2026/fibonacci/

As a BibTeX entry:

@misc{martín-campo2026the-fibonacci-method-in-optimization-the-optimal-search-hidden-in-a-sequence,
  title   = {The Fibonacci method in optimization: the optimal search hidden in a sequence},
  author  = {Martín-Campo, F. Javier},
  year    = {2026},
  month   = {nov},
  url     = {https://www.fjmartincampo.com/blog/2026/fibonacci/}
}

This post is published under a CC BY-NC-SA 4.0 license.