Skip to content
Tactiverge

School/✦ Research Engineer/Week 25

Convexity and local minima

Two engineers run the same optimiser on the same design problem and get different answers. Who is wrong?

About 40 min · 3 goals · Checked by automated tests

1.Why should I care?

Whether a problem is convex decides whether an optimiser's answer can be trusted. Least squares, many control and resource-allocation problems are convex; neural network training, mechanical design and placement usually are not. Research engineers say which kind they solved.

  • ◇ Define a convex function and a convex set and test simple functions for convexity.
  • ◇ Explain why every local minimum of a convex function is global.
  • ◇ Use multiple starts and sensitivity checks on non-convex problems and report what they show.

2.Predict

On f(x, y) = (x² − 1)² + ½y², gradient descent starts at x = −0.3. Where does it end?

Guess first. Being wrong here is how the surprise works.

3.Discover

Choose the double well. Try start points from x₀ = −2 to +2. Record which minimum each reaches. Then return to the bowl and confirm every start reaches the same point. What property of the surface makes the difference?

Loading the interactive…

Can't use the interactive? Read a description instead

On the double-well surface f = (x² − 1)² + ½y², paths starting with negative x end at x = −1, positive x at x = +1. On the round bowl, every start ends at the centre.

4.Checkpoint: guided practice

Check what you just discovered before going on. Hints appear after a wrong answer.

Practice 1

Which function is convex on all real x?

5.Understand

Convex functions

f is convex if the straight line between any two points on its graph lies on or above the graph: f(θx + (1 − θ)y) ≤ θf(x) + (1 − θ)f(y). For twice-differentiable f this means f'' ≥ 0 (in 1-D) or a positive semi-definite Hessian. x², |x|, eˣ and ½xᵀAx with A positive semi-definite are convex.

Why convexity is precious

For a convex function on a convex set, every local minimum is a global minimum, and gradient methods with a sensible step converge to it from any start. You can also certify optimality: a zero gradient proves you are done.

Living with non-convexity

Non-convex functions can have many local minima, saddle points and flat regions. Practical responses: multiple random starts (report the spread of results), good initial guesses from physics, convex relaxations that give bounds, and global methods (simulated annealing, genetic algorithms) for small problems. Never present one run of a non-convex optimiser as 'the optimum'.

Explain it another way

A single smooth bowl has one bottom; a landscape of hills and hollows has many. A ball rolls to whichever hollow is nearest.

Worked example 1

Is f(x) = x⁴ − 2x² convex?

f''(x) = 12x² − 4, negative for |x| < 0.577. Not convex. It has minima at x = ±1 and a local maximum at x = 0, just like the double well.

Common mix-ups

  • If an optimiser converges, it found the best answer.
    ✓ It found a stationary point. Only convexity (or a global method with proof) makes that the best.
  • Non-convex problems cannot be optimised.
    ✓ They are optimised every day; you just report local results honestly and test robustness.

6.Practice on your own

Practice, not a test. Wrong answers get a hint and another try.

Practice 2

Your optimiser returns a point with zero gradient on a convex objective. What can you conclude?

Practice 3

For f(x) = (x² − 1)², below what value of |x| is f''(x) negative? (3 decimal places.)

Practice 4 · a fresh version every time

Minimise f(x) = 1(x − 3)² by gradient descent with learning rate η = 0.25, starting from x₀ = 8. What is x after 3 steps?

Practice 5

You tune a robot arm design with a non-convex objective. What is the honest report?

7.Apply it

Run gradient descent on the double well from 21 evenly spaced starts between −2 and 2 (in the explorer or the Code Lab). Make a table of start → end point. Where is the boundary between the basins, and why there?

8.Reflect

Concepts: Optimisation and gradient descent · Probability and Monte Carlo simulation