Rosenbrock function

Function used as a performance test problem for optimization algorithms
title: "Rosenbrock function" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["test-functions-for-optimization", "polynomials", "functions-and-mappings"] description: "Function used as a performance test problem for optimization algorithms" topic_path: "general/test-functions-for-optimization" source: "https://en.wikipedia.org/wiki/Rosenbrock_function" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0
::summary Function used as a performance test problem for optimization algorithms ::
::figure[src="https://upload.wikimedia.org/wikipedia/commons/6/68/Rosenbrock-contour.svg" caption="Plot of the Rosenbrock function of two variables. Here a=1, b=100, and the minimum value of zero is at (1,1)."] ::
In mathematical optimization, the Rosenbrock function is a non-convex function, introduced by Howard H. Rosenbrock in 1960, which is used as a performance test problem for optimization algorithms. It is also known as Rosenbrock's valley or Rosenbrock's banana function.
The global minimum is inside a long, narrow, parabolic-shaped flat valley. To find the valley is trivial. To converge to the global minimum, however, is difficult.
The function is defined by
:f(x,y) = (a-x)^2 + b(y-x^2)^2
It has a global minimum at (x,y)=(a,a^2), where f(x,y)=0. Usually, these parameters are set such that a = 1 and b = 100. Only in the trivial case where a=0 the function is symmetric and the minimum is at the origin.
Multidimensional generalizations
Two variants are commonly encountered.
::figure[src="https://upload.wikimedia.org/wikipedia/commons/1/11/Rosenbrock3.gif" caption="edition=1st}}"] ::
One is the sum of N/2 uncoupled 2D Rosenbrock problems, and is defined only for even Ns: : f(\mathbf{x}) = f(x_1, x_2, \dots, x_N) = \sum_{i=1}^{N/2} \left[100(x_{2i-1}^2 - x_{2i})^2
- (x_{2i-1} - 1)^2 \right].
This variant has predictably simple solutions.
A second, more involved variant is : f(\mathbf{x}) = \sum_{i=1}^{N-1} [100 (x_{i+1} - x_i^2 )^2 + (1-x_i)^2] \quad \mbox{where} \quad \mathbf{x} = (x_1, \ldots, x_N) \in \mathbb{R}^N.
has exactly one minimum for N=3 (at (1, 1, 1)) and exactly two minima for 4 \le N \le 7 — the global minimum at (1, 1, ..., 1) and a local minimum near \hat{\mathbf{x}} = (-1, 1, \dots, 1). This result is obtained by setting the gradient of the function equal to zero, noticing that the resulting equation is a rational function of x. For small N the polynomials can be determined exactly and Sturm's theorem can be used to determine the number of real roots, while the roots can be bounded in the region of |x_i| . For larger N this method breaks down due to the size of the coefficients involved.
Stationary points
Many of the stationary points of the function exhibit a regular pattern when plotted. This structure can be exploited to locate them. ::figure[src="https://upload.wikimedia.org/wikipedia/commons/3/36/Rosenbrock_roots_exhibiting_hump_structures.pdf" caption="Rosenbrock roots exhibiting hump structures"] ::
Optimization examples
::figure[src="https://upload.wikimedia.org/wikipedia/commons/7/79/Rosenbrock.png"] ::
::figure[src="https://upload.wikimedia.org/wikipedia/commons/e/e4/Nelder-Mead_Rosenbrock.gif" caption="Nelder-Mead method applied to the Rosenbrock function" alt="Rosenbrock function Nelder-Mead"] ::
The Rosenbrock function can be efficiently optimized by adapting appropriate coordinate system without using any gradient information and without building local approximation models (in contrast to many derivate-free optimizers). The following figure illustrates an example of 2-dimensional Rosenbrock function optimization by adaptive coordinate descent from starting point x_0=(-3,-4). The solution with the function value 10^{-10} can be found after 325 function evaluations.
Using the Nelder–Mead method from starting point x_0=(-1,1) with a regular initial simplex a minimum is found with function value 1.36 \cdot 10^{-10} after 185 function evaluations. The figure below visualizes the evolution of the algorithm.
Use in other fields
The Rosenbrock function can be used to create "banana"-shaped distributions, which are a popular benchmark model in statistics and machine learning.
References
References
- Rosenbrock, H.H.. (1960). "An automatic method for finding the greatest or least value of a function". The Computer Journal.
- Simionescu, P.A.. (2014). "Computer Aided Graphing and Simulation Tools for AutoCAD users". CRC Press.
- Dixon, L. C. W.. (1994). "Effect of Rounding Errors on the Variable Metric Method". Journal of Optimization Theory and Applications.
- "Generalized Rosenbrock's function".
- Kok, Schalk. (2009). "Locating and Characterizing the Stationary Points of the Extended Rosenbrock Function". Evolutionary Computation.
- Pagani, Filippo. (2022). "An n-dimensional Rosenbrock distribution for Markov chain Monte Carlo testing". Scandinavian Journal of Statistics.
::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::