M6 · Unconstrained optimality and convexity, from zero
Chapter 1 · about 90–110 min · Goal: decide whether a point is a minimum using slope (gradient) and curvature (Hessian), know exactly what each test does and does not say, classify stationary points by hand, solve quadratics and least squares, and prove or disprove convexity. Quiz 1 was 32 MCQs on exactly this; Midterm 1 Q I, IV and VII too.
It's a story: each section uses only what came before. Every idea comes first in plain words, then with numbers or a picture, then in the course's exact form, then a worked example, then the trap. Small Check boxes let you test yourself as you go (answers hidden). The one-page summary is at the very end; use it for revision, not for learning.
Notation used on this page (each is explained again where it first appears):
- $x\in\mathbb R^n$: a point, i.e. a column of $n$ numbers $x_1,\dots,x_n$. $x^*$: the point we are testing ("is $x^*$ a minimum?"). In 2-variable examples the coordinates are $x_1,x_2$; some past-paper questions call them $x,y$ instead (then $x,y$ are plain numbers).
- $f:\mathbb R^n\to\mathbb R$: the function we want to make small (the "cost").
- $u^\top v=u_1v_1+\dots+u_nv_n$ (dot product; $^\top$ means transpose). $\|x\|=\sqrt{x^\top x}$ = length of $x$, so $\|x-x^*\|$ = distance from $x$ to $x^*$.
- $d$: a direction (any nonzero vector). $t$: a number saying how far we move along $d$. $h$: a small step, $h=x-x^*$.
- $f'$, $f''$: first and second derivative of a 1-variable function. $\nabla f(x)$: the gradient (column of first partial derivatives). $\nabla^2 f(x)$: the Hessian (matrix of second partial derivatives). $H$ = the Hessian at the point being tested.
- $C^1$ / $C^2$: "once / twice differentiable, with continuous derivatives".
- $S$: a symmetric matrix we are testing. $S\succeq0$: "positive semidefinite" (PSD), $S\succ0$: "positive definite" (PD), defined in C3. $\lambda$ always means an eigenvalue: $Sv=\lambda v$ with $v\ne0$ (then $v$ is an eigenvector).
- $Q$, $b$: the matrix and vector of a quadratic $\tfrac12x^\top Qx-b^\top x$. $A$, $\bar b$: the data of least squares $\tfrac12\|Ax-\bar b\|^2$. $P$: the projector of least squares.
- $o(\cdot)$: "little-o", a remainder that vanishes faster than what's in the brackets; $r(h)$ names such a remainder (B2). $\kappa$: the positive constant in the SOSC proof (C4).
- $\theta\in[0,1]$: a mixing weight in the convexity definition (Midterm 1 writes it as $t$).
- range$(M)=\{Mx\}$ = all vectors $M$ can produce; null$(M)=\{x: Mx=0\}$. "$\Rightarrow$" = implies; "$\Leftrightarrow$" = if and only if; "s.t." = such that.
0. Why this topic exists
Optimisation means: find the $x$ that makes $f(x)$ as small as possible. You can't check every point (there are infinitely many). So we need cheap tests that look only at one point and its immediate surroundings, and tell us "this could be a minimum" or "this is certainly a minimum" or "this is certainly not one".
The tests use two pieces of information at the point:
- Slope (first derivatives, the gradient): at the bottom of a valley the ground is flat.
- Curvature (second derivatives, the Hessian): at the bottom of a valley the ground bends upwards in every direction.
Two problems make the chapter interesting, and they are exactly what the exams test:
- The tests have a gap. Some tests are only necessary (every minimum passes them, but non-minima can pass too); one is sufficient (passing it guarantees a minimum, but some minima fail it). Points that fall in the gap ($x^4$, $x^3$, $-x^4$, the Peano function) are the favourite exam traps. He said:
Focus on interpreting SONC… what SONC means, what SONC doesn't mean
. - The tests are local. They look through a microscope; they cannot tell whether a valley is the deepest one. Convexity is the property that removes this problem: for a convex function every local minimum is global.
Everything later in the course reuses this: Ch 2–4 algorithms stop when the gradient is (nearly) zero; Ch 6 repeats FONC/SONC/SOSC with constraints; Ch 7 is built on convexity.
Roadmap: A says what "minimum" means and when one exists. B does everything in one variable, where pictures are easy. C lifts it to $n$ variables by looking along lines. D gives the matrix tests. E classifies points by hand and shows the two famous counterexamples. F and G are quadratics and least squares, where the tests become exact. H is convexity. I is the exam recipe.
A. What a minimum is, and whether one exists
A1. Local, strict and global minima
Plain words. A local minimum beats all its neighbours: no point close by is lower. It doesn't care what happens far away. A global minimum beats everybody. A strict minimum beats its neighbours strictly: every nearby point (other than itself) is higher, not just "not lower".
Precisely (course definitions). Let $f:\mathbb R^n\to\mathbb R$.
- $x^*$ is a local minimum if there is some radius $\delta\gt0$ such that $f(x^*)\le f(x)$ for every $x$ with $\|x-x^*\|\lt\delta$.
- $x^*$ is a strict (also called strong) local minimum if, for some $\delta\gt0$, $f(x^*)\lt f(x)$ for every $x\ne x^*$ with $\|x-x^*\|\lt\delta$.
- $x^*$ is a global minimum if $f(x^*)\le f(x)$ for every $x\in\mathbb R^n$.
Reading "there is some $\delta\gt0$": you may zoom in as much as you like before checking. Every global minimum is also a local minimum. Every strict local minimum is also a local minimum (a plain "local minimum" includes the strict ones). Local maximum, strict local maximum etc. are the same with the inequalities reversed.
Show answer
(a) Local and global minimum (nobody is lower), but not strict (the neighbours are equal). In fact every point is a non-strict global minimum. (b) $f\ge0$ everywhere and $f(\pm1)=0$, and near $\pm1$ every other point has $f\gt0$: both are strict local minima and both are global minima. A global minimum need not be unique.
A2. Does a minimum exist at all? (Weierstrass, coercive)
Plain words. The optimality tests describe a minimum if there is one. Sometimes there isn't, and a minimiser can "escape" in two ways:
- Escape to infinity. $f(x)=x$: keep going left and $f$ keeps decreasing. $f(x)=e^x$: it is always positive and gets as close to 0 as you like as $x\to-\infty$, but never reaches 0. The lowest value is approached, never attained.
- Escape through a missing edge or a jump. $f(x)=x$ on the open interval $(0,1)$: the "best" point would be 0, which is not allowed.
Coercive blocks the first escape: $f$ is coercive if $f(x)\to+\infty$ whenever $\|x\|\to\infty$, i.e. "far away in every direction, the function climbs to $+\infty$". Then all the good candidates sit in a bounded region. Closedness and (lower semi)continuity block the second escape.
Let $X\subseteq\mathbb R^n$ be nonempty and closed, and let $f:\mathbb R^n\to(-\infty,+\infty]$ be proper, lower semicontinuous and coercive, with $X\cap\text{dom} f\ne\emptyset$. Then $\min_{x\in X}f(x)$ has a solution, and the set of minimisers is nonempty and compact.
Reading the words: closed = contains its boundary points. proper = never $-\infty$ and finite somewhere. $\text{dom} f$ = the points where $f$ is finite. lower semicontinuous (lsc) = may jump down at a point but not up; every continuous function is lsc. compact = closed and bounded. Why it works: pick any allowed $\bar x$ with $f(\bar x)$ finite. Only points with $f(x)\le f(\bar x)$ can win; coercivity makes that set bounded, so it's compact, and an lsc function attains its smallest value on a compact set.
- $f=x_1^2+x_2^2-4x_1$: the squares win far away, so it's coercive, and a global minimum exists (at $(2,0)$).
- $e^x$ is not coercive ($x\to-\infty$ gives $e^x\to0$, not $+\infty$), consistent with having no minimum. But $e^x+e^{-x}$ is coercive: minimum at 0.
- $-e^{-x^2}$ tends to 0 far away (not coercive), yet it has a global minimum $-1$ at $x=0$. Coercive is sufficient, not necessary.
How you use it in an exam: if $f$ is continuous and coercive on $\mathbb R^n$, a global minimum exists; a global minimum is a local minimum, so it is among the stationary points (C4); so the global minimum is the stationary point with the smallest value. (Practice N1 does exactly this.)
- "Bounded below ⇒ a minimum exists": false ($e^x$).
- "Bounded set ⇒ a minimum exists": false if the set is not closed ($x$ on $(0,1)$).
- "$f'(x)=0$ somewhere ⇒ a minimum exists": false ($x^3$ at 0).
Show answer
(a) Yes. (b) No: along the line $x_1=x_2=s$ it is 0 for every $s$, so it doesn't climb in that direction. (c) Yes: along a line through 0 the term $x_1^4$ (or $x_2^2$ when $x_1=0$) eventually beats $10x_1x_2$; precisely, $|10x_1x_2|\le \tfrac12x_2^2+50x_1^2$, so $f\ge x_1^4-50x_1^2+\tfrac12x_2^2\to\infty$.
B. One variable first: slope and curvature
B1. Slope and curvature at a bottom
Think of a 1-variable graph $f(x)$. At the bottom of a smooth valley the tangent line is horizontal: $f'(x^*)=0$. A point with $f'(x^*)=0$ is called a stationary point (or critical point). It might be a minimum, a maximum, or neither.
The second derivative $f''$ measures curvature: $f''\gt0$ means the graph bends up (like a cup), $f''\lt0$ means it bends down (like a cap). At the bottom of a valley we expect "flat and bending up".
$f(x)=\sum_{i=1}^n w_i(x-y_i)^2$ with weights $w_i\gt0$ and data $y_i$. Then $f'(x)=2\sum_i w_i(x-y_i)=0$ gives $x^*=\dfrac{\sum_i w_iy_i}{\sum_i w_i}$ (the weighted mean), and $f''=2\sum_i w_i\gt0$: it bends up everywhere. Numbers: data $2,3,7$ with weights $1,1,2$: $x^*=\frac{2+3+14}{4}=4.75$. (Quiz 1 Q6 is this.)
B2. The tool behind every proof: little-o and Taylor
Little-o in plain words. We need a way to say "this leftover term is so small near 0 that it doesn't matter". Writing
$$r(h)=o(h^2)\quad(h\to0)\qquad\text{means}\qquad \frac{r(h)}{h^2}\to0 .$$So $r(h)$ is small even compared with $h^2$, which is itself small. Example: $r(h)=h^3$. The ratio $h^3/h^2=h$ is $0.1$ at $h=0.1$ and $0.01$ at $h=0.01$, so $h^3=o(h^2)$. Note: $o(h^2)$ says nothing about the sign of $r$; it can be positive or negative. Likewise $r(h)=o(h)$ means $r(h)/h\to0$.
Taylor's formula (with a little-o remainder): if $f$ is twice differentiable at $x^*$,
$$f(x^*+h)=f(x^*)+f'(x^*)\,h+\tfrac12f''(x^*)\,h^2+o(h^2).$$(With only one derivative: $f(x^*+h)=f(x^*)+f'(x^*)h+o(h)$.) In words: near $x^*$ the function looks like a parabola, and the error is negligible even compared with $h^2$.
$f(0)=f'(0)=f''(0)=1$, so the Taylor parabola is $1+h+\frac12h^2$. At $h=0.1$: $e^{0.1}=1.105171$, parabola $1.105$, remainder $0.000171$, and remainder$/h^2=0.0171$. At $h=0.01$: remainder$/h^2=0.00167$. The ratio $\to0$: that's what $o(h^2)$ means.
For tiny $h$, the remainder is negligible compared with the first term that is not zero. So the sign of $f(x^*+h)-f(x^*)$ is the sign of the first nonzero term. If every term we know is zero, the remainder decides, and we know nothing about its sign.
B3. The three conditions in one variable, with proofs
First two words that the whole chapter depends on:
- Necessary condition: every minimum satisfies it. So failing it rules a point out. Passing it proves nothing.
- Sufficient condition: anything that satisfies it is a minimum. So passing it rules a point in. Failing it proves nothing.
- FONC (first-order necessary condition): $x^*$ local min and $f$ differentiable at $x^*$ $\Rightarrow$ $f'(x^*)=0$.
- SONC (second-order necessary condition): $x^*$ local min and $f$ twice differentiable $\Rightarrow$ $f'(x^*)=0$ and $f''(x^*)\ge0$.
- SOSC (second-order sufficient condition): $f'(x^*)=0$ and $f''(x^*)\gt0$ $\Rightarrow$ $x^*$ is a strict local min.
- FONC. $f(x^*+h)-f(x^*)=f'(x^*)h+o(h)=h\big(f'(x^*)+\tfrac{o(h)}{h}\big)$. The bracket tends to $f'(x^*)$. Suppose $f'(x^*)\gt0$: for small $h$ the bracket is positive, so a small negative $h$ makes the difference negative: a nearby point is lower. That contradicts "local min". If $f'(x^*)\lt0$, use a small positive $h$. So $f'(x^*)=0$.
- SONC. Now $f'(x^*)=0$, so $f(x^*+h)-f(x^*)=h^2\big(\tfrac12f''(x^*)+\tfrac{o(h^2)}{h^2}\big)$. If $f''(x^*)\lt0$, the bracket is negative for all small $h$, and $h^2\gt0$, so every nearby point is lower: contradiction. So $f''(x^*)\ge0$.
- SOSC. Same formula with $f''(x^*)\gt0$: the bracket is positive for small $h$, and $h^2\gt0$ for $h\ne0$, so $f(x^*+h)\gt f(x^*)$: a strict local min. (The proof produces a strict inequality, which is why SOSC always promises a strict minimum.)
Why SONC can't say "$\gt$": the proof only reaches a contradiction when $f''(x^*)\lt0$. If $f''(x^*)=0$ the bracket is just $o(h^2)/h^2$, which can have either sign. That case is the gap, and the next section lives in it.
B4. The four test functions: $x^2$, $x^4$, $x^3$, $-x^4$ at 0
| $f$ at 0 | $f'(0)$ | $f''(0)$ | FONC | SONC | SOSC | What 0 really is | Lesson |
|---|---|---|---|---|---|---|---|
| $x^2$ | 0 | 2 | ✓ | ✓ | ✓ | strict global min | the normal case |
| $x^4$ | 0 | 0 | ✓ | ✓ | ✗ | strict global min | SOSC is not necessary |
| $x^3$ | 0 | 0 | ✓ | ✓ | ✗ | neither (inflection) | FONC + SONC are not sufficient |
| $-x^4$ | 0 | 0 | ✓ | ✓ | ✗ | strict local max | SONC doesn't even rule out a max |
How do we know the truth without the tests? Look at the function directly: $x^4\gt0$ for $x\ne0$ (min); $x^3$ is negative for $x\lt0$ and positive for $x\gt0$ (neither); $-x^4\lt0$ for $x\ne0$ (max).
- "SOSC fails ⇒ not a minimum": false ($x^4$).
- "FONC and SONC hold ⇒ minimum": false ($x^3$, $-x^4$).
- "$f''(x^*)\lt0$ at a stationary point, but the remainder might still make it a minimum": false. $o(h^2)/h^2\to0$, so a remainder can never beat a nonzero $h^2$ term. Such a point is a strict local max.
- SONC has the weak inequality $\ge$; SOSC has the strict one $\gt$, and concludes a strict minimum.
Show answer
$f=x^3-x^2$, $f'=3x^2-2x=x(3x-2)$, $f''=6x-2$. At 0: $f''=-2\lt0$ ⇒ strict local max (by the 1-D SONC, it can't be a min; it's a max by SOSC applied to $-f$). At $\tfrac23$: $f''=2\gt0$ ⇒ SOSC ⇒ strict local min. Not global: $f\to-\infty$ as $x\to-\infty$.
C. Many variables: look along every line
The big idea of the chapter: an $n$-variable question becomes a 1-variable question if you walk along a straight line. Then B applies.
C1. Gradient and Hessian
For $f(x_1,\dots,x_n)$:
- The gradient $\nabla f(x)$ is the column of first partial derivatives: entry $i$ is $\partial f/\partial x_i$ (the slope when you move only $x_i$).
- The Hessian $\nabla^2 f(x)$ is the $n\times n$ matrix of second partial derivatives: entry $(i,j)$ is $\partial^2 f/\partial x_i\partial x_j$. When $f\in C^2$ it is symmetric (entry $(i,j)$ = entry $(j,i)$).
$f(x)=x_1^2+3x_1x_2$. $\partial f/\partial x_1=2x_1+3x_2$, $\partial f/\partial x_2=3x_1$, so $\nabla f(x)=\begin{bmatrix}2x_1+3x_2\\3x_1\end{bmatrix}$ and $\nabla^2f(x)=\begin{bmatrix}2&3\\3&0\end{bmatrix}$. At $x=(1,2)$: $\nabla f=(8,3)$.
C2. Restrict to a line: slope $=\nabla f^\top d$, curvature $=d^\top\nabla^2 f\,d$
Stand at $x^*$, pick a direction $d$, and walk: your position after "time" $t$ is $x^*+td$. Define the 1-variable function
$$\varphi(t)=f(x^*+td).$$If $x^*$ is a local minimum of $f$, then $t=0$ is a local minimum of $\varphi$ (the line passes through the small ball around $x^*$). By the chain rule ($\frac{d}{dt}$ of $f(x^*+td)$ is $\sum_i\frac{\partial f}{\partial x_i}\cdot d_i$; differentiate once more for the second):
Same $f=x_1^2+3x_1x_2$, at $x^*=(1,2)$, direction $d=(1,-1)$. Walking: $x^*+td=(1+t,\,2-t)$, so
$$\varphi(t)=(1+t)^2+3(1+t)(2-t)=1+2t+t^2+3(2+t-t^2)=7+5t-2t^2.$$For a $2\times2$ symmetric matrix $S=\begin{bmatrix}s_{11}&s_{12}\\s_{12}&s_{22}\end{bmatrix}$ and $d=(d_1,d_2)$, multiplying out gives $d^\top Sd=s_{11}d_1^2+2s_{12}d_1d_2+s_{22}d_2^2$ (the off-diagonal entry appears twice).
Directly: $\varphi'(0)=5$, $\varphi''(0)=-4$. Formula: $\nabla f(x^*)^\top d=(8,3)\cdot(1,-1)=8-3=5$ ✓. And $d^\top\nabla^2f\,d=\begin{bmatrix}1&-1\end{bmatrix}\begin{bmatrix}2&3\\3&0\end{bmatrix}\begin{bmatrix}1\\-1\end{bmatrix}=s_{11}d_1^2+2s_{12}d_1d_2+s_{22}d_2^2=2\cdot1+2\cdot3\cdot(1)(-1)+0=-4$ ✓.
C3. Taylor in $n$ variables, and the words PSD / PD
The $n$-variable version of Taylor's formula is a theorem about $C^2$ functions (it is not obtained just by putting $h=td$ into the 1-D formula line by line: the remainder must be small uniformly, for all directions at once, depending only on $\|h\|$). For $f\in C^2$ near $x^*$:
$$f(x^*+h)=f(x^*)+\nabla f(x^*)^\top h+\tfrac12\,h^\top\nabla^2f(x^*)\,h+o(\|h\|^2),$$where $o(\|h\|^2)$ is a remainder with $o(\|h\|^2)/\|h\|^2\to0$ as $h\to0$. The middle term is "slope times step", the next is "half the curvature times step squared". What lines do give us are the two formulas of C2, $\varphi'(0)=\nabla f(x^*)^\top d$ and $\varphi''(0)=d^\top\nabla^2f(x^*)d$; that is enough for FONC and SONC, but SOSC needs this uniform remainder (C4, E4).
The curvature term $h^\top Sh$ (with $S$ the Hessian) is a number for each direction. We name matrices by its sign. For a symmetric matrix $S$:
- $S$ is positive semidefinite (PSD, $S\succeq0$) if $d^\top Sd\ge0$ for all $d$: curvature never negative.
- $S$ is positive definite (PD, $S\succ0$) if $d^\top Sd\gt0$ for all $d\ne0$: curvature strictly positive in every direction.
- $S$ is indefinite if $d^\top Sd$ is positive for some $d$ and negative for others. (Negative semidefinite / definite: same with $\le$ / $\lt$, i.e. $-S$ is PSD / PD.)
Example: $\begin{bmatrix}2&3\\3&0\end{bmatrix}$ from C2 is indefinite: $d=(1,0)$ gives $2\gt0$, $d=(1,-1)$ gave $-4\lt0$. (Section D gives fast tests.)
C4. FONC, SONC, SOSC in $n$ variables
- FONC: $x^*$ local min, $f$ differentiable at $x^*$ $\Rightarrow$ $\nabla f(x^*)=0$.
- SONC: $x^*$ local min, $f\in C^2$ near $x^*$ $\Rightarrow$ $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succeq0$ (PSD).
- SOSC: $f\in C^2$, $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succ0$ (PD) $\Rightarrow$ $x^*$ is a strict local min.
A point with $\nabla f(x^*)=0$ is a stationary point.
- FONC. For every direction $d$, $\varphi(t)=f(x^*+td)$ has a local min at 0, so by 1-D FONC $0=\varphi'(0)=\nabla f(x^*)^\top d$. This holds for every $d$; take $d=\nabla f(x^*)$: $\|\nabla f(x^*)\|^2=0$, so $\nabla f(x^*)=0$.
- SONC. By 1-D SONC, $0\le\varphi''(0)=d^\top\nabla^2f(x^*)d$ for every $d$. That is the definition of PSD.
- SOSC. Here lines are not enough: we need one bound that works for all directions at once. Since $H=\nabla^2f(x^*)\succ0$ there is a constant $\kappa\gt0$ ("kappa") with $h^\top Hh\ge \kappa\|h\|^2$ for all $h$ ($\kappa$ = smallest eigenvalue of $H$; see D1). Then Taylor gives $f(x^*+h)-f(x^*)\ge\|h\|^2\big(\tfrac \kappa2+\tfrac{o(\|h\|^2)}{\|h\|^2}\big)\gt0$ for small $h\ne0$.
Section E4 (Peano) shows that "a minimum along every line" really is weaker than "a minimum", which is why SOSC needed that uniform $\kappa$.
C5. What SONC means, what it does NOT mean, and "Group N / Group S"
What SONC means (the useful direction). Read it backwards (the contrapositive): if at a stationary point the Hessian is not PSD (some direction with negative curvature, i.e. a negative eigenvalue), then the point is not a local minimum. That's how you rule out saddles and maxima.
What SONC does NOT mean.
- "$\nabla f=0$ and Hessian PSD ⇒ local min": false ($x^3$, $-x^4$; in 2-D the monkey saddle and Peano, section E).
- "Strict local min ⇒ Hessian PD": false ($x^4$; $x_1^4+x_2^2$ has Hessian diag$(0,2)$ at 0).
- "Hessian PSD and singular (some zero curvature) ⇒ non-strict minimum": false. Singular just means the second-order test is silent.
His revision-class language: call the two sets of conditions
- Group N ("necessary"; he calls it group one) = $\{\nabla f(x^*)=0,\ \nabla^2f(x^*)\succeq0\}$ (= SONC),
- Group S ("sufficient"; his group two) = $\{\nabla f(x^*)=0,\ \nabla^2f(x^*)\succ0\}$ (= SOSC's hypotheses).
| General $f\in C^2$ | Quadratic $f=\frac12x^\top Qx-b^\top x$ | |
|---|---|---|
| local min ⇒ Group N? | ✓ (necessary) | ✓ |
| Group N ⇒ local min? | ✗ ($x^3$, $-x^4$) | ✓ (and the min is global) |
| Group S ⇒ strict local min? | ✓ (sufficient) | ✓ (and it's the unique global min) |
| strict local min ⇒ Group S? | ✗ ($x^4$) | ✓ |
Why quadratics are different: for a quadratic, Taylor is exact (the Hessian is the constant $Q$, so there's no $o(\|h\|^2)$ remainder to spoil things). It is not because PSD somehow becomes PD. Proof in F2. He said: for quadratic function, both way both directional implications are true
.
Show answer
First: $d=(0,1)$ gives curvature $-1\lt0$, so the Hessian is not PSD: SONC fails, so $x^*$ is not a local min. ($d=(1,0)$ gives $+2$, so it's not a max either: a saddle.) Second: PSD but singular: SONC holds, SOSC fails, so no conclusion from second order. It could be $x_1^2+x_2^4$ (min), $x_1^2+x_2^3$ (not a min) or $x_1^2-x_2^4$ (not a min).
D. Testing whether a matrix is PD or PSD
The definition "$d^\top Sd\ge0$ for all $d$" can't be checked direction by direction. Two practical tests: eigenvalues, and determinants of sub-matrices (minors).
D1. Eigenvalue test
Idea. The spectral theorem says: a real symmetric matrix $S$ has real eigenvalues and an orthonormal basis of eigenvectors. In matrix form, $S$ can be rotated into a diagonal matrix: $S=V\Lambda V^\top$ with $V$ orthogonal (a rotation, its columns are orthonormal eigenvectors) and $\Lambda=$ diag$(\lambda_1,\dots,\lambda_n)$ the eigenvalues. Put $y=V^\top d$ (the same direction in rotated coordinates; $y=0$ only if $d=0$). Then
$$d^\top Sd=y^\top\Lambda y=\lambda_1y_1^2+\dots+\lambda_ny_n^2 .$$A sum $\sum\lambda_iy_i^2$ is $\ge0$ for every $y$ exactly when every $\lambda_i\ge0$ (try $y$ = one unit vector at a time), and $\gt0$ for every $y\ne0$ exactly when every $\lambda_i\gt0$.
PSD ⇔ all $\lambda_i\ge0$ · PD ⇔ all $\lambda_i\gt0$ · indefinite ⇔ some $\lambda_i\gt0$ and some $\lambda_j\lt0$. The smallest eigenvalue $\lambda_{\min}$ satisfies $d^\top Sd\ge\lambda_{\min}\|d\|^2$ (the constant $\kappa$ used in the SOSC proof).
2×2 shortcut. For a 2×2 matrix, $\lambda_1+\lambda_2=$ trace (sum of diagonal) and $\lambda_1\lambda_2=\det$. So: $\det\lt0$ ⇒ opposite signs ⇒ indefinite. $\det\gt0$ and trace $\gt0$ ⇒ both positive ⇒ PD. $\det\gt0$ and trace $\lt0$ ⇒ both negative ⇒ negative definite. $\det=0$ ⇒ one eigenvalue is 0 (the other equals the trace).
- $\begin{bmatrix}2&-1\\-1&2\end{bmatrix}$: trace 4, det 3, eigenvalues 1 and 3 ⇒ PD.
- $\begin{bmatrix}1&2\\2&1\end{bmatrix}$: det $=-3\lt0$ ⇒ indefinite (eigenvalues $-1$, 3). Direction $d=(1,-1)$: $d^\top Sd=1-4+1=-2\lt0$.
- $\begin{bmatrix}1&1\\1&1\end{bmatrix}$: det 0, trace 2 ⇒ eigenvalues 0 and 2 ⇒ PSD, not PD.
D2. Minors and Sylvester's criterion for PD
A principal submatrix keeps the same set of rows and columns (e.g. rows and columns $\{1,3\}$). Its determinant is a principal minor. A leading principal minor $\Delta_k$ keeps the first $k$ rows and columns. An $n\times n$ matrix has $n$ leading minors but $2^n-1$ principal minors. For $S=\begin{bmatrix}s_{11}&s_{12}&s_{13}\\s_{12}&s_{22}&s_{23}\\s_{13}&s_{23}&s_{33}\end{bmatrix}$: the 1×1 principal minors are $s_{11},s_{22},s_{33}$; the 2×2 ones are $s_{11}s_{22}-s_{12}^2$ (rows/columns $\{1,2\}$), $s_{11}s_{33}-s_{13}^2$ ($\{1,3\}$), $s_{22}s_{33}-s_{23}^2$ ($\{2,3\}$); the 3×3 one is $\det S$. The leading ones are $s_{11}$, $s_{11}s_{22}-s_{12}^2$, $\det S$.
$S\succ0$ (PD) ⇔ leading principal minors $\Delta_1\gt0,\ \Delta_2\gt0,\dots,\Delta_n\gt0$.
(Negative definite ⇔ $-S$ is PD ⇔ the signs alternate: $\Delta_1\lt0,\ \Delta_2\gt0,\ \Delta_3\lt0,\dots$)
Example: $\begin{bmatrix}2&-1\\-1&2\end{bmatrix}$: $\Delta_1=2\gt0$, $\Delta_2=4-1=3\gt0$ ⇒ PD ✓ (agrees with D1).
D3. PSD needs all principal minors (leading ones are not enough)
The tempting guess "PSD ⇔ leading minors $\ge0$" is false. A zero leading minor can hide a negative entry further down.
$S=\begin{bmatrix}0&0\\0&-1\end{bmatrix}$. Leading minors: $\Delta_1=0\ge0$, $\Delta_2=0\ge0$. Looks fine. But the other 1×1 principal minor is $-1\lt0$, and indeed $d=(0,1)$ gives $d^\top Sd=-1$. Eigenvalues $0,-1$: not PSD.
3×3 version: $\begin{bmatrix}1&2&0\\2&4&0\\0&0&-1\end{bmatrix}$ has leading minors $1,0,0$ (all $\ge0$) but the principal minor in position $(3,3)$ is $-1$. Eigenvalues $-1,0,5$: not PSD.
$S\succeq0$ ⇔ every principal minor $\ge0$. He said: looking at the leading principal minors alone is not enough. You have to look at all principal minors
. Quick kill: any negative diagonal entry already means "not PSD".
Show answer
(a) det $=4-4=0$, trace 5 ⇒ eigenvalues 0, 5 ⇒ PSD, not PD (principal minors 4, 1, 0 all $\ge0$). (b) det $=-6-1=-7\lt0$ ⇒ indefinite. (c) 1×1 minors 1,1,1; 2×2 minors all $1-1=0$; det 0 ⇒ all $\ge0$ ⇒ PSD; leading minors $1,0,0$ are not all $\gt0$ ⇒ not PD (eigenvalues 0, 0, 3).
E. Classifying stationary points
E1. The recipe
A saddle point is a stationary point that is neither a local min nor a local max: arbitrarily close to it there are points both higher and lower.
- Compute $\nabla f$ and solve $\nabla f=0$. Find all real solutions (factor; don't divide by something that might be 0).
- Compute the Hessian $\nabla^2f$ as a function of $x$.
- At each stationary point, decide the type of the Hessian (D):
- PD ⇒ strict local min (SOSC).
- Negative definite ⇒ strict local max (SOSC for $-f$).
- Indefinite ⇒ saddle (SONC fails for $f$ and for $-f$). Give the two directions.
- Semidefinite and singular ⇒ test inconclusive: look at $f$ itself along lines and curves (E3).
- Global question: is there a global min? Use $f\ge$ some value, convexity (H), or coercive + compare stationary values (Weierstrass, A2; worked in E2, third example), or show a direction where $f\to-\infty$.
E2. A full example by hand: $f(x_1,x_2)=x_1^3+x_2^3-3x_1x_2$
- Gradient. $\nabla f=\begin{bmatrix}3x_1^2-3x_2\\3x_2^2-3x_1\end{bmatrix}$. Setting it to 0: $x_2=x_1^2$ and $x_1=x_2^2$.
- Solve. Substitute the first into the second: $x_1=(x_1^2)^2=x_1^4$, so $x_1^4-x_1=x_1(x_1^3-1)=0$. Real solutions: $x_1=0$ or $x_1=1$. Then $x_2=x_1^2$ gives the points $(0,0)$ and $(1,1)$.
- Hessian. $\nabla^2f=\begin{bmatrix}6x_1&-3\\-3&6x_2\end{bmatrix}$.
- At $(0,0)$: $\begin{bmatrix}0&-3\\-3&0\end{bmatrix}$, det $=0-9=-9\lt0$ ⇒ indefinite (eigenvalues $\pm3$) ⇒ saddle. Confirm with lines: along $d=(1,1)$, $f(t,t)=2t^3-3t^2\lt0$ for small $t\ne0$ (lower); along $d=(1,-1)$, $f(t,-t)=t^3-t^3+3t^2=3t^2\gt0$ (higher).
- At $(1,1)$: $\begin{bmatrix}6&-3\\-3&6\end{bmatrix}$, $\Delta_1=6\gt0$, $\Delta_2=36-9=27\gt0$ ⇒ PD (eigenvalues 3 and 9) ⇒ SOSC ⇒ strict local min, value $f(1,1)=1+1-3=-1$.
- Global? Along the $x_1$-axis, $f(t,0)=t^3\to-\infty$ as $t\to-\infty$. So there is no global min: $(1,1)$ is only a local one. (He likes this trap: "strict local min" ≠ "global min".)
- $\nabla f=\begin{bmatrix}4x_1(x_1^2-4)\\2x_2\end{bmatrix}=0$ ⇒ $x_2=0$ and $x_1\in\{0,2,-2\}$: points $(0,0),(2,0),(-2,0)$.
- $\nabla^2f=\begin{bmatrix}12x_1^2-16&0\\0&2\end{bmatrix}$.
- $(0,0)$: diag$(-16,2)$, one negative and one positive eigenvalue ⇒ saddle (SONC fails, so not a min; not a max either).
- $(\pm2,0)$: diag$(32,2)\succ0$ ⇒ SOSC ⇒ strict local min. Since $f\ge0$ everywhere and $f(\pm2,0)=0$, both are global minima.
Here $f$ is not $\ge$ an obvious value, and (as we'll see) not convex, so we use A2: coercive ⇒ a global min exists ⇒ it is a stationary point ⇒ it is the stationary point with the smallest value.
- Stationary points. $\nabla f=\begin{bmatrix}4x_1^3-2x_2\\2x_2-2x_1\end{bmatrix}=0$. The second entry gives $x_2=x_1$; then $4x_1^3-2x_1=2x_1(2x_1^2-1)=0$, so $x_1\in\{0,\ \tfrac1{\sqrt2},\ -\tfrac1{\sqrt2}\}$. Points: $(0,0)$, $\big(\tfrac1{\sqrt2},\tfrac1{\sqrt2}\big)$, $\big(-\tfrac1{\sqrt2},-\tfrac1{\sqrt2}\big)$.
- Hessian. $\nabla^2f=\begin{bmatrix}12x_1^2&-2\\-2&2\end{bmatrix}$. At $(0,0)$: $\begin{bmatrix}0&-2\\-2&2\end{bmatrix}$, det $=-4\lt0$ ⇒ saddle (so $f$ is not convex). At $\pm\big(\tfrac1{\sqrt2},\tfrac1{\sqrt2}\big)$: $12x_1^2=6$, so $\begin{bmatrix}6&-2\\-2&2\end{bmatrix}$, $\Delta_1=6\gt0$, $\Delta_2=12-4=8\gt0$ ⇒ PD ⇒ strict local minima, value $\tfrac14+\tfrac12-1=-\tfrac14$.
- Coercive. The cross term $-2x_1x_2$ can be negative, so bound it by squares. For any numbers $a,b$: $2|ab|\le a^2+b^2$ (because $(|a|-|b|)^2\ge0$). With $a=\sqrt2\,x_1$, $b=x_2/\sqrt2$: $2|x_1x_2|=2|ab|\le 2x_1^2+\tfrac12x_2^2$. Hence $$f\ \ge\ x_1^4+x_2^2-2x_1^2-\tfrac12x_2^2=\underbrace{(x_1^4-2x_1^2)}_{\ge-1}+\underbrace{\tfrac12x_2^2}_{\ge0}.$$ If $\|x\|\to\infty$ then $|x_1|\to\infty$ or $|x_2|\to\infty$ (or both); either way one bracket $\to\infty$ while the other stays $\ge-1$, so $f\to\infty$: coercive.
- Conclude. $f$ is continuous and coercive, so by Weierstrass (A2) a global minimum exists. A global min is a local min, so by FONC it is one of the three stationary points. Their values are $0,\ -\tfrac14,\ -\tfrac14$. So both $\pm\big(\tfrac1{\sqrt2},\tfrac1{\sqrt2}\big)$ are global minima, with $f_{\min}=-\tfrac14$. (Practice N1 is the same pattern with $x^4+y^4-4xy$ and the bound $4|xy|\le2(x^2+y^2)$.)
E3. When the Hessian is silent (PSD, singular): test directions
If the Hessian at a stationary point is PSD but singular, SONC holds and SOSC fails, so you must look at $f$ itself.
- $f=x_1^4+x_2^2+\dots+x_n^2$ at 0: Hessian diag$(0,2,\dots,2)$, singular. But $f(x)\gt0$ for every $x\ne0$: strict min. (The $n$-D version of $x^4$; Quiz 1 Q13.)
- Monkey saddle $f=x_1^3-3x_1x_2^2$ at 0: $\nabla f(0)=0$ and $\nabla^2f(0)=0$ (the zero matrix: PSD, so SONC passes trivially). Along $d=(1,0)$: $f(t,0)=t^3$. Along $d=(1,1)$: $f(t,t)=t^3-3t^3=-2t^3$. For $t\gt0$ these have opposite signs, so 0 is neither a min nor a max: a saddle. (Quiz 1 Q14.)
E4. Minimum along every line, but not a minimum (Peano; Tutorial 1, problem 8)
Question. If $x^*$ is a minimum along every straight line through it, must it be a local minimum? (a) It must at least be stationary: each line gives $\varphi'(0)=\nabla f(x^*)^\top d=0$ for all $d$, so $\nabla f(x^*)=0$ (as in the FONC proof). (b) But it need not be a local minimum. He said: the part B is important
.
$f(x_1,x_2)=(x_2-p\,x_1^2)(x_2-q\,x_1^2)$ with constants $0\lt p\lt q$. (The tutorial calls the variables $(y,z)$.) Take $p=1$, $q=2$ for numbers.
- Where is $f$ negative? A product is negative when the two factors have opposite signs: $x_2\gt px_1^2$ but $x_2\lt qx_1^2$. That is the thin region between the two parabolas $x_2=px_1^2$ and $x_2=qx_1^2$. Everywhere else $f\ge0$, and $f(0,0)=0$.
- Every line through 0 has a min at 0. Line $(x_1,x_2)=t\,d$ with $d=(d_1,d_2)$: $\varphi(t)=(d_2t-pd_1^2t^2)(d_2t-qd_1^2t^2)=t^2(d_2-pd_1^2t)(d_2-qd_1^2t)$.
- If $d_2\ne0$: $\varphi(t)=d_2^2t^2+(\text{terms in }t^3,t^4)$, so $\varphi'(0)=0$, $\varphi''(0)=2d_2^2\gt0$: strict min at $t=0$ (1-D SOSC).
- If $d_2=0$ (the horizontal line): $\varphi(t)=pq\,d_1^4t^4\ge0$: min at 0.
- But 0 is not a local min. Walk along the curve $x_2=mx_1^2$ with $p\lt m\lt q$ (between the parabolas): $f=(m-p)(m-q)x_1^4\lt0=f(0,0)$ for every $x_1\ne0$, however close to 0. Numbers: $m=1.5$ gives $f=(0.5)(-0.5)x_1^4=-\tfrac14x_1^4$.
- Why the lines miss it. A line $x_2=mx_1$ near 0 has $|x_2|=|m||x_1|$, much bigger than $qx_1^2$ when $x_1$ is tiny, so near 0 the line is outside the thin region (it only crosses the region further out, for $x_1$ between $m/q$ and $m/p$). A straight line can't follow a parabola into the origin.
- Consistency check with SONC: $\nabla^2f(0)=$ diag$(0,2)$: PSD and singular. So Group N holds (no contradiction: Group N is only necessary, and here it holds at a non-minimum, just like $x^3$), and SOSC fails, as it must, since 0 is not a min. This is exactly the "silent" case.
but other way around is not true.
Show answer
$\nabla f=(2x_1+x_2-3,\ x_1+2x_2)=0$ ⇒ $x_1=-2x_2$, then $-4x_2+x_2=3$ ⇒ $x_2=-1$, $x_1=2$. Hessian $\begin{bmatrix}2&1\\1&2\end{bmatrix}$: $\Delta_1=2$, $\Delta_2=3$ ⇒ PD ⇒ strict local min, $f(2,-1)=4-2+1-6=-3$. It's a quadratic with PD Hessian, so by F2 this is the unique global min.
F. Quadratic functions: the tests become exact
F1. Form, gradient, Hessian
A quadratic function is
$$f(x)=\tfrac12x^\top Qx-b^\top x\ (+\text{ a constant}),$$with $Q$ an $n\times n$ matrix and $b\in\mathbb R^n$. (Quiz 1 questions P11–P12 add a constant to $f$, which they call $r$; on this page $r$ is reserved for the remainder $r(h)$, and a constant never changes where the minimum is.) Only the symmetric part of $Q$ matters, because for the skew part $K=\frac{Q-Q^\top}{2}$ we get $x^\top Kx=0$; so from now on $Q=Q^\top$. Then
$$\nabla f(x)=Qx-b,\qquad \nabla^2f(x)=Q\ \ (\text{the same at every }x).$$The $\tfrac12$ is there precisely so the gradient is $Qx-b$, not $2Qx-b$. Check by a line: $f(x+td)=f(x)+t\,d^\top(Qx-b)+\tfrac12t^2\,d^\top Qd$, exactly, so $\varphi'(0)=\nabla f(x)^\top d$ with $\nabla f=Qx-b$, and $\varphi''(0)=d^\top Qd$.
F2. Why the conditions become "if and only if"
Let $x^*$ be stationary: $Qx^*=b$. Put $x=x^*+h$ in the exact expansion:
$$f(x^*+h)=f(x^*)+\underbrace{(Qx^*-b)^\top h}_{=0}+\tfrac12h^\top Qh=f(x^*)+\tfrac12h^\top Qh\quad\text{for EVERY }h\text{ (not just small ones)}.$$- $Q\succeq0$ ⇒ $\tfrac12h^\top Qh\ge0$ for every $h$ ⇒ $x^*$ is a global min. Conversely if $Q$ is not PSD, some $h$ has $h^\top Qh\lt0$ and $f(x^*+th)\lt f(x^*)$ for all $t\ne0$: not even a local min. So Group N ⇔ min.
- $Q\succ0$ ⇒ $f(x^*+h)\gt f(x^*)$ for every $h\ne0$ ⇒ unique global min. Conversely if $Q$ is PSD but some $h\ne0$ has $h^\top Qh=0$, then $f(x^*+th)=f(x^*)$ for all $t$: not strict. So Group S ⇔ strict min.
F3. The four cases
- (i) $Q\succ0$: unique global minimiser $x^*=Q^{-1}b$.
- (ii) $Q\succeq0$, singular, $b\in$ range$(Q)$: infinitely many global minimisers (all solutions of $Qx=b$: one solution plus anything in null$(Q)$).
- (iii) $Q\succeq0$, singular, $b\notin$ range$(Q)$: no stationary point; $f$ is unbounded below.
- (iv) $Q$ has a negative eigenvalue: unbounded below; no minimiser (any stationary point is a saddle).
- (i) PD. $Q=\begin{bmatrix}3&1\\1&3\end{bmatrix}$ (eigenvalues 2, 4), $b=(5,-1)$. Solve $Qx=b$: $3x_1+x_2=5$, $x_1+3x_2=-1$ ⇒ $x^*=(2,-1)$. Value $f(x^*)=\tfrac12x^{*\top}Qx^*-b^\top x^*=-\tfrac12b^\top x^*=-\tfrac12(10+1)=-\tfrac{11}{2}$ (shortcut valid because $Qx^*=b$).
- (ii) PSD singular, $b$ in range. $f=\tfrac12(x_1+x_2)^2-2x_1-2x_2$: $Q=\begin{bmatrix}1&1\\1&1\end{bmatrix}$, $b=(2,2)=2\cdot(1,1)$, a multiple of a column of $Q$, so $b\in$ range$(Q)$. $Qx=b$ ⇔ $x_1+x_2=2$: the whole line is minimisers, value $\tfrac12\cdot4-4=-2$.
- (iii) PSD singular, $b$ not in range. $f=\tfrac12(x_1+x_2)^2-x_1$: same $Q$, $b=(1,0)$, not a multiple of $(1,1)$. $\nabla f=(x_1+x_2-1,\ x_1+x_2)$ can never be 0 (the two entries differ by 1). Along $(t,-t)$: $f=0-t\to-\infty$.
- (iv) Negative eigenvalue. $f=\tfrac12(x_1^2-x_2^2)$: along $(0,t)$, $f=-\tfrac12t^2\to-\infty$.
Why (iii) and (iv) go to $-\infty$ in general. (iv): if $Qv=\lambda v$ with $\lambda\lt0$, then $f(tv)=\tfrac12\lambda t^2\|v\|^2-t\,b^\top v\to-\infty$ (the $t^2$ term wins). (iii): for symmetric $Q$, range$(Q)$ and null$(Q)$ are perpendicular and together fill $\mathbb R^n$. So split $b=b_R+b_N$ with $b_R\in$ range$(Q)$, $b_N\in$ null$(Q)$; $b\notin$ range means $b_N\ne0$. Then $Qb_N=0$ and $b^\top b_N=\|b_N\|^2$, so $f(tb_N)=-t\|b_N\|^2\to-\infty$.
- "$Q$ singular ⇒ not convex": false. $Q\succeq0$ is convex (H3) even if singular.
- "$Q\succeq0$ ⇒ a minimum exists": false (case iii).
- The iff holds because Taylor is exact for quadratics, not because PSD turns into PD.
Show answer
range$(Q)$ = multiples of $(1,0)$. Minimisers exist iff $b_2=0$. For $b=(4,0)$: $Qx=b$ ⇔ $2x_1=4$ ⇔ $x_1=2$, any $x_2$: the whole line $x_1=2$.
G. Least squares
G1. The problem and the normal equations, derived
Plain words. You have more equations than unknowns, $Ax=\bar b$ with $A$ an $m\times n$ matrix, $m\gt n$ (e.g. fit a line through many points). Usually no $x$ solves all equations, so find the $x$ that makes the misfit $Ax-\bar b$ as short as possible:
$$\min_x\ f(x)=\tfrac12\|Ax-\bar b\|^2 .$$It's a quadratic. Expand $\|Ax-\bar b\|^2=(Ax-\bar b)^\top(Ax-\bar b)=x^\top A^\top Ax-2(A^\top\bar b)^\top x+\|\bar b\|^2$. So
$$f(x)=\tfrac12x^\top\underbrace{(A^\top A)}_{Q}x-\underbrace{(A^\top\bar b)}_{b}{}^\top x+\tfrac12\|\bar b\|^2,\qquad \nabla f(x)=A^\top(Ax-\bar b).$$Setting the gradient to zero gives the normal equations:
$$\boxed{A^\top A\,x^*=A^\top\bar b}$$Always a global min, never case (iii) or (iv). $Q=A^\top A$ is PSD, because $d^\top A^\top Ad=\|Ad\|^2\ge0$. So by F2 every solution of the normal equations is a global minimiser. And a solution always exists, because
$$\text{range}(A^\top A)=\text{range}(A^\top)\quad(\text{Quiz 1 Q28}),$$so $b=A^\top\bar b\in$ range$(Q)$. (Why the identity: we use the linear-algebra fact range$(M^\top)$ = null$(M)^\perp$ for any matrix $M$, i.e. the vectors $M^\top y$ are exactly the vectors perpendicular to every solution of $Mx=0$. Now if $A^\top Ax=0$ then $\|Ax\|^2=x^\top A^\top Ax=0$, so $Ax=0$; hence null$(A^\top A)$ = null$(A)$, and taking perpendicular complements with the fact (once with $M=A^\top A$, which is symmetric, once with $M=A$) gives range$(A^\top A)$ = null$(A^\top A)^\perp$ = null$(A)^\perp$ = range$(A^\top)$.)
G2. When is it unique? Full column rank
$A$ has full column rank when its columns are linearly independent, i.e. $Ad\ne0$ for every $d\ne0$. Then $d^\top A^\top Ad=\|Ad\|^2\gt0$: $A^\top A\succ0$ (case i), so
$$x^*=(A^\top A)^{-1}A^\top\bar b\quad\text{is the unique minimiser.}$$If the columns are dependent, $A^\top A$ is singular and we're in case (ii): infinitely many minimisers, all giving the same fit $Ax^*$. He said: least square solution is always unique. Need not be unique
(i.e. the claim is false). (Pseudo-inverse formulas for that case: he said not asked.)
- Unknowns $x=(c_0,c_1)$. Each point gives one equation $c_0+c_1s_i=$ value$_i$: $A=\begin{bmatrix}1&0\\1&1\\1&2\end{bmatrix}$, $\bar b=(0,1,1)^\top$. The columns are independent ⇒ full column rank ⇒ unique solution.
- $A^\top A=\begin{bmatrix}3&3\\3&5\end{bmatrix}$, $A^\top\bar b=(0+1+1,\ 0+1+2)=(2,3)^\top$.
- $\det(A^\top A)=15-9=6$, so $(A^\top A)^{-1}=\tfrac16\begin{bmatrix}5&-3\\-3&3\end{bmatrix}$ and $x^*=\tfrac16(10-9,\ -6+9)=(1/6,\ 1/2)^\top$. Best line: $\frac16+\frac12s$.
- Residual $\bar b-Ax^*=(0,1,1)-(1/6,\,2/3,\,7/6)=(-1/6,\ 1/3,\ -1/6)^\top$. Check $A^\top(\text{residual})=(-\frac16+\frac13-\frac16,\ \frac13-\frac13)=(0,0)$ ✓. The normal equation says exactly this: the residual is perpendicular to every column of $A$.
G3. The projection picture
With full column rank, the fit is $\hat b=Ax^*=A(A^\top A)^{-1}A^\top\bar b=P\bar b$, where
$$P=A(A^\top A)^{-1}A^\top\quad\text{(orthogonal projector onto range}(A)).$$Properties: $P^2=P$ (projecting twice changes nothing), $P^\top=P$; $I-P$ projects onto null$(A^\top)$ (the perpendicular directions), and the residual is $(I-P)\bar b$. In the example, $P=\tfrac16\begin{bmatrix}5&2&-1\\2&2&2\\-1&2&5\end{bmatrix}$ and $P^2=P$ ✓. He said: The projection expression and the expression for a projection onto the null space. These things you will be using
.
- "The least-squares solution is always unique": false (only with full column rank). But "the normal equations always have a solution": true.
- The projector onto range$(A)$ is $A(A^\top A)^{-1}A^\top$, not $A^\top(AA^\top)^{-1}A$ (when $m\gt n$, $AA^\top$ is $m\times m$ with rank $n\lt m$: singular).
Show answer
$A^\top A=2$, $A^\top\bar b=4$, $x^*=2$ (the mean). $P=\tfrac12\begin{bmatrix}1&1\\1&1\end{bmatrix}$, fit $(2,2)$, residual $(-1,1)$, and $A^\top(-1,1)=0$ ✓.
H. Convexity: when local means global
Everything so far is local. Convexity is the property that makes the local tests give global answers.
H1. The definition: chord above the graph
A convex set $C$: the straight segment between any two of its points stays inside $C$ (a disc is convex; a crescent is not). Points on the segment from $x$ to $y$ are $\theta x+(1-\theta)y$ with $\theta\in[0,1]$ ($\theta=1$ gives $x$, $\theta=0$ gives $y$).
Plain words. A function is convex if, whenever you join two points of its graph by a straight string (a chord), the graph never rises above the string.
$f:C\to\mathbb R$ ($C$ convex) is convex if for all $x,y\in C$ and $\theta\in[0,1]$: $$f(\theta x+(1-\theta)y)\le\theta f(x)+(1-\theta)f(y).$$ Strictly convex: "$\lt$" whenever $x\ne y$ and $0\lt\theta\lt1$. Concave: $-f$ is convex. (Never say "concave set".) Midterm 1 writes the same thing as $f((1-t)x+ty)\le(1-t)f(x)+tf(y)$, $t\in[0,1]$.
Numbers: $f=x^2$, points $-1$ and $3$, $\theta=\tfrac12$: midpoint $1$, $f(1)=1$; chord value $\tfrac12(1)+\tfrac12(9)=5\ge1$ ✓.
Restriction to a line (the same trick as C2): $f$ is convex ⇔ for every point $x$ and direction $d$, the 1-variable function $g(t)=f(x+td)$ is convex. So a single line along which $g$ is not convex (e.g. $g''(t)\lt0$ somewhere) proves $f$ is not convex.
H2. First-order test: the tangent lies below the graph
$f$ convex ⇔ $\ f(y)\ge f(x)+\nabla f(x)^\top(y-x)\ $ for all $x,y$.
Plain words: the right side is the tangent plane at $x$, evaluated at $y$. Convex means every tangent plane is an under-estimator. Numbers: tangent to $x^2$ at $x=1$ is $1+2(y-1)$; at $y=3$ it gives $5\le9=f(3)$ ✓. (Proof of ⇒ is H6, which is Midterm 1 Q VII.)
If $f$ is convex and $\nabla f(x^*)=0$, the inequality reads $f(y)\ge f(x^*)+0$ for every $y$. So for a convex function a stationary point is a global minimum: FONC alone is sufficient. No Hessian needed.
H3. Second-order test: Hessian PSD everywhere
$f$ convex ⇔ $\nabla^2f(x)\succeq0$ for every $x$.
$\nabla^2f(x)\succ0$ for every $x$ ⇒ strictly convex. Not conversely: $x^4$ is strictly convex but $f''(0)=0$.
Contrast with SONC (the classic confusion):
| SONC | Convexity | |
|---|---|---|
| Hessian PSD where? | at one point $x^*$ | at every point |
| It's a property of… | a candidate point | the whole function |
| What it buys | nothing on its own (necessary only) | stationary ⇒ global min |
How to show "not convex": one bad point is enough. Find $x$ where the Hessian has a negative eigenvalue; or a line along which $g''\lt0$; or a midpoint counterexample $f\big(\tfrac{u+v}2\big)\gt\tfrac{f(u)+f(v)}{2}$. Showing "convex" needs all points.
- $e^{x_1}+x_2^2$: Hessian diag$(e^{x_1},2)\succ0$ everywhere ⇒ convex (strictly).
- $x_1^2+4x_1x_2+x_2^2$: Hessian $\begin{bmatrix}2&4\\4&2\end{bmatrix}$, det $=-12\lt0$ ⇒ indefinite ⇒ not convex. Along $(t,-t)$: $t^2-4t^2+t^2=-2t^2$.
- $(x_1^2-x_2^2)^2$ is $\ge0$ but not convex: $u=(1,1)$, $v=(1,-1)$ give $f=0$, midpoint $(1,0)$ gives $1\gt0$. "Nonnegative" has nothing to do with "convex".
H4. Building convex functions without a Hessian: max, and log-sum-exp
Rules that keep convexity: nonnegative weighted sums $\sum\alpha_if_i$ ($\alpha_i\ge0$); adding an affine (linear + constant) term; composing with an affine map, $f(Mx+\text{fixed vector})$; and the pointwise maximum $\max_if_i$. Not kept: products, minimum ($\min\{x^2,(x-2)^2\}$ is $0,1,0$ at $x=0,1,2$: midpoint value 1 exceeds the average 0).
Let $f=\max_if_i$, each $f_i$ convex, and fix $u,v$, $\theta\in[0,1]$. For each $i$:
$$f_i(\theta u+(1-\theta)v)\le\theta f_i(u)+(1-\theta)f_i(v)\le\theta f(u)+(1-\theta)f(v),$$
the second step because $f_i\le f$ and $\theta,1-\theta\ge0$. The right side doesn't depend on $i$, so take the max over $i$ on the left: $f(\theta u+(1-\theta)v)\le\theta f(u)+(1-\theta)f(v)$. ∎
Example: $\max\{x_1^2,x_2^2\}$ is convex though not differentiable where $x_1^2=x_2^2$. He said: this is important. So it talks about an important concept
.
- Let $\sigma_1=\dfrac{e^{x_1}}{e^{x_1}+e^{x_2}}$, $\sigma_2=\dfrac{e^{x_2}}{e^{x_1}+e^{x_2}}$ (positive weights with $\sigma_1+\sigma_2=1$). Then $\nabla f=(\sigma_1,\sigma_2)$.
- Differentiate again: $\partial\sigma_1/\partial x_1=\sigma_1-\sigma_1^2=\sigma_1\sigma_2$ and $\partial\sigma_1/\partial x_2=-\sigma_1\sigma_2$. So $$\nabla^2f=\begin{bmatrix}\sigma_1\sigma_2&-\sigma_1\sigma_2\\-\sigma_1\sigma_2&\sigma_1\sigma_2\end{bmatrix}=\sigma_1\sigma_2\begin{bmatrix}1&-1\\-1&1\end{bmatrix}.$$ At $(0,0)$: $\sigma=(\tfrac12,\tfrac12)$ and $\nabla^2f=\tfrac14\begin{bmatrix}1&-1\\-1&1\end{bmatrix}$.
- $d^\top\nabla^2f\,d=\sigma_1\sigma_2(d_1-d_2)^2\ge0$ for every $d$, at every point ⇒ PSD everywhere ⇒ convex. (In $n$-D: $d^\top\nabla^2f\,d=\sum\sigma_id_i^2-(\sum\sigma_id_i)^2\ge0$ by Cauchy–Schwarz.)
- Not PD: direction $(1,1)$ has zero curvature, and indeed $f(x_1+t,x_2+t)=f(x_1,x_2)+t$ is a straight line. So convex but not strictly convex.
H5. The payoff: every local minimum is global
Suppose $f$ is convex, $x^*$ is a local min, but some $y$ has $f(y)\lt f(x^*)$. Points on the segment, $z_\theta=\theta y+(1-\theta)x^*$, satisfy $$f(z_\theta)\le\theta f(y)+(1-\theta)f(x^*)\lt f(x^*)\quad\text{for every }\theta\in(0,1].$$ As $\theta\to0$, $z_\theta\to x^*$: lower points arbitrarily close to $x^*$. That contradicts "local min". ∎
- Existence: $e^x$ is convex with no minimum.
- Uniqueness: $(x_1+x_2)^2$ is convex with a whole line of minima. Strict convexity gives uniqueness if a minimiser exists.
- Convexity from one point: "PD Hessian at one point" proves nothing about convexity ($x^3$ has $f''(1)=6\gt0$).
H6. The proof chain: convex ⇒ tangent below ⇒ monotone gradient (Midterm 1 Q VII)
Midterm 1 asked this as MCQ steps (Practice MT3–MT7). Learn the chain as a story. Assume $f$ is convex (the definition with $t\in[0,1]$) and differentiable (needed in Step 2). Fix $x,y$ and let $d=y-x$.
- Step 1 (use the definition). $x+td=(1-t)x+ty$, so convexity gives $f(x+td)\le(1-t)f(x)+tf(y)=f(x)+t[f(y)-f(x)]$. Subtract $f(x)$ and divide by $t\gt0$ (direction unchanged): $$R(t)=\frac{f(x+td)-f(x)}{t}\le f(y)-f(x).$$
- Step 2 (let $t\downarrow0$). $R(t)$ is the slope of the chord from $x$ along $d$; as $t\downarrow0$ it becomes the slope in direction $d$: because $f$ is differentiable, $f(x+td)-f(x)=t\nabla f(x)^\top d+o(t)$, so $\lim R(t)=\nabla f(x)^\top d$.
- Step 3 (first-order inequality). So $\nabla f(x)^\top d\le f(y)-f(x)$, i.e. $f(y)\ge f(x)+\nabla f(x)^\top(y-x)$: tangent below the graph.
- Step 4 (swap $x$ and $y$). $f(x)\ge f(y)+\nabla f(y)^\top(x-y)=f(y)-\nabla f(y)^\top d$, i.e. $f(y)-f(x)\le\nabla f(y)^\top d$. (Careful: going from $y$ to $x$ the direction is $-d$.)
- Step 5 (sandwich). $\nabla f(x)^\top d\le f(y)-f(x)\le\nabla f(y)^\top d$, so $$\big(\nabla f(y)-\nabla f(x)\big)^\top(y-x)\ge0\qquad(\textbf{monotone gradient}).$$
Meaning: in 1-D it says $(f'(y)-f'(x))(y-x)\ge0$: if $y\gt x$ then $f'(y)\ge f'(x)$, the slope never decreases, which is exactly "curves upward". Example $f=x^2$: $(2y-2x)(y-x)=2(y-x)^2\ge0$. It is "$\ge$", not "$\gt$": for a linear $f$ it is exactly 0; strict needs strict convexity.
Show answer
(a) Hessian $\begin{bmatrix}2+e^{x_1}&1\\1&2\end{bmatrix}$: $\Delta_1=2+e^{x_1}\gt0$, $\Delta_2=4+2e^{x_1}-1\gt0$ at every point ⇒ PD everywhere ⇒ convex (strictly). (b) It's a global minimiser (H2), by the first-order inequality with $\nabla f=0$.
I. Exam recipe
- MCQ about a statement (most of Quiz 1). Read every word: necessary or sufficient? local, strict or global? $\succeq$ or $\succ$? "at one point" or "for all $x$"? leading or all minors? Then test it against the counterexample bank: $x^4$, $x^3$, $-x^4$, $x_1^4+x_2^2$, monkey saddle, Peano, $e^x$, diag$(0,-1)$, $(x_1^2-x_2^2)^2$.
- "Find and classify the stationary points" (Midterm 1 Q IV, Tutorial 7). Recipe E1: solve $\nabla f=0$ completely → Hessian → PD / ND / indefinite / silent → global question (bounded below? coercive? convex? a direction to $-\infty$?).
- "Convex or not?" (Midterm 1 Q I). Recognise building blocks (sums, max, affine composition) → Hessian PSD at every point (2×2: diagonal $\ge0$ and det $\ge0$ everywhere) → to disprove, one point with a negative eigenvalue, or a line with $g''\lt0$, or a midpoint counterexample.
- Quadratic $\frac12x^\top Qx-b^\top x$: eigenvalues of $Q$ → which of the four cases (F3) → if $Q\succeq0$ singular, check whether $b\in$ range$(Q)$.
- Least squares: normal equations $A^\top Ax=A^\top\bar b$ → unique iff full column rank → projector $A(A^\top A)^{-1}A^\top$; check the residual is perpendicular to the columns.
- Proof steps (Midterm 1 Q VII): definition → chord slope $R(t)\le f(y)-f(x)$ → limit → tangent inequality → swap → monotone gradient.
What the professor said about this
Quotes are from the speech-to-text transcripts of the Chapter 1 lecture recordings (wording is rough). "Ch 1 lec 3 (2025)" = chapter1_2025_for_lec3; "rev" = chapter_rev.
Focus on interpreting SONC… what SONC means, what SONC doesn't mean
Ch 1 lec 2 [1:18:00] → expect the $x^3$ / $x^4$ / $-x^4$ style traps (B4, C5).purely checking concepts… There'll be no problem solving
;Interpretation of theorem and taking concepts
Ch 1 rev [32:00]–[32:30] → (about the revision quiz) Ch 1 MCQs test exact statements.let's say you call it group one, group two
…for quadratic function, both way both directional implications are true
Ch 1 rev [37:30]–[38:00] → Group N necessary, Group S sufficient; both "iff" for quadratics (C5, F2).very important formula that you should remember. We'll use it almost everywhere
Ch 1 lec 1 [1:15:00] → $\frac{d}{dt}f(x^*+td)|_{t=0}=\nabla f(x^*)^\top d$ (C2).looking at the leading principal minors alone is not enough. You have to look at all principal minors
Ch 1 lec 3 (2025) [28:00] → PSD test (D3).least square solution is always unique. Need not be unique
Ch 1 lec 3 (2025) [42:00];The projection expression and the expression for a projection onto the null space. These things you will be using
[51:30] (G).the part B is important
Ch 1 tutorial [22:30] → the Peano counterexample (E4).this is important. So it talks about an important concept
Ch 1 tutorial [55:30] → max of convex functions is convex (proof without Hessian, H4).- The convexity proofs lecture: if $x^*$ is a minimum all line restrictions have a minimum,
but other way around is not true
convexity-proofs lecture [1:09:30] (E4).
- Ch 1 was asked in Quiz 1 (all 32 MCQs), Midterm 1 Q I (convexity check), Q IV (classify stationary points of $\tfrac14\|zz^\top-M\|_F^2$), Q VII (convexity proof steps).
- Final exam: "same level" as the midterms; MCQ groups built as guided proof steps are likely; quizzes used +1/−¼ marking, so don't guess blindly.
- Skip: pseudo-inverse / rank-deficient formulas, strong-convexity problems.
Practice (try first, then open the answer)
31 questions: 15 Quiz 1 MCQs and 7 Midterm 1 parts (past papers), then 9 new ones in his style. Each answer explains why every wrong option is wrong. Do MT2 (Midterm 1 Q IV) and N1 fully on paper.
Quiz 1 (past paper, Ch 1): 15 selected MCQs
For $f(x)=x^4$, which statement is true at $x^*=0$?
- (a) FONC fails.
- (b) SONC fails.
- (c) SOSC holds.
- (d) $x^*=0$ is a strict local minimum although SOSC does not hold.
Show answer
Answer: (d). $f'(0)=0$ (FONC ✓), $f''(0)=0\ge0$ (SONC ✓), $f''(0)\not\gt0$ (SOSC ✗), yet $x^4\gt0$ for $x\ne0$: strict min. (a), (b) wrong since both hold; (c) wrong since $f''(0)=0$. Lesson: SOSC is not necessary.
For $f(x)=x^3$, at $x=0$ we have $f'(0)=f''(0)=0$. What is the correct conclusion?
- (a) 0 is a strict local minimum.
- (b) 0 is a local maximum.
- (c) 0 is a stationary inflection point.
- (d) SOSC holds at 0.
Show answer
Answer: (c). $x^3\lt0$ for $x\lt0$ and $\gt0$ for $x\gt0$, so neither min (a) nor max (b). SOSC needs $f''(0)\gt0$ (d ✗). FONC and SONC both hold: they are not sufficient.
For positive weights $w_i$, the minimiser of $f(x)=\sum_{i=1}^n w_i(x-y_i)^2$ is
- (a) $\frac1n\sum y_i$
- (b) $\sum w_iy_i$
- (c) $\sum w_iy_i/\sum w_i$
- (d) $\sum y_i/\sum w_i$
Show answer
Answer: (c). $f'(x)=2\sum w_i(x-y_i)=0\Rightarrow x^*=\sum w_iy_i/\sum w_i$; $f''=2\sum w_i\gt0$ so it is the unique min. (a) is the unweighted case only; (b), (d) are not even unchanged when all $w_i$ are scaled by 2, which the true answer must be.
The notation $r(h)=o(h^2)$ $(h\to0)$ means
- (a) $r(h)=h^2$ for all sufficiently small $h$.
- (b) $r(h)/h^2\to0$.
- (c) $h^2/r(h)\to0$.
- (d) $r(h)$ is always positive near 0.
Show answer
Answer: (b). $r$ goes to zero faster than $h^2$. (c) says the opposite ($r$ much bigger than $h^2$); (a) and (d) say nothing about the rate; $o(h^2)$ can have any sign.
At a stationary point $x^*$, $f(x^*+h)-f(x^*)=\tfrac12f''(x^*)h^2+o(h^2)$. If $f''(x^*)\lt0$, what follows?
- (a) $x^*$ can still be a local minimum because the remainder may dominate.
- (b) $x^*$ cannot be a local minimum.
- (c) $x^*$ must be a strict local minimum.
- (d) No conclusion is possible even locally.
Show answer
Answer: (b). Divide by $h^2$: $\frac{f(x^*+h)-f(x^*)}{h^2}\to\tfrac12 f''(x^*)\lt0$, so the difference is negative for small $h\ne0$. (This is SONC.) (a) is wrong because $o(h^2)/h^2\to0$, the remainder cannot dominate a nonzero quadratic term. (c) opposite; (d) wrong, it is in fact a strict local max.
For $\phi(t)=f(x^*+td)$, with $f$ differentiable at $x^*$, $\phi'(0)$ is
- (a) $d^\top\nabla^2f(x^*)d$
- (b) $\nabla f(x^*)^\top d$
- (c) $\|\nabla f(x^*)\|_2^2$
- (d) $\nabla f(x^*)+d$
Show answer
Answer: (b) (chain rule). (a) is $\phi''(0)$; (c) is the special case $d=\nabla f$; (d) is a vector, not a number.
For $f(x)=x_1^4+x_2^2+\dots+x_n^2$, at 0:
- (a) The Hessian is indefinite, so 0 is a saddle.
- (b) The Hessian is positive definite.
- (c) The Hessian is PSD but singular, and 0 is nevertheless a strict local minimum.
- (d) The Hessian is PSD and singular, and so 0 is a non-strict local minimum.
Show answer
Answer: (c). $\nabla^2f(0)=\text{diag}(0,2,\dots,2)$: PSD, singular, not indefinite (a ✗), not PD (b ✗). $f(x)\gt0$ for every $x\ne0$, so strict min. (d) wrongly infers "non-strict" from singularity: a singular Hessian decides nothing.
For $f(x_1,x_2)=x_1^3-3x_1x_2^2$, which pair of directions demonstrates saddle behaviour at the origin for $t\gt0$ (evaluate $f(td)$)?
- (a) $(1,0)$ and $(0,1)$, because both give positive values.
- (b) $(1,0)$ and $(1,1)$, because they give values of opposite sign.
- (c) $(1,1)$ and $(-1,-1)$, because both give zero values.
- (d) $(0,1)$ and $(0,-1)$, because both give negative values.
Show answer
Answer: (b). $f(t,0)=t^3\gt0$, $f(t,t)=t^3-3t^3=-2t^3\lt0$: values above and below $f(0)=0$ ⇒ saddle. (a) $f(0,t)=0$, not positive; (c) $f(-t,-t)=2t^3\ne0$; (d) $f(0,\pm t)=0$. Here $\nabla^2 f(0)=0$, so the Hessian test is useless; directions decide.
Under the coercive version of the Weierstrass theorem, which assumptions guarantee a minimiser of $f$ over $X$?
- (a) $X$ open, $f$ differentiable and bounded below.
- (b) $X$ nonempty and closed; $f$ proper, lower semicontinuous and coercive; $X\cap\text{dom}f\ne\emptyset$.
- (c) $X$ bounded; $f$ differentiable and convex.
- (d) $X=\mathbb R^n$ and $\nabla f(x)=0$ somewhere.
Show answer
Answer: (b), Theorem 1.3.1 word for word. (a) $e^x$ on $\mathbb R$ is bounded below with no min; (c) $X$ bounded but not closed, e.g. $f=x$ on $(0,1)$; (d) $x^3$ has $f'(0)=0$ and no min.
For positive semidefiniteness of a real symmetric matrix, which is correct?
- (a) It is enough to check only the leading principal minors.
- (b) All principal minors must be nonnegative.
- (c) The determinant alone must be positive.
- (d) All off-diagonal entries must vanish.
Show answer
Answer: (b). (a) fails for diag$(0,-1)$ (leading minors 0, 0). (c) a PSD matrix can have det 0; diag$(-1,-1)$ has det $1\gt0$ and is not PSD. (d) $\begin{bmatrix}1&1\\1&1\end{bmatrix}$ is PSD.
$f(x)=\tfrac12x^\top Qx-b^\top x+r$, $Q=Q^\top\succeq0$, $Q$ singular, and $b\in\text{range}(Q)$. Which is correct?
- (a) There is a unique global minimiser.
- (b) There are infinitely many global minimisers.
- (c) The function is necessarily unbounded below.
- (d) No stationary point exists.
Show answer
Answer: (b). $b\in$ range$(Q)$ ⇒ $Qx=b$ has a solution $x_0$, and $x_0+n$ for every $n\in$ null$(Q)\ne\{0\}$ also solves it. $Q\succeq0$ ⇒ convex ⇒ every stationary point is a global min. (a) needs $Q\succ0$; (c), (d) describe $b\notin$ range$(Q)$.
If symmetric $Q$ has a negative eigenvalue, then $f(x)=\tfrac12x^\top Qx-b^\top x+r$ is
- (a) necessarily bounded below.
- (b) necessarily strictly convex.
- (c) unbounded below.
- (d) constant along every eigenvector.
Show answer
Answer: (c). With $Qv=\lambda v$, $\lambda\lt0$: $f(tv)=\tfrac12\lambda t^2\|v\|^2-t\,b^\top v+r\to-\infty$. (a) opposite; (b) Hessian not PSD so not even convex; (d) false, the quadratic term $\tfrac12\lambda t^2$ changes.
For a full-column-rank $m\times n$ matrix $A$, $m\gt n$, the orthogonal projector onto range$(A)$ is
- (a) $A^\top(AA^\top)^{-1}A$
- (b) $A(A^\top A)^{-1}A^\top$
- (c) $(A^\top A)^{-1}$
- (d) $I-A(A^\top A)^{-1}A^\top$
Show answer
Answer: (b). (a) $AA^\top$ is $m\times m$ of rank $n\lt m$, singular: does not exist. (c) is $n\times n$, wrong size. (d) projects onto null$(A^\top)$, the orthogonal complement.
Which identity is true for every real matrix $A$?
- (a) range$(A^\top A)$ = null$(A)$
- (b) range$(A^\top A)$ = range$(A^\top)$
- (c) range$(A^\top A)=\mathbb R^n$
- (d) range$(A^\top A)$ = null$(A^\top A)$
Show answer
Answer: (b). This is why the normal equations $A^\top Ax=A^\top\bar b$ always have a solution. (c) only with full column rank; (a), (d) mix up range and null space (they are orthogonal complements, not equal).
$f\in C^2(\mathbb R^n)$. Which condition is equivalent to convexity on $\mathbb R^n$?
- (a) $\nabla^2 f(x)\succ0$ at one point.
- (b) $\nabla^2f(x)\succeq0$ for every $x\in\mathbb R^n$.
- (c) $\nabla f(x)=0$ for every $x$.
- (d) $\det\nabla^2f(x)\gt0$ for every $x$.
Show answer
Answer: (b). (a) one point says nothing ($x^3$ has $f''(1)\gt0$). (c) only constants. (d) $-\|x\|^2$ in 2-D has Hessian $-2I$, det $4\gt0$, concave.
Other Quiz 1 items (Q1, 2, 5, 9, 11, 12, 15, 17–19, 21, 22, 25, 26, 29–31) are direct statements covered in sections B–H and the Summary card. Answer key: 1C 2A 3D 4C 5B 6C 7B 8B 9A 10B 11B 12A 13C 14B 15B 16B 17A 18B 19B 20B 21A 22B 23B 24C 25B 26A 27B 28B 29A 30B 31B 32B.
Midterm 1 (past paper): Q I, Q IV, Q VII
Determine whether each function is convex on $\mathbb R^2$. Justify.
(1) $f_1=(x_1+x_2)^2$ (2) $f_2=x_1^2+4x_1x_2+x_2^2$ (3) $f_3=e^{x_1}+x_2^2$ (4) $f_4=x_1^4+x_2^4-2x_1^2x_2^2$.
Hint
Hessian PSD at every point? For (4) notice $f_4=(x_1^2-x_2^2)^2\ge0$, but that is irrelevant; try the midpoint of $(1,1)$ and $(1,-1)$.
Show answer
Test: $f\in C^2$ is convex ⇔ $\nabla^2 f(x)\succeq0$ for every $x$. 5 marks each.
- $\nabla^2f_1=\begin{bmatrix}2&2\\2&2\end{bmatrix}$, $v^\top\nabla^2f_1v=2(v_1+v_2)^2\ge0$ ⇒ convex (eigenvalues 0, 4; not strictly convex: constant on lines $x_1+x_2=c$).
- $\nabla^2f_2=\begin{bmatrix}2&4\\4&2\end{bmatrix}$, eigenvalues $6,-2$ ($(1,-1)$ has eigenvalue $-2$; det $=-12\lt0$) ⇒ not convex. Restriction $x=(t,-t)$: $f_2=-2t^2$.
- $\nabla^2f_3=\text{diag}(e^{x_1},2)$, $v^\top\nabla^2 f_3 v=e^{x_1}v_1^2+2v_2^2\gt0$ for $v\ne0$ ⇒ convex (strictly). No uniform lower bound is needed.
- $u=(1,1)$, $v=(1,-1)$: $f_4(u)=f_4(v)=0$, but $f_4(\tfrac{u+v}2)=f_4(1,0)=1\gt0=\tfrac{f_4(u)+f_4(v)}2$ ⇒ not convex. Hessian route: $\nabla^2f_4=\begin{bmatrix}12x_1^2-4x_2^2&-8x_1x_2\\-8x_1x_2&12x_2^2-4x_1^2\end{bmatrix}$, at $(1,0)$ it is diag$(12,-4)$, indefinite. One bad point is enough.
$M\in\mathbb R^{n\times n}$ ($n\ge2$) symmetric PD with distinct eigenvalues $0\lt\lambda_1\lt\dots\lt\lambda_n$, orthonormal eigenvectors $q_1,\dots,q_n$. $\min_z f(z)=\tfrac14\|zz^\top-M\|_F^2$.
(1) Derive $\nabla f$ and $\nabla^2 f$. (2) Find all stationary points. (3) Hessian eigenvalues at each; classify (strict local min / strict local max / saddle). (4) Gradient descent from $z_0=0$ with any fixed step: what happens, and what does it say about "zero gradient" as a stopping test?
Hint
Expand with $\|A\|_F^2=\text{tr}(A^\top A)$: $f=\tfrac14(z^\top z)^2-\tfrac12z^\top Mz+\tfrac14\text{tr}(M^2)$. At $z=\pm\sqrt{\lambda_i}q_i$, apply the Hessian to each $q_j$.
Show answer
- (1) [5] $\|zz^\top-M\|_F^2=(z^\top z)^2-2z^\top Mz+\text{tr}(M^2)$. With $r^2=z^\top z$: $\nabla f(z)=(r^2I-M)z$. Differentiating $r^2z$ in direction $h$ gives $2(z^\top h)z+r^2h$, so $\nabla^2f(z)=r^2I+2zz^\top-M$.
- (2) [4] $(\|z\|^2I-M)z=0$. Either $z=0$, or $Mz=\|z\|^2z$: $z$ is an eigenvector, $z=cq_i$, and $\lambda_ic=c^3\Rightarrow c^2=\lambda_i$. Stationary set ($2n+1$ points): $0$ and $\pm\sqrt{\lambda_i}\,q_i$, $i=1,\dots,n$.
- (3) [8] At 0: $\nabla^2f(0)=-M$, eigenvalues $-\lambda_1,\dots,-\lambda_n\lt0$ ⇒ negative definite ⇒ strict local max.
At $\pm\sqrt{\lambda_i}q_i$: $\nabla^2f=\lambda_iI+2\lambda_iq_iq_i^\top-M$. On $q_i$: $(\lambda_i+2\lambda_i-\lambda_i)q_i=2\lambda_iq_i$. On $q_j$ ($j\ne i$): $(\lambda_i-\lambda_j)q_j$. Spectrum $\{2\lambda_i\}\cup\{\lambda_i-\lambda_j: j\ne i\}$.
$i=n$: all positive ⇒ $\pm\sqrt{\lambda_n}q_n$ are strict local minima (also the global minima, $f_{\min}=\tfrac14\sum_{j\lt n}\lambda_j^2$).
$i\lt n$: $2\lambda_i\gt0$ and $\lambda_i-\lambda_n\lt0$ ⇒ saddle points. - (4) [3] $\nabla f(0)=0$ ⇒ $z_1=0-\alpha\cdot0=0$, so $z_k=0$ for all $k$: GD sits forever at a strict local max. Zero gradient is only FONC; on a nonconvex problem it certifies neither a local nor a global min.
Checked numerically with $n=3$, $\lambda=(1,2,5)$: Hessian spectra $\{-4,-1,2\}$, $\{-3,1,4\}$, $\{3,4,10\}$, and $\{-5,-2,-1\}$ at 0.
Midterm 1 Q VII (guided proof, MCQ steps). $f:\mathbb R^n\to\mathbb R$ differentiable with $f((1-t)x+ty)\le(1-t)f(x)+tf(y)$ for all $x,y$, $t\in[0,1]$. Fix $x,y$, $d=y-x$.
For $0\lt t\le1$, $R(t)=\dfrac{f(x+td)-f(x)}{t}$. Which bound follows from the given inequality?
- (a) $R(t)\ge f(y)-f(x)$
- (b) $R(t)\le t[f(y)-f(x)]$
- (c) $R(t)\le f(y)-f(x)$
- (d) $R(t)\ge t[f(y)-f(x)]$
Show answer
Answer: (c). $x+td=(1-t)x+ty$, so $f(x+td)\le f(x)+t[f(y)-f(x)]$. Subtract $f(x)$, divide by $t\gt0$ (direction kept). (a), (d) have the wrong direction; (b) forgot to divide by $t$.
Evaluate $\lim_{t\downarrow0}R(t)$.
Show answer
$\nabla f(x)^\top d$. Differentiability: $f(x+td)-f(x)=t\nabla f(x)^\top d+o(t)$; divide by $t$, the $o(t)/t\to0$.
Which inequality follows from parts (1) and (2)?
- (a) $f(y)-f(x)\ge\nabla f(x)^\top d$
- (b) $f(y)-f(x)\le\nabla f(x)^\top d$
- (c) $f(y)-f(x)\ge\nabla f(y)^\top d$
- (d) $f(y)-f(x)\le-\nabla f(x)^\top d$
Show answer
Answer: (a). $R(t)\le f(y)-f(x)$ for every $t$; let $t\downarrow0$: $\nabla f(x)^\top d\le f(y)-f(x)$. This is the first-order inequality (tangent below graph). (c) has the gradient at the wrong point.
Repeat with $x$ and $y$ interchanged. Which inequality results?
- (a) $f(y)-f(x)\le-\nabla f(y)^\top d$
- (b) $f(y)-f(x)\ge\nabla f(y)^\top d$
- (c) $f(y)-f(x)\ge-\nabla f(y)^\top d$
- (d) $f(y)-f(x)\le\nabla f(y)^\top d$
Show answer
Answer: (d). Swapped: $f(x)-f(y)\ge\nabla f(y)^\top(x-y)=-\nabla f(y)^\top d$. Multiply by $-1$ (flips): $f(y)-f(x)\le\nabla f(y)^\top d$. Careful: the direction is now $x-y=-d$.
What follows from parts (3) and (4)?
- (a) $(\nabla f(y)-\nabla f(x))^\top(y-x)=0$
- (b) $(\nabla f(y)-\nabla f(x))^\top(y-x)\ge0$
- (c) $(\nabla f(y)-\nabla f(x))^\top(y-x)\le0$
- (d) $(\nabla f(y)-\nabla f(x))^\top(y-x)\gt0$ whenever $x\ne y$
Show answer
Answer: (b) (monotone gradient). $\nabla f(x)^\top d\le f(y)-f(x)\le\nabla f(y)^\top d$, subtract the outer terms. (d) is strict: that needs strict convexity, not given (e.g. $f$ linear gives 0). (a) only for affine $f$; (c) wrong sign.
New questions in his style
$f(x,y)=x^4+y^4-4xy$. (a) Find all stationary points. (b) Classify each using the Hessian. (c) Which are global minima? Justify existence.
Hint
From $\nabla f=0$: $y=x^3$ and $x=y^3$ ⇒ $x^9=x$.
Show answer
- $\nabla f=(4x^3-4y,\ 4y^3-4x)=0$ ⇒ $y=x^3$, $x=y^3=x^9$ ⇒ $x(x^8-1)=0$ ⇒ $x\in\{0,1,-1\}$ (real). Points: $(0,0)$, $(1,1)$, $(-1,-1)$.
- $\nabla^2f=\begin{bmatrix}12x^2&-4\\-4&12y^2\end{bmatrix}$.
- $(0,0)$: $\begin{bmatrix}0&-4\\-4&0\end{bmatrix}$, eigenvalues $\pm4$ (det $=-16\lt0$) ⇒ indefinite ⇒ saddle. (Check: $f(t,t)=2t^4-4t^2\lt0$, $f(t,-t)=2t^4+4t^2\gt0$ near 0.)
- $(\pm1,\pm1)$ (same signs): $\begin{bmatrix}12&-4\\-4&12\end{bmatrix}$, leading minors $12\gt0$, $144-16=128\gt0$ ⇒ PD (eigenvalues 8, 16) ⇒ SOSC ⇒ strict local minima, $f=-2$.
- Global: $f\ge x^4+y^4-2(x^2+y^2)\to+\infty$ (since $4|xy|\le2(x^2+y^2)$), so $f$ is continuous and coercive ⇒ by Weierstrass a global min exists; it must be a stationary point; the smallest stationary value is $-2$ ⇒ both $(1,1)$ and $(-1,-1)$ are global minima. Note $f$ is not convex (Hessian indefinite at 0), yet it has two global minima.
Convex on $\mathbb R^2$ or not? Justify. (a) $g_1=e^{x+y}+x^2-xy+y^2$. (b) $g_2=x^4-x^2y^2+y^4$. (c) $g_3=\max\{x+y,\ x^2+y^2,\ e^{x}\}$.
Hint
(a) Hessian = rank-one PSD part + constant part. (b) restrict to the line $y=1$. (c) no Hessian.
Show answer
- (a) $\nabla^2g_1=e^{x+y}\begin{bmatrix}1&1\\1&1\end{bmatrix}+\begin{bmatrix}2&-1\\-1&2\end{bmatrix}$. Leading minors: $e^{x+y}+2\gt0$, det $=(e^{x+y}+2)^2-(e^{x+y}-1)^2=6e^{x+y}+3\gt0$ ⇒ PD at every point ⇒ convex (strictly).
- (b) Restriction to the line $y=1$: $h(t)=g_2(t,1)=t^4-t^2+1$, $h''(0)=-2\lt0$ ⇒ a line restriction is not convex ⇒ not convex. Midpoint check: $u=(\tfrac1{\sqrt2},1)$, $v=(-\tfrac1{\sqrt2},1)$: $g_2(u)=g_2(v)=\tfrac14-\tfrac12+1=\tfrac34$, midpoint $(0,1)$: $g_2=1\gt\tfrac34$. Hessian route: $\nabla^2g_2(0,1)=\text{diag}(-2,12)$, indefinite. ($g_2\ge0$ everywhere is irrelevant.)
- (c) $x+y$ (affine), $x^2+y^2$ (Hessian $2I$), $e^x$ (Hessian diag$(e^x,0)\succeq0$) are convex; the pointwise max of convex functions is convex (proof in H4). Not differentiable everywhere, so the Hessian test cannot be used directly.
(a) $A=\begin{bmatrix}1&2\\2&4\\3&6\end{bmatrix}$, $\bar b=(1,0,1)^\top$. Is the least-squares solution of $\min\tfrac12\|Ax-\bar b\|^2$ unique? Find all solutions. Why must a solution exist?
(b) $A=\begin{bmatrix}1&0\\1&1\\1&2\end{bmatrix}$, $\bar b=(1,2,4)^\top$. Find $x^*$, the projector $P$ onto range$(A)$, and verify the residual is orthogonal to range$(A)$.
Hint
(a) column 2 = 2 × column 1. (b) $(A^\top A)^{-1}$ of $\begin{bmatrix}3&3\\3&5\end{bmatrix}$ is $\tfrac16\begin{bmatrix}5&-3\\-3&3\end{bmatrix}$.
Show answer
- (a) Rank 1, not full column rank ⇒ not unique. $A^\top A=\begin{bmatrix}14&28\\28&56\end{bmatrix}$, $A^\top\bar b=(4,8)^\top$. Both rows give $14(x_1+2x_2)=4$ ⇒ solution set: the line $x_1+2x_2=\tfrac27$ (infinitely many). Every one gives the same fit $Ax=\tfrac27(1,2,3)^\top$ and residual $(5/7,-4/7,1/7)^\top$, with $A^\top(\text{residual})=0$. Existence: range$(A^\top A)$ = range$(A^\top)\ni A^\top\bar b$, so the normal equations are always consistent. (This is Quiz 1 Q23: $Q=A^\top A\succeq0$ singular, $b=A^\top\bar b\in$ range$(Q)$.)
- (b) Full column rank ⇒ $A^\top A\succ0$ ⇒ SOSC, unique. $A^\top A=\begin{bmatrix}3&3\\3&5\end{bmatrix}$, $A^\top\bar b=(7,10)^\top$, $x^*=\tfrac16(35-30,\ -21+30)=(5/6,\ 3/2)^\top$.
- $P=A(A^\top A)^{-1}A^\top=\tfrac16\begin{bmatrix}5&2&-1\\2&2&2\\-1&2&5\end{bmatrix}$ (symmetric, $P^2=P$). $\hat b=P\bar b=Ax^*=(5/6,\ 7/3,\ 23/6)^\top$.
- Residual $\bar b-\hat b=(1/6,\ -1/3,\ 1/6)^\top$; $A^\top(\bar b-\hat b)=(1/6-1/3+1/6,\ -1/3+1/3)=(0,0)$ ✓ orthogonal to both columns. Minimum value $\tfrac12\|\text{res}\|^2=\tfrac1{12}$.
$f\in C^2(\mathbb R^n)$, $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succeq0$ (singular). What can be concluded?
- (a) $x^*$ is a local minimum (SONC holds).
- (b) $x^*$ is at least not a local maximum.
- (c) Nothing from these conditions alone: $x^*$ may be a local min, a saddle-type point, or even a strict local max.
- (d) $x^*$ is a local minimum or a saddle point, never a maximum.
Show answer
Answer: (c). 1-D examples at 0: $x^4$ (min), $x^3$ (neither), $-x^4$ (strict local max, $f''(0)=0\ge0$). So (a) reverses a necessary condition; (b) and (d) are killed by $-x^4$. SONC is only useful the other way: a negative Hessian eigenvalue rules out a min.
$x^*$ is a strict local minimum of $f\in C^2(\mathbb R^n)$. Which must hold?
- (a) $\nabla^2 f(x^*)\succ0$
- (b) $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succeq0$
- (c) $\nabla^2 f(x^*)$ is nonsingular
- (d) $f$ is convex near $x^*$
Show answer
Answer: (b): a strict local min is a local min, so SONC applies. (a), (c): $x_1^4+x_2^2$ has a strict min at 0 with Hessian diag$(0,2)$ (singular, not PD). (d): $f=x^4+y^4-\tfrac32x^2y^2=(x^2-y^2)^2+\tfrac12x^2y^2$ is $\gt0$ for $(x,y)\ne0$ (strict min at 0), but $\nabla^2f(t,0)=\text{diag}(12t^2,-3t^2)$ is indefinite for every $t\ne0$, so $f$ is not convex on any neighbourhood of 0. Strictness is about values; convexity is about curvature everywhere. If $f$ were quadratic, (a) would also be necessary (Group S ⇔ strict min).
$f(x)=\tfrac12x^\top Qx-b^\top x$ with $Q=\begin{bmatrix}2&0\\0&0\end{bmatrix}$, $b=(2,1)^\top$. Then
- (a) $x^*=(1,0)$ is the unique minimiser.
- (b) every point $(1,t)$ is a global minimiser.
- (c) $f$ is not convex because $Q$ is singular.
- (d) $f$ is convex, has no stationary point, and is unbounded below.
Show answer
Answer: (d). $f=x_1^2-2x_1-x_2$. $\nabla f=(2x_1-2,\ -1)\ne0$ always: $b\notin$ range$(Q)$ = span$\{e_1\}$. Along $x_2\to+\infty$, $f\to-\infty$. $Q\succeq0$ ⇒ convex (c ✗: singular ≠ not convex). (b) would be right for $b=(2,0)$: then $f=x_1^2-2x_1$ and the whole line $x_1=1$ minimises. (a) needs $Q\succ0$.
$S=\begin{bmatrix}1&2&0\\2&4&0\\0&0&-1\end{bmatrix}$. Which is correct?
- (a) $S\succeq0$, because its leading principal minors $1,0,0$ are all $\ge0$.
- (b) $S\succ0$, because $\Delta_1=1\gt0$.
- (c) $S$ is not PSD, because the principal minor in position $(3,3)$ equals $-1$.
- (d) $S\succeq0$, because $\det S=0$.
Show answer
Answer: (c). PSD needs all principal minors $\ge0$; the $1\times1$ minor $s_{33}=-1$ fails, and $d=(0,0,1)$ gives $d^\top Sd=-1$. Eigenvalues are $-1,0,5$ (indefinite). (a) is the leading-minor trap (D3). (b) PD needs all leading minors $\gt0$, and $\Delta_2=0$. (d) a zero determinant says nothing about the signs of the other eigenvalues.
Which function on $\mathbb R^2$ is coercive (so a global minimum is guaranteed by Weierstrass)?
- (a) $e^{x_1}+x_2^2$
- (b) $x_1^2+x_2^2-4x_1$
- (c) $(x_1-x_2)^2$
- (d) $x_1^3+x_2^2$
Show answer
Answer: (b). $x_1^2+x_2^2-4x_1=(x_1-2)^2+x_2^2-4\to\infty$ as $\|x\|\to\infty$; minimum $-4$ at $(2,0)$. (a) along $x_2=0$, $x_1\to-\infty$ the value tends to 0, not $\infty$ (and no minimum exists). (c) it stays 0 along the whole line $x_1=x_2$ (it does have minima: coercive is sufficient, not necessary). (d) $x_1\to-\infty$ gives $-\infty$.
$f(x_1,x_2)=x_1^3+x_2^3-3x_1x_2$ (section E2). Which is correct?
- (a) $(1,1)$ is a strict local minimum but $f$ has no global minimum.
- (b) $(1,1)$ is the global minimum, since it is the only point where SOSC holds.
- (c) $(0,0)$ is a local minimum because $\nabla f(0,0)=0$.
- (d) $f$ is convex, so its stationary points are global minima.
Show answer
Answer: (a). At $(1,1)$ the Hessian $\begin{bmatrix}6&-3\\-3&6\end{bmatrix}\succ0$ (SOSC), but $f(t,0)=t^3\to-\infty$ as $t\to-\infty$. (b) "only SOSC point" does not make it global. (c) $\nabla f=0$ is only necessary; the Hessian there has det $-9\lt0$: saddle. (d) the Hessian at $(0,0)$ is indefinite, so $f$ is not convex.
Self-test (no looking)
State FONC, SONC and SOSC exactly (hypotheses on $f$, which are necessary, which sufficient, what kind of minimum).
Show answer
FONC: $f$ differentiable, $x^*$ local min ⇒ $\nabla f(x^*)=0$. SONC: $f\in C^2$, local min ⇒ $\nabla f(x^*)=0$, $\nabla^2f(x^*)\succeq0$. SOSC: $f\in C^2$, $\nabla f(x^*)=0$, $\nabla^2f(x^*)\succ0$ ⇒ strict local min. First two necessary, third sufficient.
What does each of $x^4$, $x^3$, $-x^4$ at 0 show? For which class of functions are Group N and Group S "if and only if", and why?
Show answer
$x^4$: strict min without SOSC (PD not necessary). $x^3$: FONC+SONC, not a min. $-x^4$: FONC+SONC, strict max. Quadratics: Taylor is exact (constant Hessian, no $o(\|h\|^2)$ remainder), so Group N ⇔ min, Group S ⇔ strict min.
PD test by minors vs PSD test by minors. Give a matrix showing the difference.
Show answer
PD ⇔ leading principal minors all $\gt0$. PSD ⇔ all principal minors $\ge0$. diag$(0,-1)$: leading minors 0, 0 but not PSD.
Least squares: normal equations, when unique, $x^*$, projector, and why a solution always exists.
Show answer
$A^\top Ax=A^\top\bar b$; unique ⇔ full column rank; $x^*=(A^\top A)^{-1}A^\top\bar b$; $P=A(A^\top A)^{-1}A^\top$, $I-P$ onto null$(A^\top)$; exists since range$(A^\top A)$ = range$(A^\top)$.
Three equivalent characterisations of convexity for $C^2$ $f$ on $\mathbb R^n$; how does the Hessian one differ from SONC? Write the 4-step chain from the definition to monotone gradient.
Show answer
Definition (chord above); $f(y)\ge f(x)+\nabla f(x)^\top(y-x)$; $\nabla^2f(x)\succeq0$ for every $x$ (SONC: at one point). Chain: $R(t)\le f(y)-f(x)$ → limit $\nabla f(x)^\top d\le f(y)-f(x)$ → swap: $f(y)-f(x)\le\nabla f(y)^\top d$ → $(\nabla f(y)-\nabla f(x))^\top(y-x)\ge0$.
Write the Peano function and the curve that shows 0 is not a local min. State the coercive Weierstrass theorem.
Show answer
$f=(x_2-px_1^2)(x_2-qx_1^2)$, $0\lt p\lt q$ (the tutorial writes $(z-py^2)(z-qy^2)$); along the curve $x_2=mx_1^2$, $p\lt m\lt q$: $f=(m-p)(m-q)x_1^4\lt0$. Every line $t(d_1,d_2)$ through 0 has a min at 0 ($\varphi''(0)=2d_2^2\gt0$ if $d_2\ne0$, or $\varphi=pqd_1^4t^4$ if $d_2=0$). Weierstrass: $X$ nonempty closed, $f$ proper, lsc, coercive, $X\cap\text{dom}f\ne\emptyset$ ⇒ minimiser exists (set nonempty, compact).
$f=\tfrac12x^\top Qx-b^\top x$: list the four cases for $Q$ and $b$ and what happens in each.
Show answer
$Q\succ0$: unique global min $Q^{-1}b$. $Q\succeq0$ singular, $b\in$ range$(Q)$: infinitely many global minima (the solutions of $Qx=b$). $Q\succeq0$ singular, $b\notin$ range$(Q)$: no stationary point, unbounded below. $Q$ with a negative eigenvalue: unbounded below.
Summary card (for revision; the formula sheet copies this)
Symbols: $f:\mathbb R^n\to\mathbb R$ the cost; $x^*$ the point tested; $d$ a direction, $t$ a number; $\nabla f$ gradient (first partials), $\nabla^2 f$ Hessian (second partials); $S$ a symmetric matrix, $\lambda$ its eigenvalues; $\succeq0$ PSD ($d^\top Sd\ge0$ all $d$), $\succ0$ PD ($d^\top Sd\gt0$ all $d\ne0$); $Q,b$ data of a quadratic; $A,\bar b$ data of least squares; $P$ projector; $\theta\in[0,1]$ mixing weight; $r(h)=o(h^2)$ means $r(h)/h^2\to0$.
- Minima: local = beats all points within some radius $\delta\gt0$; strict = beats them strictly; global = beats all points.
- Weierstrass (coercive): $X$ nonempty closed; $f$ proper, lsc, coercive ($\|x\|\to\infty\Rightarrow f(x)\to+\infty$); $X\cap\text{dom}f\ne\emptyset$ ⇒ a minimiser exists (set nonempty, compact). Sufficient, not necessary.
- Line formulas: $\varphi(t)=f(x^*+td)$: $\varphi'(0)=\nabla f(x^*)^\top d$, $\ \varphi''(0)=d^\top\nabla^2f(x^*)\,d$. Taylor: $f(x^*+h)=f(x^*)+\nabla f(x^*)^\top h+\frac12h^\top\nabla^2f(x^*)h+o(\|h\|^2)$.
- FONC (necessary): local min, $f$ differentiable ⇒ $\nabla f(x^*)=0$.
SONC (necessary): local min, $f\in C^2$ ⇒ $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succeq0$.
SOSC (sufficient): $\nabla f(x^*)=0$ and $\nabla^2f(x^*)\succ0$ ⇒ strict local min. - The gaps: $x^4$ (strict min, $f''(0)=0$: SOSC not necessary); $x^3$ and $-x^4$ (FONC + SONC hold, not a min: not sufficient); $x_1^4+x_2^2$ (strict min, Hessian diag$(0,2)$); monkey saddle $x_1^3-3x_1x_2^2$ (Hessian 0; $t^3$ vs $-2t^3$).
- Group N $=\{\nabla f=0,\nabla^2f\succeq0\}$ necessary; Group S $=\{\nabla f=0,\nabla^2f\succ0\}$ sufficient. For quadratics both are "iff" (Group N ⇔ global min, Group S ⇔ unique min) because Taylor is exact.
- PD/PSD tests (symmetric $S$): PD ⇔ all $\lambda\gt0$ ⇔ all leading minors $\gt0$ (Sylvester). PSD ⇔ all $\lambda\ge0$ ⇔ all principal minors $\ge0$ (diag$(0,-1)$: leading minors $0,0$, not PSD). 2×2: det $\lt0$ ⇒ indefinite.
- Classify: Hessian PD → strict local min; ND → strict local max; indefinite → saddle; singular semidefinite → inconclusive. Then the global question separately.
- Peano: $f=(x_2-px_1^2)(x_2-qx_1^2)$, $0\lt p\lt q$: min at 0 along every line, but $f=(m-p)(m-q)x_1^4\lt0$ on $x_2=mx_1^2$, $p\lt m\lt q$ ⇒ not a local min.
- Quadratic $f=\frac12x^\top Qx-b^\top x$ ($Q=Q^\top$): $\nabla f=Qx-b$, $\nabla^2f=Q$. $Q\succ0$: unique min $Q^{-1}b$. $Q\succeq0$ singular: $b\in$ range$(Q)$ ⇒ infinitely many minima; $b\notin$ range$(Q)$ ⇒ none (unbounded below). Negative eigenvalue ⇒ unbounded below.
- Least squares $\frac12\|Ax-\bar b\|^2$: normal equations $A^\top Ax^*=A^\top\bar b$, always solvable (range$(A^\top A)$ = range$(A^\top)$). Unique ⇔ full column rank; then $x^*=(A^\top A)^{-1}A^\top\bar b$, $P=A(A^\top A)^{-1}A^\top$ ($P^2=P=P^\top$) projects onto range$(A)$, $I-P$ onto null$(A^\top)$; residual ⟂ columns.
- Convexity ($f\in C^2$ on $\mathbb R^n$): $f(\theta x+(1-\theta)y)\le\theta f(x)+(1-\theta)f(y)$ ⇔ $f(y)\ge f(x)+\nabla f(x)^\top(y-x)$ for all $x,y$ ⇔ $\nabla^2f(x)\succeq0$ for every $x$ ⇔ every restriction $f(x+td)$ is convex. SONC = PSD at one point; convexity = PSD everywhere.
- Convex payoffs: stationary ⇒ global min; local min ⇒ global min. Not given: existence ($e^x$), uniqueness ($(x_1+x_2)^2$). Max of convex is convex; log-sum-exp is convex (Hessian $\sigma_1\sigma_2\begin{bmatrix}1&-1\\-1&1\end{bmatrix}$, $\sigma_i=e^{x_i}/\sum e^{x_j}$), not strictly.
- Proof chain: $\frac{f(x+td)-f(x)}{t}\le f(y)-f(x)$ → ($t\downarrow0$) $\nabla f(x)^\top d\le f(y)-f(x)$ → swap: $f(y)-f(x)\le\nabla f(y)^\top d$ → $(\nabla f(y)-\nabla f(x))^\top(y-x)\ge0$ (with $d=y-x$).