Friday 14 August 2026

Quant interview

Three rolls of a die, keep the one you stop on

medium · Optimal stopping with a finite horizon

A fair six-sided die is rolled. After each roll you may either stop and take the value showing as a payoff in dollars, or roll again and forfeit the value showing. You may roll at most three times in total, and if you reach the third roll you must take it.

  1. Give the optimal policy and the expected payoff under it.
  2. Let Vk be the value of the game with k rolls available. Write the recursion satisfied by Vk and find limk→∞Vk.
Solution

1. Backward induction

Work backwards from the last roll, which is the only place where the answer is obvious.

With one roll available you must take it, so

V1=𝔼[D]=3.5.

With two available, you see a value d and then choose between d and a fresh V1=3.5, so you stop exactly when d≥4:

V2=𝔼[max(D,3.5)]=3.5+3.5+3.5+4+5+66=25.56=4.25.

With three available you compare d against V2=4.25, so you stop exactly when d≥5:

V3=𝔼[max(D,4.25)]=4.25·4+5+66=286=143.

Answer. On the first roll keep only 5 or 6; on the second keep 4, 5 or 6; take whatever the third gives. The expected payoff is 14/3≈4.667.

The thing to notice is that the threshold depends only on how many rolls remain, never on what you have already seen — the rolls are independent, so a forfeited value carries no information.

2. The recursion and its limit

Vk+1=𝔼[max(D,Vk)]=16∑d=16max(d,Vk)

The map v↦𝔼[max(D,v)] is nondecreasing and satisfies 𝔼[max(D,v)]>v for every v<6, so Vk increases strictly, and it is bounded above by 6. Its limit v⋆ is a fixed point with v⋆≤6, and the only fixed point of v=𝔼[max(D,v)] in [1,6] is v=6: for v<6 the roll d=6 contributes 6>v with probability 1/6 while every other term is at least v, making the right side strictly larger. Hence

limk→∞Vk=6.

Concretely V4=4.94, V5≈5.12: the approach is slow, because gaining more requires waiting for a 6, and the probability of not having seen one decays like (5/6)k.

Statistics in machine learning

A generalization bound with no dimension in it

hard · Rademacher complexity and dimension-free bounds

Fix B,X>0 and let

ℋ=\{x↦⟨w,x⟩:‖w‖2≤B\}

be the class of linear predictors on {x∈ℝd:‖x‖2≤X}. For a sample x1,…,xn the empirical Rademacher complexity is

ℜ^n(ℋ)=𝔼σ[suph∈ℋ1n∑i=1nσih(xi)],

with σ1,…,σn independent and uniform on {−1,+1}.

  1. Prove that ℜ^n(ℋ)≤BXn, and say which steps of your argument are equalities and which are not.
  2. Let the loss ℓ(h(x),y) be L-Lipschitz in its first argument and take values in [0,1]. Write down the resulting generalization guarantee.
  3. The bound contains no d. Say what has taken the dimension's place, and identify exactly where the argument would fail if the constraint were ‖w‖1≤B instead.
Solution

1. The bound

Write u=1n∑iσixi. The supremum over a Euclidean ball is a dual norm and is attained, by Cauchy-Schwarz with equality at w=Bu/‖u‖:

sup‖w‖2≤B⟨w,u⟩=B‖u‖2.

That step is an equality, which is worth noticing — no slack is introduced by the class geometry. Hence

ℜ^n(ℋ)=Bn𝔼σ\|∑i=1nσixi\|2.

Now the two inequalities. First Jensen, since · is concave:

𝔼\|∑iσixi\|2≤𝔼\|∑iσixi\|22.

The second moment collapses because the signs are independent and mean zero, so 𝔼[σiσj]=δij:

𝔼\|∑iσixi\|22=∑i,j𝔼[σiσj]⟨xi,xj⟩=∑i‖xi‖22≤nX2.

That last step is the second inequality, and it is the only place the radius bound is used. Combining,

ℜ^n(ℋ)≤BnnX2=BXn.

2. The guarantee

Composing with an L-Lipschitz loss costs a factor L by Talagrand's contraction lemma, and the standard symmetrization bound for losses in [0,1] gives, with probability at least 1−δ, simultaneously for all h∈ℋ,

R(h)≤R^(h)+2Lℜ^n(ℋ)+3log(2/δ)2n≤R^(h)+2LBXn+3log(2/δ)2n.

The constants depend on which version of the bound you quote — some texts state it with the population rather than empirical complexity, and then the deviation term shrinks — but the shape, O(LBX/n) plus an O(log(1/δ)/n) confidence term, is common to all of them.

3. What replaced the dimension

The product BX has. The class is not indexed by how many coordinates x has but by a scale: how long the weight vector is allowed to be and how large the inputs can be. This is the technical content behind margin-based explanations of why heavily overparameterized linear models can still generalize — control the norm and d never enters.

The argument breaks at the very first step under an ℓ1 constraint. There the dual norm is ℓ∞,

sup‖w‖1≤B⟨w,u⟩=B‖u‖∞,

and 𝔼‖u‖∞ is not a second moment of a single vector, so the identity 𝔼‖∑iσixi‖2=∑i‖xi‖2 no longer applies — a maximum over d coordinates is not controlled by its own variance. The right tool is a maximal inequality for sub-Gaussian variables (Massart's lemma), which yields a bound of order BX∞2log(2d)/n where X∞ bounds ‖xi‖∞. The dimension returns, but only logarithmically, which is exactly the tradeoff that makes ℓ1 attractive in the high-dimensional regime.


Two new problems every morning at 8am · every day so far