medium · Random walks and gambler's ruin
A trader plays a sequence of independent fair rounds. In each round his bankroll goes up by $1 with probability and down by $1 with probability . He starts with $20 and stops the moment his bankroll first hits either $0 (broke) or $50 (target). Let be the number of rounds played until he stops, and let be the event that he stops at $50.
Write for the bankroll after rounds, , boundaries and . The increments are i.i.d. mean-zero, so is a martingale, and (first exit from ) is an a.s. finite stopping time with , so optional stopping applies at .
Optional stopping on the martingale :
Hence .
Use the compensated martingale (mean-zero unit-variance increments). Optional stopping:
Since , . Therefore
The step a candidate misses: you cannot recurse directly on the conditional expectation , because conditioning on retilts the step probabilities away from (the walk is no longer symmetric once you condition on its endpoint). The clean fix is to work with the unnormalized quantity
which obeys an ordinary first-step recursion under the true (symmetric) dynamics, and only divide by at the very end.
First-step analysis. From , after one round we are at and increases by :
Because is linear, , so the source term is and the recursion becomes the discrete Poisson equation
with boundary data and (at , occurs but ; at , ).
A cubic kills the right side: since , take particular solution , then add the linear homogeneous solution . Boundaries give , :
Divide by :
With :
| Quantity | Formula | Value |
|---|---|---|
Sanity check. By the reflection , the duration conditioned on ruin is . Weighting by and :
Note. Conditional on winning, the expected number of rounds () exceeds the unconditional average (): reaching the far boundary takes longer than a typical exit. The slicker route to Part 3 is Doob's -transform — conditioning on turns the walk into a Markov chain with step probabilities , (using ), and computing the expected time to hit in that chain reproduces .
hard · VC dimension and Rademacher complexity
Let be an arbitrary set and let have Vapnik–Chervonenkis dimension . Fix points with , and let be independent Rademacher signs (). Write the empirical Rademacher complexity For let denote the empirical metric, and let be the corresponding covering number.
You may use the following named facts without proof.
(a) Prove the Sauer–Shelah/Massart bound
(b) Show that in fact for a universal constant (independent of , , and ), removing the logarithmic factor of part (a). Identify explicitly the step where the logarithm disappears.
(c) Show the rate in (b) is optimal: for every and every that is a multiple of , exhibit a class of VC dimension and points with
Restrict each to the sample: let . The supremum defining depends on only through its restriction, so Every has entries in , so ; take in Massart's lemma. By Sauer–Shelah, , hence . Massart gives Since , this carries an extra factor over the target rate — the logarithm we now remove.
The loss in (a) comes from bounding the whole class at the single scale (a global cardinality bound). Dudley's integral instead pays for the class at every resolution, and the metric entropy of a VC class grows only like , whose square root is integrable near .
Converting Haussler to . For -valued one has , so Thus an -cover at radius is an -cover at radius . Applying Haussler with and , Taking logs, where is bounded by the absolute constant for all (using ).
The integral. For the diameter of in is at most , so and the integrand vanishes. Hence the Dudley integral runs only over : Using and the exact value , a finite absolute constant. This convergence at is exactly the step (a) could not exploit. Therefore
Let be distinct and set , i.e. all patterns on the . This class shatters and shatters no set of size , so its VC dimension is exactly .
Choice of sample — the key move. Do not take (which gives a constant) and do not pad with a fixed point (which gives ). Instead spread the shattered points evenly: with , let each appear exactly times among .
For a sign vector , group the indices by their point and write , a sum of independent Rademacher signs. Since can be chosen independently for each , By symmetry of , . Lower-bound by interpolation: (Hölder with exponents matching ), so For a Rademacher sum, and , hence . Therefore Dividing by and using ,
For every VC class of dimension and every sample of size , So , dimension-free in the ambient space and free of the extra logarithm.
Closing note. The tempting wrong conclusion is that the factor in part (a) is intrinsic — it is an artifact of controlling the class at one scale. Chaining trades one global bound for a geometric sum of local ones, and is what makes the trade profitable. On the lower-bound side, the classic trap is to evaluate at (giving the constant ) or to pad with an inert point (giving , which is smaller than ); replicating each shattered point times, so that each coordinate group contributes , is what produces the correct scaling.
Two new problems every morning at 8am · every day so far