Advanced Mathematics

Convexity

A function is convex if the chord between any two points on its graph lies above it; then every local minimum is global.

Needs a step first: 19

Convex functions are bowl-shaped in every direction: f(λa+(1−λ)b)≤λf(a)+(1−λ)f(b)f(\lambda a + (1-\lambda)b) \le \lambda f(a) + (1-\lambda)f(b). For a twice-differentiable function this means the Hessian has no negative eigenvalues everywhere. The payoff is that there are no false valleys, so gradient descent cannot get stuck and the minimum is often provably found. Linear and logistic regression have convex losses; deep networks do not, which is why their training is less predictable and depends on initialisation and tricks.

Where it shows up: Convexity is why linear and logistic regression train reliably, and its absence explains much of the craft of training deep networks.

How to hold it: In your head

See a convex function as a bowl in every direction, so there are no false valleys and every local minimum is the global one.

What knowing it looks like

  • Test a function of two variables for convexity from the eigenvalues of its Hessian.
  • Use the chord definition to show that a sum of convex functions is convex.
  • Say which of the losses on this map are convex and why it matters for training.

Test yourself

Which of these is convex on all of R2\mathbb R^2: f(x,y)=x2+xy+y2f(x, y) = x^2 + xy + y^2 or g(x,y)=x2+3xy+y2g(x, y) = x^2 + 3xy + y^2? Justify with the Hessians' eigenvalues.
Show the worked answer
Hf=(2112)H_f = \begin{pmatrix} 2 & 1 \\ 1 & 2 \end{pmatrix} has eigenvalues 33 and 11, both positive, so ff is (strictly) convex. Hg=(2332)H_g = \begin{pmatrix} 2 & 3 \\ 3 & 2 \end{pmatrix} has eigenvalues 55 and −1-1; the negative one means gg curves down along (1,−1)(1, -1): indeed g(t,−t)=−t2g(t, -t) = -t^2. So gg is not convex; the origin is a saddle.

Needs a step first: 19

Learn it with an AI

Copy this prompt into any AI assistant. It will take you through step by step at your level and finish with the test above.

Be my maths tutor. I'm learning "Convexity" (Undergraduate II tier): A function is convex if the chord between any two points on its graph lies above it; then every local minimum is global.
I already know: Optimisation in Many Variables, Eigenvalues and Eigenvectors.
Teach it Socratically: first ask what I already know; then explain the core idea with one concrete example and why it's true; then give me three problems, one at a time, easy to hard. Wait for my answer, check every step, and point out mistakes without giving the answer away.
Finish by testing me with this: Which of these is convex on all of $\mathbb R^2$: $f(x, y) = x^2 + xy + y^2$ or $g(x, y) = x^2 + 3xy + y^2$? Justify with the Hessians' eigenvalues.
Use LaTeX for formulas. When you say where it's used later (machine learning, quantum mechanics), be specific.

Recommended