Salta al contenuto
Note per Studenti Convex Functions in Several Variables Report

Convex Functions in Several Variables

In questa pagina 5

This note builds on Hessian Matrix and Taylor FormulaThe second derivatives form the Hessian matrix H_f, symmetric by Schwarz's theorem (continuous mixed derivatives). Second-order Taylor: f(x0 + h) = f(x0) + grad f(x0)·h + (1/2) h^T H_f(x0) h + o(‖h‖^2). A symmetric matrix is positive or negative definite, semidefinite or indefinite according to the sign of the quadratic form h^T A h, recognized via eigenvalues or leading principal minors (in 2x2: determinant and first entry).Hessian Matrix and Taylor Formula →, Free Extrema in Several VariablesIf f is differentiable and has a relative extremum at an interior point x0, then grad f(x0) = 0 (Fermat): interior extrema are found among the critical points. If f is C^2, at a critical point: Hessian positive definite gives a minimum, negative definite a maximum, indefinite a saddle, semidefinite means the test is inconclusive and one studies the sign of f(x) - f(x0). In two variables: det H > 0 and f_xx > 0 minimum, det H > 0 and f_xx < 0 maximum, det H < 0 saddle.Free Extrema in Several Variables → and Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →.

In one variable a function is convex when its graph "holds water", and it is recognized by the sign of f′′f''. Here the same idea holds with the Hessian in place of f′′f'', and it is useful because for convex functions the search for minima is much simpler: a critical point is already a global minimum, without studying the boundary or the behaviour at infinity.

Convex sets and definition

A set C⊆RnC\subseteq\mathbb{R}^n is convex if for every x,y∈Cx,y\in C the segment joining them, {tx+(1−t)y: t∈[0,1]}\{tx+(1-t)y:\ t\in[0,1]\}, lies in CC. A disc, a half-plane, a rectangle, all of Rn\mathbb{R}^n are convex; an annulus or the union of two disjoint discs are not.

Grafico interattivo: A non-convex set: in the annulus 1 ≤ r ≤ 2 the segment between (−3/2, 0) and (3/2, 0), both endpoints in the annulus, passes through the hole and leaves the set

Definition. Let CC be convex. f:C→Rf:C\to\mathbb{R} is convex if for every x,y∈Cx,y\in C and t∈[0,1]t\in[0,1] f(tx+(1−t)y)≤t f(x)+(1−t) f(y).f\bigl(tx+(1-t)y\bigr)\le t\,f(x)+(1-t)\,f(y). It is strictly convex if the inequality is strict for x≠yx\ne y and t∈ ]0,1[t\in\,]0,1[.

Example. f(x)=x2f(x) = x^2 on R\mathbb{R}, with x=0x = 0, y=2y = 2, t=12t = \frac{1}{2}: f(1)=1≤12f(0)+12f(2)=2f(1) = 1 \le \frac{1}{2} f(0) + \frac{1}{2} f(2) = 2.

Meaning: restricted to a segment, ff lies below the chord joining the values at the endpoints. Examples: ∥x∥2=x12+⋯+xn2\|x\|^2=x_1^2+\dots+x_n^2 is strictly convex; every linear function is convex (with equality); the sum of convex functions is convex; the maximum of two convex functions is convex. A convex one-variable function gg composed with a linear function, f(x)=g(a⋅x)f(x)=g(a\cdot x), is convex.

Characterization via the gradient

Theorem. Let ff be differentiable on an open convex set CC. Then ff is convex if and only if for every x,y∈Cx,y\in C f(y)≥f(x)+∇f(x)⋅(y−x).f(y)\ge f(x)+\nabla f(x)\cdot(y-x).

Example. f(x,y)=x2+y2f(x,y) = x^2 + y^2 at x=(1,0)x = (1,0), where ∇f=(2,0)\nabla f = (2,0): the inequality f(y)≥f(x)+∇f(x)⋅(y−x)f(y) \ge f(x) + \nabla f(x) \cdot (y - x) becomes y12+y22≥1+2(y1−1)y_1^2 + y_2^2 \ge 1 + 2(y_1 - 1), i.e. (y1−1)2+y22≥0(y_1 - 1)^2 + y_2^2 \ge 0, always true.

That is, the graph of ff lies above the tangent plane at every point (see the tangent plane in Differentiability and the Gradientf is differentiable at x0 if f(x) = f(x0) + grad f(x0)·(x - x0) + o(‖x - x0‖), i.e. near x0 the graph is indistinguishable from the tangent plane z = f(x0) + grad f(x0)·(x - x0). Differentiable implies continuous, with partial derivatives and D_v f = grad f · v; continuous partial derivatives imply differentiable. The gradient gives the direction of steepest increase (slope ‖grad f‖) and is orthogonal to level curves.Differentiability and the Gradient →).

Why (the part "convex implies inequality"). For t∈ ]0,1]t\in\,]0,1] convexity gives f(x+t(y−x))≤(1−t)f(x)+tf(y)f(x+t(y-x))\le(1-t)f(x)+tf(y), i.e. f(x+t(y−x))−f(x)≤t (f(y)−f(x))f(x+t(y-x))-f(x)\le t\,(f(y)-f(x)). Dividing by t>0t>0 and letting t→0+t\to0^+, the left side tends to the directional derivative ∇f(x)⋅(y−x)\nabla f(x)\cdot(y-x): we get ∇f(x)⋅(y−x)≤f(y)−f(x)\nabla f(x)\cdot(y-x)\le f(y)-f(x).

