---
title: Define a convex function. Why does convexity matter for optimisation? Compare gradient descent with Newton's method…
url: https://gurkanozkan.ai/learn/questions/mle-convexity-gradient-descent-and-newton-s-method-09/
markdown: https://gurkanozkan.ai/learn/questions/mle-convexity-gradient-descent-and-newton-s-method-09.md
kind: question
role: ML engineering
stage: Technical
difficulty: Medium
json: https://gurkanozkan.ai/api/learn/questions/mle-convexity-gradient-descent-and-newton-s-method-09.json
robots: noindex
---

# Define a convex function. Why does convexity matter for optimisation? Compare gradient descent with Newton's method, including cost and when Newton fails.

ML engineering · Technical · Medium

## Answer

*Model answer, written in a candidate's voice*

### In short

- Convex: f(theta x + (1-theta)y) <= theta f(x) + (1-theta)f(y); twice differentiable iff Hessian PSD; every local minimum is global.
- Matters because it removes spurious local minima and gives global optimality certificates and convergence guarantees.
- Gradient descent: first-order, cheap per step, step size limited by smoothness, rate degrades with conditioning.
- Newton: uses Hessian, quadratic local convergence, O(d^3) factorisation per step, fails with indefinite/singular Hessian, saddles, or far from optimum.
- Quasi-Newton/L-BFGS approximates curvature cheaply; deep learning still favours first-order methods for scale, stochasticity, and memory.

### In full

A convex function satisfies f(theta x + (1-theta)y) <= theta f(x) + (1-theta)f(y) for all x, y and theta in [0,1], equivalently Jensen's inequality f(E[X]) <= E[f(X)], and for twice-differentiable functions this is equivalent to a positive semidefinite Hessian everywhere; a key consequence is that every local minimum is global. Convexity matters because it removes spurious local minima, turns stationarity into a global optimality certificate, and gives clean convergence guarantees. Gradient descent uses only the gradient, x_{k+1} = x_k - eta grad f(x_k), is cheap per iteration, needs eta at most about 1/L, where L is the smoothness (gradient Lipschitz) constant, and converges slowly when the problem is ill-conditioned, with rates that depend on the condition number. Newton's method uses the Hessian, x_{k+1} = x_k - H^{-1} grad f(x_k), and converges quadratically near a well-conditioned optimum, but it costs about O(d^3) per step for factorisation plus O(d^2) storage and struggles with non-convexity, indefinite or singular Hessians, saddle points, and starts far from the optimum. Quasi-Newton methods such as L-BFGS approximate the inverse Hessian from gradients to get much better-than-GD behaviour without full Hessian cost, but deep learning still relies mostly on first-order methods because d is huge, gradients are stochastic and noisy, memory is limited, and the landscape is non-convex.

*Corrected by an independent AI reviewer.*

## What a strong answer covers

- Definition via Jensen's inequality or a PSD Hessian; every local minimum is global.
- GD: first order, step size, convergence rate depends on conditioning.
- Newton: uses the Hessian, converges quadratically near the optimum, costs O(d³) per step, struggles with non-convexity and saddle points.
- Mentions quasi-Newton methods (L-BFGS) and why deep learning uses first-order methods.

## Common mistakes

- claiming neural-net losses are convex
- ignoring the cost of forming and inverting the Hessian.
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
