Expected Steps for a Fair Random Walk to Drift N Units Away

Last updated: November 29, 2026

Quick Overview

A daily budget pacing error moves up or down by one unit each step with equal probability, starting at zero. What is the expected number of steps until the error first reaches plus or minus N, and from a starting point i between 0 and N, how long until it hits 0 or N?

Meta
Statistics & Math
Data Scientist
Meta
November 29, 2026
Data Scientist
Onsite
Statistics & Math
Hard

0

0

0 solved


A daily budget pacing error moves up or down by one unit each step with equal probability, starting at zero. What is the expected number of steps until the error first reaches plus or minus N, and from a starting point i between 0 and N, how long until it hits 0 or N?

This question tests martingale reasoning, which Meta data scientists use when thinking about drift in pacing, sequential tests and random walk models. The interviewer wants the $N^2$ answer, a proof via optional stopping or first-step analysis, and an intuition about diffusive scaling.

What the Interviewer Expects
  • Recognize $S_t^2 - t$ as a martingale
  • Apply optional stopping to get $E[T] = N^2$
  • Solve the boundary problem $D_i = i(N - i)$ by first-step analysis
  • Verify by simulation
  • Explain the square root scaling of random walk distance
Key Topics to Cover
Random walks
Martingales
Optional stopping
First-step analysis
How to Approach This
  1. Define your hypotheses (H0 and H1) clearly before performing any test.
  2. Calculate required sample size BEFORE running an experiment, using power analysis.
  3. Remember the Central Limit Theorem: sample means become approximately normal with large n.
  4. Watch for Simpson's paradox. Always segment data by key dimensions.
  5. Distinguish between statistical significance and practical significance.
Possible Follow-up Questions
  • What is the expected time for a biased walk?
  • Why must optional stopping conditions be checked here?
  • How does this square root scaling show up in sequential testing?
  • What is the expected time to hit +N alone, with no lower barrier?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Browse Statistics Questions
Sample Answer
Clarify

Simple symmetric walk StS_t with S0=0S_0 = 0, steps ±1\pm 1 with probability 1/2. T=min⁡{t:∣St∣=N}T = \min\{t : |S_t| = N\}. We want E[T]E[T], and for barriers 0 and NN starting at ii, the expected duration DiD_i....

Approach

Use the martingale Mt=St2−tM_t = S_t^2 - t: E[St+12∣St]=St2+1E[S_{t+1}^2 \mid S_t] = S_t^2 + 1, so subtracting tt makes it fair. Stop at TT, where ST2=N2S_T^2 = N^2 exactly. Alternatively solve the first-step recursion with...


Submit Your Answer
Markdown supported