Derive the Gambler's Ruin Probability

Quick Overview

A gambler starts with `i` coins. Explain the assumptions and derivation clearly, check edge cases, and show how the result changes when those assumptions no longer hold.

Derive the Gambler's Ruin Probability

Company: Gsa

Role: Data Scientist

Category: Statistics & Math

Difficulty: hard

Interview Round: Technical Screen

A gambler starts with `i` coins. Each round independently increases the fortune by one with probability `p` and decreases it by one with probability `1-p`. Play stops at `0` or `N` coins. Derive the probability of reaching `N` before `0` for `0 <= i <= N`. Give both the fair case `p = 1/2` and the biased case `p != 1/2`, including boundary conditions. ### Constraints & Assumptions - `0 < p < 1` and `N` is a positive integer. - Rounds are independent and the step size is exactly one coin. - The stopping boundaries are absorbing. ### Clarifying Questions to Ask - Is the requested quantity a hitting probability or expected duration? - Are the win probabilities constant over time? - What should the formula return at `i = 0` and `i = N`? ```hint Write a recurrence For an interior fortune, condition on the next round and solve the resulting second-order difference equation. ``` ### What a Strong Answer Covers - The recurrence and two boundary conditions. - The linear fair-case solution and geometric biased-case solution. - Correct limiting or sanity checks as `p` approaches one half and at both boundaries. ### Follow-up Questions - How would you derive the expected absorption time? - What changes if wins add two coins but losses remove one? - How does the probability behave as `N` grows when `p < 1/2`?

Quick Answer: A gambler starts with `i` coins. Explain the assumptions and derivation clearly, check edge cases, and show how the result changes when those assumptions no longer hold.

|Home/Statistics & Math/Gsa
Gsa logo
Gsa
Jun 26, 2026, 12:00 AM
hardData ScientistTechnical ScreenStatistics & Math
0
0

A gambler starts with i coins. Each round independently increases the fortune by one with probability p and decreases it by one with probability 1-p. Play stops at 0 or N coins.

Derive the probability of reaching N before 0 for 0 <= i <= N. Give both the fair case p = 1/2 and the biased case p != 1/2, including boundary conditions.

Constraints & Assumptions

  • 0 < p < 1 and N is a positive integer.
  • Rounds are independent and the step size is exactly one coin.
  • The stopping boundaries are absorbing.

Clarifying Questions to Ask Guidance

  • Is the requested quantity a hitting probability or expected duration?
  • Are the win probabilities constant over time?
  • What should the formula return at i = 0 and i = N ?

What a Strong Answer Covers Guidance

  • The recurrence and two boundary conditions.
  • The linear fair-case solution and geometric biased-case solution.
  • Correct limiting or sanity checks as p approaches one half and at both boundaries.

Follow-up Questions Guidance

  • How would you derive the expected absorption time?
  • What changes if wins add two coins but losses remove one?
  • How does the probability behave as N grows when p < 1/2 ?
Loading comments...