120:00 Closed book. Paper and pen. Don't open any answers until the time is up.

M8 · Mock finals

Three full papers in the exam format: 120 minutes, 5 questions, Q1 True/False. Mock A and B are the real 2025 and 2024 finals (every question is worked in M1–M7, so do these before rereading those worked examples if you can). Mock C is a new paper in his style, built from the question types he has not reused yet, with fresh numbers (all checked by a Python script).

How to run a mock

  1. Clear the desk: paper, pen, nothing else. Start the timer above.
  2. First 5 minutes: read all questions; mark the ones you can do fully. Q1 (T/F) first, about 1 minute per item; skip any you can't decide in 1 minute, come back at the end.
  3. Then the questions you marked, in order of confidence. For each, write the setup line first (the one-step inequality, KKT system, Lagrangian, standard form): it earns marks even if you get stuck.
  4. Last 10 minutes: return to skipped T/F; check that every numeric answer is boxed and every "justify" has a reason.
  5. When time is up: mark it with the answers below, record the score in the log, and for each lost mark write which module section to reread.
Order of the three mocks

Mock C first if you have already read the worked 2024/2025 questions in M1–M6 (then A and B test recall). Otherwise A, then B, then C. Leave at least a day between mocks to fix weak spots.

Mock A · 2025 final (28 Nov 2025) · 60 marks · 120 min

Notation as in the paper: $e$ = vector of ones; $B(x,\delta)=\{z:\|z-x\|\le\delta\}$; (CQ): $\min\frac12x^\top Qx+h^\top x+c$ with $Q\succ0$.

1. True or False. [20 × 1]

  1. $g:\mathbb R^d\to\mathbb R$ continuous with $g(x)\ge1$ whenever $\|x\|\ge10$: $g$ has an unconstrained minimum.
  2. In unconstrained optimization, a function with a local minimum may not have a global minimum.
  3. $f:[0,1]\to\mathbb R$ with $f'(x)\ne0$ for all $x\in(0,1)$ has no global minimum.
  4. A constant Hessian implies the function is quadratic.
  5. If the directional derivative along $v$ is negative then $v$ is a descent direction.
  6. Constant step-size algorithms do not satisfy the Sufficient Decrease Lemma for any choice of step size.
  7. For gradient descent on a convex $f\in C^1_L$ there is $C>0$ with $f(x^{(k)})-f^*\le C/k^2$ for all $k\ge1$.
  8. Depending on the start, Newton's method on (CQ) can take 10 or more iterations.
  9. If a conjugate direction method on (CQ) finished in 5 iterations then $Q$ has 5 distinct eigenvalues.
  10. Rank-2 quasi-Newton converges faster than gradient descent for (CQ).
  11. Minimising $f$ over a convex $C$: the feasible directions at the global optimum $x^*$ are described by $B(x^*,\delta)$ for some $\delta>0$. At $x^*$ there are no active constraints.
  12. $C=\{x\in\mathbb R^2:-1\le x_1\le1,\ x_2^2\le1\}$ is convex.
  13. For a convex programming problem, $\hat x$ satisfies KKT and there is a feasible $u$ with $\nabla f(\hat x)^\top u<0$.
  14. The dual of a quadratic programming problem is another quadratic program.
  15. If strong duality holds then both primal and dual are feasible.
  16. The projection on $\{x:x^\top e\le1\}$ does not exist because the set is unbounded.
  17. Projected gradient descent always converges to a point whose gradient is 0.
  18. Active set on a (CQ) in 500 variables with more than 50 linear inequality constraints, from a feasible point with no active constraints: $f$ strictly decreased and the working set grew to 8.
  19. Linear programming problems always have a global minimum.
  20. The BFS recovered from the simplex algorithm may not be a KKT point.

2. [10] Minimise $e^{2x_2}+\frac12x_1^2-x_2$ s.t. $x_1^2+x_2^2\le10$ and $u^\top x\ge2$. For what $u$ is $x^{(0)}=(1,1)$ a global minimum? Justify.

3. $Q=\alpha I+uu^\top+2vv^\top$, $\alpha>0$, $\|u\|=\|v\|=1$, $u^\top v=0$; $f(x)=\frac12x^\top Qx+w^\top x+c$ with $w^\top u=w^\top v=0$. (a) Eigenvalues of $Q$. [2] (b) Global optimum point and value; examine $\alpha=0$. [4] (c) CG from $x^{(0)}=0$: number of iterations and all iterates. [4]