Fundamental consequence. If ff is convex and ∇f(x0)=0\nabla f(x_0)=0, the inequality becomes f(y)≥f(x0)f(y)\ge f(x_0) for every yy: x0x_0 is a global minimum point. If ff is strictly convex the minimum is unique.

Characterization via the Hessian

Theorem. Let ff be of class C2C^2 on an open convex set CC.

  • ff is convex if and only if the Hessian matrix Hf(x)H_f(x) is positive semidefinite at every point x∈Cx\in C.
  • If Hf(x)H_f(x) is positive definite at every point, ff is strictly convex. The converse is false: f(x)=x4f(x)=x^4 is strictly convex but f′′(0)=0f''(0)=0.

Example. f(x,y)=x2+y2f(x,y) = x^2 + y^2 has Hf=(2002)H_f = \begin{pmatrix} 2 & 0 \\ 0 & 2 \end{pmatrix}, positive definite at every point: ff is strictly convex on R2\mathbb{R}^2.

Why. Restrict ff to a line: φ(s)=f(x+sv)\varphi(s)=f(x+sv). Then φ′′(s)=vTHf(x+sv) v\varphi''(s)=v^TH_f(x+sv)\,v (chain rule applied twice, Jacobian Matrix and the Chain RuleFor F from R^n to R^m, F = (f1, ..., fm), the Jacobian matrix J_F is the m x n matrix with entries d f_i / d x_j: row i is the gradient of f_i. Chain rule: J_(f∘g)(x) = J_f(g(x)) · J_g(x); frequent cases are d/dt f(gamma(t)) = grad f · gamma'(t) and f_x = f_u u_x + f_v v_x. If det J_F(x0) is nonzero, F is invertible near x0 and J_(F^-1) = (J_F)^-1. Polar coordinates: det J = rho.Jacobian Matrix and the Chain Rule →). The function ff is convex on every segment if and only if every φ\varphi is convex in one variable, i.e. φ′′≥0\varphi''\ge0, i.e. vTHf v≥0v^TH_f\,v\ge0 for every vv: this is the definition of positive semidefinite.

How to check in two variables. H=(abbc)H=\begin{pmatrix}a&b\\b&c\end{pmatrix} is positive semidefinite if and only if a≥0a\ge0, c≥0c\ge0 and det⁡H=ac−b2≥0\det H=ac-b^2\ge0; it is positive definite if a>0a>0 and det⁡H>0\det H>0 (Sylvester's criterion, Hessian Matrix and Taylor FormulaThe second derivatives form the Hessian matrix H_f, symmetric by Schwarz's theorem (continuous mixed derivatives). Second-order Taylor: f(x0 + h) = f(x0) + grad f(x0)·h + (1/2) h^T H_f(x0) h + o(‖h‖^2). A symmetric matrix is positive or negative definite, semidefinite or indefinite according to the sign of the quadratic form h^T A h, recognized via eigenvalues or leading principal minors (in 2x2: determinant and first entry).Hessian Matrix and Taylor Formula →).

Beware the difference from critical points. To classify a critical point the Hessian at that point suffices. For convexity we need the Hessian at all points of the domain.

Worked examples

Example 1. f(x,y)=x2+xy+y2f(x,y)=x^2+xy+y^2 on R2\mathbb{R}^2. H=(2112)H=\begin{pmatrix}2&1\\1&2\end{pmatrix} is constant, with a=2>0a=2>0 and det⁡=4−1=3>0\det=4-1=3>0: positive definite everywhere, ff is strictly convex. The only critical point is (0,0)(0,0) (∇f=(2x+y, x+2y)=0\nabla f=(2x+y,\,x+2y)=0), so it is the unique global minimum, f(0,0)=0f(0,0)=0.

Example 2: the Hessian depends on the point. f(x,y)=ex+y+x2f(x,y)=e^{x+y}+x^2. With s=x+ys=x+y: fxx=es+2f_{xx}=e^s+2, fxy=esf_{xy}=e^s, fyy=esf_{yy}=e^s, so H=(es+2eseses)H=\begin{pmatrix}e^s+2&e^s\\e^s&e^s\end{pmatrix} and det⁡H=(es+2)es−e2s=2es>0,fxx=es+2>0for every (x,y).\det H=(e^s+2)e^s-e^{2s}=2e^s>0,\qquad f_{xx}=e^s+2>0\quad\text{for every }(x,y). Positive definite everywhere: ff is strictly convex on R2\mathbb{R}^2. However it has no critical points (fy=ex+y>0f_y=e^{x+y}>0): a convex function may have no minimum.

Example 3: convex only on part of the plane. f(x,y)=x3+y2f(x,y)=x^3+y^2: H=(6x002)H=\begin{pmatrix}6x&0\\0&2\end{pmatrix}, det⁡H=12x\det H=12x. It is positive semidefinite if and only if x≥0x\ge0: ff is convex on the closed half-plane {x≥0}\{x\ge0\} (which is convex) and not on all of R2\mathbb{R}^2.

Example 4: semidefinite but not definite. f(x,y)=(x−y)2f(x,y)=(x-y)^2: H=(2−2−22)H=\begin{pmatrix}2&-2\\-2&2\end{pmatrix}, det⁡=0\det=0, a=2>0a=2>0: positive semidefinite. ff is convex but not strictly (it is constant along the lines x−y=constx-y=\text{const}), and the critical points are all the points of the line x=yx=y, all global minima (f=0f=0).

Example 5: global minimum without convexity. f(x,y)=x4+y4−xyf(x,y)=x^4+y^4-xy has det⁡H=144x2y2−1\det H=144x^2y^2-1, which at (0,0)(0,0) equals −1-1: the Hessian is indefinite there, ff is not convex on R2\mathbb{R}^2. Yet it has global minimum −18-\frac18 (seen from coercivity, Absolute Extrema on Compact SetsWeierstrass theorem: a continuous function on a compact (closed and bounded) subset of R^n has an absolute maximum and minimum. They are found by comparing the values at the interior critical points, at the critical points of the restrictions to the (parametrized) pieces of the boundary, and at the vertices. On an unbounded closed set, if f tends to +infinity at infinity the minimum exists and the maximum does not.Absolute Extrema on Compact Sets →). At the points ±(12,12)\pm\left(\frac12,\frac12\right) the Hessian is positive definite, but this only shows that they are local minima: for convexity it would be needed everywhere.

Common mistakes

  • Checking the Hessian at a single point and concluding that ff is convex.
  • Confusing semidefinite and definite: det⁡H=0\det H=0 does not rule out convexity (example 4), but does not give strict convexity.
  • Thinking positive definiteness is necessary for strict convexity (x4x^4).
  • Forgetting the set: convexity is stated on a convex set (example 3).
  • Deducing "has a minimum" from convexity: it only guarantees that a critical point, if it exists, is a global minimum.

Versione ripasso

Convex set. C⊆RnC \subseteq \mathbb{R}^n is convex if it contains the segment {tx+(1−t)y:t∈[0,1]}\{tx + (1-t)y : t \in [0,1]\} for every x,y∈Cx, y \in C.

Definition. On a convex CC, ff is convex if f(tx+(1−t)y)≤t f(x)+(1−t) f(y),t∈[0,1]f\bigl(tx+(1-t)y\bigr) \le t\,f(x) + (1-t)\,f(y), \qquad t \in [0,1] and strictly convex if the inequality is strict for x≠yx \neq y and t∈ ]0,1[t \in\,]0,1[.

  • Examples: ∥x∥2\|x\|^2 is strictly convex; linear functions are convex; sums of convex functions and maxima of two convex functions are convex; g(a⋅x)g(a\cdot x) with gg convex is convex.

Gradient characterization. If ff is differentiable on an open convex CC: ff convex   ⟺  f(y)≥f(x)+∇f(x)⋅(y−x)\iff f(y) \ge f(x) + \nabla f(x)\cdot(y-x) for all x,yx, y. The graph lies above every tangent plane.

  • Consequence: if ff is convex and ∇f(x0)=0\nabla f(x_0) = 0, then x0x_0 is a global minimum, unique if ff is strictly convex.
  • Example: f=x2+y2f = x^2+y^2 at (1,0)(1,0) gives (y1−1)2+y22≥0(y_1-1)^2 + y_2^2 \ge 0.

Hessian characterization. If f∈C2f \in C^2 on an open convex set:

  • ff convex   ⟺  Hf(x)\iff H_f(x) positive semidefinite at every point. Reason: φ(s)=f(x+sv)\varphi(s) = f(x+sv) has φ′′=vTHf v\varphi'' = v^T H_f\,v.
  • HfH_f positive definite everywhere ⇒\Rightarrow strictly convex. The converse is false: x4x^4 is strictly convex with f′′(0)=0f''(0) = 0.
  • In two variables with H=(abbc)H = \begin{pmatrix}a&b\\b&c\end{pmatrix}: semidefinite   ⟺  a≥0\iff a \ge 0, c≥0c \ge 0, det⁡H≥0\det H \ge 0; definite   ⟺  a>0\iff a > 0, det⁡H>0\det H > 0.

Examples.

Typical mistakes.

  • Checking the Hessian at one point and concluding convexity: it must hold everywhere.
  • Confusing semidefinite and definite: det⁡H=0\det H = 0 does not rule out convexity, but does not give strict convexity.
  • Believing positive definiteness is necessary for strict convexity (x4x^4).
  • Deducing the existence of a minimum from convexity: it only says that a critical point, if it exists, is a global minimum.

Teoria collegata