Why are the non-negative weighted sum ∑iαifi(x) (αi≥0), the pointwise maximum max⁡ifi(x), and the affine composition f(Ax+b) convex whenever each fi and f is convex, and how do these rules show that the L2-regularised hinge loss is convex without computing any Hessian?

Linear algebra and optimisation, Convexity
Level L3 Intermediate. Length Medium. Nature Mat Mathematical.

What's being asked

Whether you can prove the three workhorse rules that preserve convexity and apply them to a non-differentiable ML loss.

Key idea

Checking convexity directly from the chord inequality h(θx+(1−θ)y)≤θh(x)+(1−θ)h(y) avoids needing derivatives, so these three rules let you prove convexity of non-smooth objectives like SVMs and L1-regularised models in two lines.

Steps

  1. Non-negative weighted sum: let h(x)=∑iαifi(x) with αi≥0. For any x,y in the common convex domain and θ∈[0,1], multiply each convex inequality fi(θx+(1−θ)y)≤θfi(x)+(1−θ)fi(y) by αi≥0 (preserving the ≤ direction) and sum over i to get h(θx+(1−θ)y)≤θh(x)+(1−θ)h(y).
  2. Pointwise maximum: let h(x)=max⁡ifi(x). For each i, fi(θx+(1−θ)y)≤θfi(x)+(1−θ)fi(y)≤θmax⁡jfj(x)+(1−θ)max⁡jfj(y)=θh(x)+(1−θ)h(y). Taking max⁡i on the left preserves the bound.
  3. Affine composition: let h(x)=f(Ax+b) for a matrix A and vector b. Substitute u=Ax+b and v=Ay+b: h(θx+(1−θ)y)=f(A(θx+(1−θ)y)+b)=f(θu+(1−θ)v)≤θf(u)+(1−θ)f(v)=θh(x)+(1−θ)h(y).
  4. Apply to the L2-regularised SVM loss J(w,b)=λ2∥w∥22+∑i=1nmax⁡(0, 1−yi(w⊤xi+b)), where (xi,yi) are training inputs and labels, w is the weight vector, b is the bias and λ≥0 is the regularisation weight: each 1−yi(w⊤xi+b) is affine in (w,b) (equivalently, max⁡(0,1−z) is convex as the pointwise maximum of 0 and 1−z, and composing it with the affine map z=yi(w⊤xi+b) preserves convexity). Adding λ2∥w∥22 (convex, weighted by λ≥0) gives a convex J(w,b).

Common mistakes

How long your answer should be

Half a page; 4–5 minutes.

Last checked on 4 December 2026.

Read this

Previous in Linear algebra and optimisation: Is it true that (a) a uniformly sampled mini-batch gradient is an unbiased estimator of the full-batch gradient, (b) every SGD step decreases the training objective, and (c) SGD with a fixed learning rate converges to the exact minimum, and why?
Next in Linear algebra and optimisation: What are the first-order and second-order conditions for a twice-differentiable function f:Rd→R to be convex, and how do you prove that the second-order condition (∇2f(x)⪰0 everywhere) implies the first-order condition (f(y)≥f(x)+∇f(x)⊤(y−x))?