4. $\max_{x\in\mathbb R^d}-\sum_ix_i\log x_i$ s.t. $\sum_ix_i=1$, $x_i\ge0$. (a) KKT conditions. [3] (b) Global optimum and value. [5] (c) Same with min instead of max ($0\log0=0$). [2]

5. $\min x_1-x_2$ s.t. $2x_1+5x_2\ge10$, $x_1+x_2\ge1$, $x\ge0$. (a) Dual of $\min c^\top x$ s.t. $Ax\ge b$, $x\ge0$. [2] (b) A dual feasible point of the given problem. [2] (c) Optimal value, from first principles. [1] (d) Replace $2x_1+5x_2\ge10$ by $\le10$: optimal primal and dual values in both cases. [5]

Show answers and marking

Q1 (1 each): a T, b T, c F, d T, e T, f F, g F, h F, i F, j T, k T, l T, m F, n T, o T, p F, q F, r F, s F, t F. Reasons: M7 drill (items "2025 final").

Q2: $u=(e^{-2},\,2-e^{-2})$, $\lambda=e^2$. Suggested split (the key gives none): convexity 2, disc inactive / half-plane active 2, stationarity 3, answer 3. Worked: M5 D.

Q3: (a) $\alpha$ ($d-2$×), $\alpha+1$, $\alpha+2$. (b) $x^*=-w/\alpha$, $f^*=c-\frac{\|w\|^2}{2\alpha}$; $\alpha=0$: unbounded below if $w\ne0$. (c) one iteration, $x^{(1)}=-w/\alpha$. Worked: M2 E2.

Q4: KKT of $\min\sum x_i\log x_i$; $x_i=\frac1d$, value $\log d$; min of the entropy is $0$ at a vertex. Worked: M5 C.

Q5: (a) $\max b^\top y$, $A^\top y\le c$, $y\ge0$; (b) none: dual infeasible; (c) $-\infty$ (along $s(0,1)$); (d) original: $p^*=d^*=-\infty$; flipped: $p^*=d^*=-2$ at $(0,2)$, $y=(\frac15,0)$ (the key gives only the $-2$). Worked: M6 D.

Mock B · 2024 final (22 Nov 2024) · 45 marks · 120 min

$h(x)=\frac12x^\top Qx+b^\top x+c$ (QUAD), $Q\in S^d$. (DESCENT): $x^{(k+1)}=x^{(k)}+\alpha_ku^{(k)}$ with $u^{(k)\top}\nabla f(x^{(k)})<0$.

1. True or False. [10 × 1]

  1. For $h$ in (QUAD), $h(y)-h(x)=\nabla h(x)^\top(y-x)+\frac12(y-x)^\top Q(y-x)$ is true only if $Q$ is PSD or PD.
  2. $u\ne0$, $a>0$. Minimising $u^\top x$ s.t. $\|x\|\le a$: the optimum is at $x^*$ with $\|x^*\|=a^2$ for some $u$.
  3. (DESCENT) with $u^{(k)}=-\nabla f$, $\alpha_k=\frac1L$, $f=h$, eigenvalues of $Q$ all in $(1,7)$: after 5 iterations from any $\hat x$, $h(x^{(5)})-h(x^*)\le(\frac34)^5(h(\hat x)-h(x^*))$.
  4. Conjugate gradient finds the global unconstrained minimum of $h$ in at most $d$ iterations.
  5. Convergence of Newton's method for $h$ with PD Hessian depends on the eigenvalues of $Q$.
  6. $z\notin C$, $C\subset\mathbb R^d$ closed convex: there is only one $x^*\in C$ with $\|x^*-z\|<\|x-z\|$ for all other $x\in C$.
  7. At the optimum $x^*$ of a constrained problem, $\nabla f(x^*)\ne0$. Then at least one constraint is active.
  8. The set of feasible descent directions at $\hat x$ is non-empty if $\hat x$ is a KKT point.
  9. Gradient projection finds the global minimum of a convex program in a finite number of iterations.
  10. A dual feasible point has dual value $-1$ and a primal feasible $\bar x$ has $f(\bar x)=0.5$. Then $f(\bar x)-f(x^*)\le1.5$.

