Numerical Optimization
Numerical Optimization: Finding Minima Iteratively
Engineering and scientific problems constantly ask for the input that makes something as small as possible: material cost, energy, travel time or model error. When you can solve f′(x)=0 by hand, calculus finishes the job. When you cannot, because f is messy, has many variables or is only available as the output of a simulation, you use an iterative method that improves a guess step by step. Maximizing f is the same task as minimizing −f, so this lesson works with minima throughout.
What the methods are looking for
A point x∗ is a local minimum of f if f(x∗)≤f(x) for every x near x∗. For a smooth function of one variable, the following conditions are sufficient for a strict local minimum at an interior point:
A differentiable interior minimum must satisfy f′(x∗)=0, but positive second derivative is not necessary. If f′′(x∗)=0, the second-derivative test is inconclusive: f(x)=x4 has a minimum at zero even though f′′(0)=0.
In several variables, a sufficient test is ∇f(x∗)=0 and a Hessian that is positive definite.
The methods below seek local minima without generally guaranteeing a global minimum. A function with several valleys makes the starting point or bracket important.
Bracketing with golden-section search
Suppose f is unimodal on [a,b]: it decreases to a single minimum and then increases. Golden-section search uses only function values. It places two interior points
and compares them. If f(x1)<f(x2), the minimum cannot lie to the right of x2, so the new bracket is [a,x2]; otherwise it is [x1,b].
The ratio r is chosen so that the surviving interior point lands exactly where one of the next pair must go. The first contraction requires two function evaluations. Each subsequent contraction reuses one value and requires only one new evaluation. After n contractions, the bracket length is
Example: To shrink a bracket of length 1 below 0.01, you need 0.618n<0.01, which gives n>ln(0.01)/ln(0.618)≈9.6, so 10 contractions.
The method is robust: it never needs derivatives and its bracket keeps shrinking. Its limitation is that the bracket must contain exactly one minimum with the stated unimodal shape; with two valleys it may miss the lowest one.
Derivative-based methods: Newton and gradient descent
When derivatives are available, you can move much faster. Newton's method for minimization fits a parabola to f at the current guess and jumps to that parabola's vertex:
For a sufficiently smooth function, starting sufficiently close to a nondegenerate minimum with f′′(x∗)>0 gives local quadratic convergence. In several variables each step uses the Hessian and solves a linear system.
Gradient descent uses first derivatives only. It steps downhill along the negative gradient:
The step size α, often called the learning rate, controls the behaviour.
Example: For f(x)=x2 the update is xk+1=(1−2α)xk. With α=0.25 each step halves x; with α>1, nonzero iterates grow without bound.
Method | Information needed | Convergence near the minimum | Main risk |
|---|---|---|---|
Golden-section search | Values of f on a bracket | Linear: length times 0.618 per contraction | One variable only; needs a unimodal bracket |
Newton's method | f′ and f′′ (gradient and Hessian) | Locally quadratic near a sufficiently smooth, nondegenerate minimum | Can converge to a maximum or diverge from a poor start |
Gradient descent | f′ (the gradient) | Linear under strong convexity, a Lipschitz-continuous gradient and a suitable step size; general smooth objectives need not converge linearly | Diverges if α is too large; slow in long, narrow valleys |
What to remember
- At a smooth interior stationary point, f′′>0 is sufficient for a minimum; f′′=0 is inconclusive.
- Golden-section search needs a unimodal bracket: two evaluations initialize it, then one new evaluation per contraction.
- Newton's quadratic convergence is local and requires sufficient smoothness and a nondegenerate minimum.
- Gradient descent depends on step size and curvature; smoothness alone does not guarantee linear convergence.
Example: Least Material for an Open-Top Box
An open-top storage box must hold 4 m3. Its base is a square of side x metres and its height is h=4/x2 metres, so the sheet-metal area in square metres is
You will locate the best side length numerically, as you would if A came from a simulation, and then confirm the result with calculus. Write the Newton guesses as p0,p1,p2 to keep them apart from the golden-section points x1 and x2.
a) A is unimodal on [1,4] m. Carry out one iteration of golden-section search with r=0.618034 and state the new bracket.
The bracket length is b−a=4−1=3 m, so r(b−a)=0.618034×3=1.854102 m. The interior points are x1=4−1.854102= ________ and x2=1+1.854102= ________.
Evaluate the area at both points:
These give A(x1)= ________ and A(x2)= ________.
Because A(x1)<A(x2) and A is unimodal, the minimum cannot lie in (x2,4]. The new bracket is [1,2.854] m, of length 1.854 m, which is 0.618×3 m. The old x1=2.146 m lies inside the new bracket and becomes the next iteration's right interior point, so the next step needs only one new evaluation of A.
b) Starting from p0=1.5 m, take two iterations of Newton's method for minimization and report p2 to three decimal places.
The derivatives are
At p0=1.5: A′(1.5)=−37/9≈ ________ and A′′(1.5)=310/27≈ ________. The Newton update gives
so the first iterate is p1≈ ________. Retain the exact value p1=288/155 throughout the next calculation.
At p1, the derivative values are
Using the unrounded values in the second Newton update gives
After two iterations p2=1.989 m to three decimal places. Both steps moved right because A′<0 (the area decreases to the right) and A′′>0 (the parabola model opens upward, so its vertex is a minimum).
c) Find the exact minimizer with calculus, confirm that it is a minimum, and compare it with your results from parts a) and b).
Setting A′(x)=0 gives 2x=16/x2, so x3=8 and x∗=2 m. The second derivative there is A′′(2)=2+32/8= ________, which is positive, so x∗=2 m is a minimum with A(2)=4+8=12 m2 and height h=4/22=1 m.
The golden-section bracket [1,2.854] m contains x∗=2 m, as it must. Newton's p2=1.989 m is already within 0.011 m of x∗. For golden-section search to guarantee the same accuracy, its bracket must shrink below 0.022 m so that the midpoint is within 0.011 m: 3(0.618)n<0.022 requires n>ln(0.007333)/ln(0.618)≈10.2, so 11 iterations. Newton's quadratic convergence is the payoff for supplying A′ and A′′.
A student wants to minimize a smooth function of one variable on an interval using golden-section search. Arrange the steps of a complete run of the method in the correct order.
Loading ordering steps…
Golden-section search is used to minimize a unimodal function on the starting bracket [0,10], with x measured in metres. Each iteration multiplies the bracket length by r=0.618034. What is the smallest number of iterations after which the bracket length is less than 0.01 m? Give your answer as a whole number of iterations.