Recursive Expectation / First-Step Analysis

Condition on the first move and write equations linking the states.

What is it?

Define the expected remaining time (or win probability) from each state, then express each one through the states reachable in one step.

Why is it useful?

Waiting for patterns, random walks and gambler's ruin all reduce to a small linear system.

When should you think of it?

Think of it when a process restarts or moves between a few states until it stops.

Think of this method when…

  • "Expected number of flips until…"
  • The process can fall back to an earlier state
  • A small number of distinguishable states
  • Absorbing states: win, lose, pattern complete

Core idea

From any state, one step costs 1 and moves to another state; expectations satisfy .

Step-by-step playbook

  1. 1Define the states by what you need to remember.
  2. 2Write one equation per non-absorbing state.
  3. 3Set absorbing states to 0 (or 1 for win probabilities).
  4. 4Solve the linear system.

Worked example

Worked example

What is the expected number of fair coin flips until two heads in a row?

  1. 1

    States: (no progress) and (last flip was H).

  2. 2

    Equations: and .

  3. 3

    From the first, ; substitute into the second.

  4. Answer:

Common mistakes

  • Choosing states that forget necessary history.
  • Forgetting the "+1" for the step just taken.
  • Sending a failed pattern back to the wrong state.

Would you use this method?

A frog on a line moves left or right with equal probability. Starting at 1, what is the chance it reaches 3 before 0?

Practice this method

20 QuantSolve questions are tagged with this method.

Practice this method

Related lessons & methods