2. $f\in C^1_L$ over $\mathbb R^d$, convex, $L=5$; for some $\mu>0$, $f(y)\ge f(x)+\nabla f(x)^\top(y-x)+\frac12\|x-y\|^2$ for all $x,y$. GD with $u^{(k)}=-\nabla f(x^{(k)})$, constant $\alpha$; $x^*$ the global minimum. (a) $\|\nabla f(x^{(0)})\|=\sqrt2$: upper bound on $\|x^{(0)}-x^*\|^2$; credit to the lowest upper bound. [2] (b) Lower bound on $f(x^{(k)})-f(x^{(k+1)})$ in terms of $\|\nabla f(x^{(k)})\|^2$; range of $\alpha$. [2] (c) $A,B$ with $\log\frac{\Delta_T}{\Delta_0}\le A+BT$. [3] (d) $A,B$ with $\log\|x^{(T)}-x^*\|^2\le A+BT$. [3]

3. $f:\mathbb R^3\to\mathbb R$ convex, $C^1_L$; $\min f$ s.t. $\frac13(x_1x_2+x_3x_2+x_1x_2)\le1.5$, $x_1+ax_2\ge b$, $x_2+x_3\le10$, $x_3\ge0.5$. At $\hat x=(1,1,1)$: $f(\hat x)=3$, $\nabla f(\hat x)=(1,10,0)$. (a) Choose $a,b$ so $\hat x$ is a KKT point. [5] (b) T/F with justification: the global optimal value of $f$ is strictly less than 3. [5]

4. [5] $\min f$ s.t. $g_i(x)\ge0$, $i=1,2,3$, possibly in the wrong direction. $x^{(0)}$ is a KKT point; $g_1=g_2=0$, $g_3=-4$ at $x^{(0)}$; $\nabla f=(4,-12,4)$, $\nabla g_1=(1,-2,0)$, $\nabla g_2=(0,1,-2)$, $\nabla g_3=(-1,1,10)$. Are the inequalities in the proper direction? Correct them, with reasons.

5. $u\in\mathbb R^d$ with distinct non-zero entries, $a=\min u_i$, $b=\max u_i$. $\max u^\top x$ s.t. $\sum x_i\le1$, $x\ge0$. (a) If $\sum x_i\le1$ is not active at optimality: conclusions about $a$, $b$, optimal value. [5] (b) Same if it is active. [5]

Show answers and marking

Q1: a F, b F, c F, d T, e F, f T, g T, h F (no printed key; at a KKT point $\nabla f^\top u=\sum\lambda_i\nabla g_i^\top u\ge0$ for every feasible $u$), i F, j T. Reasons in M7.

Q2: (a) $\le2$; (b) $\alpha(1-\frac52\alpha)\|\nabla f\|^2$, $\alpha\in(0,\frac25)$; (c) $A=0$, $B=-\beta$, $\beta=2\alpha(1-\frac52\alpha)$; (d) $A=\log2$, $B=-\beta$. Worked: M1 E.

Q3: (a) $a=10$, $b=11$; (b) False, by the relaxation argument (optimum exactly 3). Worked: M5 D.

Q4: $g_3$ must be $\le0$ (a KKT point is feasible). The active system has no solution ($\lambda_1=4$ from component 1, $\lambda_2=-2$ from component 3, but component 2 gives $-10\ne-12$): say so. His key: $g_2$ also reversed. M5 E.

Q5: (a) $a<b<0$, $x=0$, value 0; (b) $b>0$, $x=e_l$ at the largest $u$, value $b$, nothing about $a$. M6 D.

Mock C · new paper · 50 marks · 120 min

Built from the types he hasn't reused yet: the descent-lemma ladder, a structured-matrix CG count, Newton run backwards, reverse KKT with a wrong-way twist, and a simplex pivot question (2017 Q7 / 2020 P2 Q3 style). New numbers throughout.

1. True or False. [10 × 1]

  1. For $f\in C^1_L$, gradient descent with the constant step $\alpha=\frac{1.5}{L}$ decreases $f$ at every non-stationary iterate.
  2. CG on $\frac12x^\top Qx-h^\top x$ with $Q=4I+3uu^\top$ ($\|u\|=1$) finishes in at most 2 iterations from any start.
  3. Newton's method on $f(x)=x^4$ converges quadratically to $0$.
  4. For an LP in standard form, every extreme point of the feasible set is a basic feasible solution.
  5. If $f$ is convex and differentiable and $\nabla f(x)^\top(y-x)\ge0$ for all $y$ in a convex set $C$ ($x\in C$), then $x$ minimises $f$ over $C$.
  6. The DFP update keeps $G$ positive definite whenever $\delta^\top\gamma<0$.
  7. Strong duality holds for every convex optimization problem.
  8. The projection of $z$ onto the box $[0,1]^d$ is obtained by clipping each coordinate of $z$ to $[0,1]$.
  9. A function on $\mathbb R^d$ whose Hessian is positive definite everywhere has a unique global minimiser.
  10. In the simplex method a degenerate pivot can leave the objective value unchanged.

2. $f\in C^1_L$ with $L=4$, and $f(y)\ge f(x)+\nabla f(x)^\top(y-x)+\frac14\|y-x\|^2$ for all $x,y$. GD with constant step $\alpha$. (a) Lower-bound $f(x^{(k)})-f(x^{(k+1)})$; give the range of $\alpha$ that guarantees decrease. [2] (b) For $\alpha=\frac14$, find the best $c<1$ that the standard argument gives, with $\Delta_{k+1}\le c\,\Delta_k$. [3] (c) If $\|\nabla f(x^{(0)})\|=2$, bound $\Delta_0$ and $\|x^{(0)}-x^*\|^2$. [2] (d) With $\alpha=\frac14$, how many iterations guarantee $\|x^{(T)}-x^*\|\le10^{-2}$? [3]

3. (A) $Q=2I+3uu^\top+vv^\top$ with $\|u\|=\|v\|=1$, $u^\top v=0$, $d\ge3$; $f(x)=\frac12x^\top Qx-w^\top x$ with $w=5u+2v+z$, where $z\ne0$, $z^\top u=z^\top v=0$. (a) Eigenvalues of $Q$. [2] (b) $x^*$ and $f^*$ in terms of $u,v,z$. [2] (c) Number of CG iterations from $x^{(0)}=0$; what if $z=0$? [2]
(B) Newton's method on $g(x)=(x_1-2)^4+3(x_2+1)^2$ gives $x^{(2)}=(6,-1)$. Find $x^{(0)}$. Is the convergence quadratic? Why? [4]

4. $f:\mathbb R^3\to\mathbb R$ convex and differentiable; constraints $x_1^2+x_2^2+x_3^2\le5$, $x_1+cx_2\ge1+c$, $x_3\le1$. At $x^0=(1,1,1)$: $\nabla f(x^0)=(2,6,-4)$. (a) Find $c$ such that $x^0$ is a KKT point; give the multipliers. [4] (b) Is $x^0$ then a global minimum? Justify. [3] (c) If instead $\nabla f(x^0)=(2,6,4)$ and $x^0$ is known to be a local minimum (with $c$ from (a)), which inequality is written the wrong way? [3]

5. $\min-2x_1-x_2$ s.t. $x_1+x_2\le4$, $x_1\le3$, $x\ge0$. (a) Standard form: $A,b,c$. [2] (b) From the slack basis, do one simplex pivot (most negative reduced cost enters): entering, leaving, new BFS. [3] (c) Do the next pivot. [3] (d) Show the final BFS is optimal and give the dual optimal solution and value. [2]

Mock C · solutions and marking

Show solutions (only after the 120 minutes)

Q1 (1 each):

  1. T. $\frac{1.5}L<\frac2L$: factor $\alpha(1-\frac{L\alpha}2)=\frac{0.375}L>0$. (M1 B1)
  2. T. Eigenvalues $4$ ($d-1$×) and $7$: 2 distinct. (M2 E)
  3. F. $x\mapsto\frac23x$: linear (degenerate minimum, $f''(0)=0$). (M3 B4)
  4. T. Extreme point ⇔ BFS. (M6 E)
  5. T. First-order condition, sufficient for convex $f$. (M5 A)
  6. F. PD preservation needs $\delta^\top\gamma>0$; e.g. $G=I$, $\delta=(1,0)$, $\gamma=(-1,0.5)$ gives an indefinite update. (M3 C5)
  7. F. Needs a condition such as Slater (LPs are an exception); there are convex problems with a positive gap. (M6 B)
  8. T. (M5 B)
  9. F. $e^x$: $f''>0$, no minimiser. (M4 D)
  10. T. Ratio $\bar\alpha=0$: the point stays, only the basis changes. (M6 F2)

Q2 (10): (a) Descent Lemma: $f(x^{(k)})-f(x^{(k+1)})\ge\alpha(1-2\alpha)\|\nabla f\|^2$, positive for $\alpha\in(0,\frac12)$ [2]. (b) $\mu=\frac12$ (lower bound has $\frac14=\frac\mu2$); PL: $\|\nabla f\|^2\ge2\mu\Delta=\Delta$; $\beta=2\mu\alpha(1-\frac{L\alpha}2)=\frac18$, so $c=\frac78$ [3]. (c) $\Delta_0\le\frac{4}{2\mu}=4$; $\|x^{(0)}-x^*\|^2\le\frac2\mu\Delta_0=16$ [2]. (d) $\|x^{(T)}-x^*\|^2\le\frac2\mu\Delta_T\le4(\frac78)^T\cdot4=16(\frac78)^T\le10^{-4}$ ⇔ $T\ge\frac{\ln(1.6\times10^5)}{\ln(8/7)}=89.7$: $T=90$ [3]. (M1 E)

Q3 (10): (A)(a) $Qu=5u$, $Qv=3v$, $Qz'=2z'$ for $z'\perp u,v$: eigenvalues $5,3,2$ ($2$ repeated $d-2$ times) [2]. (b) $x^*=Q^{-1}w=u+\frac23v+\frac12z$; $f^*=-\frac12w^\top Q^{-1}w=-\frac12\big(5+\frac43+\frac{\|z\|^2}2\big)$ [2]. (c) $g^{(0)}=-w$ touches eigenvalues $5,3,2$: 3 iterations; if $z=0$: 2 [2]. (M2 E)
(B) $\nabla^2g=\mathrm{diag}(12(x_1-2)^2,6)$, diagonal: $x_2$ reaches $-1$ in one step; for $y=x_1-2$: $y-\frac{4y^3}{12y^2}=\frac23y$. $y_2=4$ ⇒ $y_0=4\cdot\frac94=9$: $x^{(0)}=(11,\beta)$, $\beta$ arbitrary. Not quadratic: linear with factor $\frac23$, because the Hessian at the minimiser $(2,-1)$ is singular [4]. (M3 B4)

Q4 (10): (a) $\|x^0\|^2=3<5$: inactive. Write $g_2=x_1+cx_2-(1+c)\ge0$ (active: $1+c=1+c$ ✓), $g_3=1-x_3\ge0$ (active). Stationarity $(2,6,-4)=\lambda_2(1,c,0)+\lambda_3(0,0,-1)$ ⇒ $\lambda_2=2$, $c=3$, $\lambda_3=4$, both $\ge0$ [4]. (b) Yes: $f$ convex, the ball and the two half-spaces are convex, so KKT ⇒ global [3]. (c) $(2,6,4)=\lambda_2(1,3,0)+\lambda_3(0,0,-1)$ ⇒ $\lambda_3=-4<0$ (linear constraints ⇒ regular, multipliers unique): $x_3\le1$ is the wrong way; it should be $x_3\ge1$ [3]. (M5 D, E)

Q5 (10): (a) Variables $(x_1,x_2,s_1,s_2)$: $A=\begin{pmatrix}1&1&1&0\\1&0&0&1\end{pmatrix}$, $b=(4,3)$, $c=(-2,-1,0,0)$ [2]. (b) Slack basis: $x=(0,0,4,3)$, reduced costs $(-2,-1)$: $x_1$ enters; ratios $\frac41$, $\frac31$: $s_2$ leaves; BFS $(3,0,1,0)$, cost $-6$ [3]. (c) Basis $\{s_1,x_1\}$: $B=\begin{pmatrix}1&1\\0&1\end{pmatrix}$, $B^{-1}=\begin{pmatrix}1&-1\\0&1\end{pmatrix}$, prices $y^\top=c_B^\top B^{-1}=(0,-2)$; reduced costs $x_2$: $-1$, $s_2$: $2$: $x_2$ enters; $\hat a=(1,0)$, $\hat b=(1,3)$: ratio 1, $s_1$ leaves; BFS $(3,1,0,0)$, cost $-7$ [3]. (d) Basis $\{x_2,x_1\}$: $y^\top=c_B^\top B^{-1}=(-1,-1)$; reduced costs of $s_1,s_2$: $1,1\ge0$: optimal. Dual $\max4y_1+3y_2$ s.t. $A^\top y\le c$: $y^*=(-1,-1)$, value $-7$ [2]. (Here $y$ is the LP dual variable, written $\mu$ in M6; in Q2, $\mu$ is the strong-convexity constant.) (M6 F)

Score log and review

Saved in this browser. Target: 45/60 on Mock A, 34/45 on Mock B, 38/50 on Mock C (75%, which puts the course total around 62: B+ or better).

MockQ1Q2Q3Q4Q5Total%
A · 2025 /20 /10 /10 /10 /10
B · 2024 /10 /10 /10 /5 /10
C · new /10 /10 /10 /10 /10
Where to go for each lost mark
Lost marks on…Reread
rates, iteration countsM1 G
CG counts, structured $Q$M2 G
Newton, quasi-NewtonM3 E
T/F basicsM4 F + M7
KKT, reverse KKT, projectionM5 I
duals, LP, simplexM6 G