Library · The Fiddler: Solutions · Chapter 139

Can You Ride out the Slow Car Chase?

Revised Report an error

You are in a car chase in which both cars obey every traffic law and stop at every red light. You are one block ahead of your pursuer, and both of you are waiting at red lights. The lights turn green together, and both cars head east at one block per minute.

At every intersection the light is green with probability 12\tfrac12, and you coast through, or red with probability 12\tfrac12, and it turns green after exactly one minute. Your pursuer’s lights behave the same way, independently of yours, even at the same intersections. Counting the light you are stopped at, there are five lights between you and the city limit, so six for your pursuer. How likely are you to cross the city limit without being caught?

The Fiddler, Zach Wissner-Gross, October 20, 2023(original post)

The official solution appeared in the post of October 27, 2023 and gives 63/12863/128 for the main puzzle and an infinite average for the Extra Credit. Both agree with the answers below.

Solution

Number the blocks so that you start at block 11 and your pursuer at block 00; the city limit is just past block 55. Both cars move at the same speed, so the pursuer can never close the gap on the road. It can only catch you while you are waiting at a red light.

When are you caught? Call your lights at blocks 2,3,4,52, 3, 4, 5 your first, second, third and fourth lights, and the pursuer’s lights at blocks 1,2,3,41, 2, 3, 4 its first to fourth. Let YNY_N and PNP_N be the number of reds you and the pursuer meet among your first NN lights. You leave block N+1N + 1 at time N+YNN + Y_N: NN minutes of driving and YNY_N minutes of waiting, the last possibly at block N+1N + 1 itself. The pursuer reaches block N+1N + 1 at time N+1+PNN + 1 + P_N. So it catches you there exactly when N+1+PN  ≤  N+YN,that is,DN=PN−YN≤−1.N + 1 + P_N \;\le\; N + Y_N, \qquad\text{that is,}\qquad D_N = P_N - Y_N \le -1 . (When it happens, the pursuer pulls up just as your light turns green: the official solution counts that as caught, and so does this one.) So you escape exactly when the pursuer’s extra waiting, DND_N, stays at 00 or more for N=1,2,3,4N = 1, 2, 3, 4.

One chase. A flat stretch is a minute at a red light. You (solid) wait at blocks 3 and 4 ; the pursuer (dashed) waits only at block 2 , and reaches block 4 just as your light there turns green.
One chase. A flat stretch is a minute at a red light. You (solid) wait at blocks 33 and 44; the pursuer (dashed) waits only at block 22, and reaches block 44 just as your light there turns green.

A walk made of coin flips. At each light DD goes up by 11 (your light green, theirs red), down by 11 (the reverse), or stays put (both the same), with probabilities 14,14,12\tfrac14, \tfrac14, \tfrac12. Here is the one idea of the solution. Score each light as a fair coin flip of ±1\pm 1: the pursuer’s light +1+1 for red and −1-1 for green, and yours +1+1 for green and −1-1 for red. Half the sum of the two scores is exactly the change in DD (check the four cases). So after NN pairs of lights, DN  =  12S2N,D_N \;=\; \tfrac12 S_{2N}, where SjS_j is the running total of jj fair coin flips of ±1\pm 1: a simple random walk, taking 88 steps in all for the four pairs of lights. You escape exactly when S2,S4,S6,S8S_2, S_4, S_6, S_8 are all at least 00. A walk of ±1\pm 1 steps is even after an even number of steps and odd after an odd number, so this is the same as saying that the walk never reaches −2-2 in its 88 steps.

Counting with a mirror. Of the 28=2562^8 = 256 walks, those ending at ee number (8(8+e)/2)\binom{8}{(8 + e)/2}:

end ee −8-8 −6-6 −4-4 −2-2 00 22 44 66 88
walks 11 88 2828 5656 7070 5656 2828 88 11

An escaping walk ends at 00 or above. Some walks that end at 00 or above do reach −2-2 along the way. Take such a walk and reflect everything after its first visit to −2-2, mirroring it in the level −2-2; it now ends at −4−e-4 - e, which is −4-4 or below. Every walk ending at −4-4 or below must pass −2-2, and reflecting it back recovers the original, so these bad walks match up one to one with the 28+8+1=3728 + 8 + 1 = 37 walks ending at −4-4 or below. The escapes are the 70+56+28+8+1=16370 + 56 + 28 + 8 + 1 = 163 walks ending at 00 or above, less these 3737: that is 126126, exactly the walks ending at 00 or 22. So  P(escape)  =  126256  =  63128  ≈  49.2%. \boxed{\ P(\text{escape}) \;=\; \frac{126}{256} \;=\; \frac{63}{128} \;\approx\; 49.2\% . \ }

The computation

The check makes no use of the walk. It replays the chase minute by minute for all 292^9 equally likely patterns of red and green at the lights that matter (your four after the start, the pursuer’s five) and adds up the probability of the patterns in which the pursuer never reaches you while you are still at an intersection.

from fractions import Fraction
from itertools import product

def caught(mine, theirs):
    """Replay the chase minute by minute. I wait at block 1
    and the pursuer at block 0; both lights turn green at time
    0 and the city limit is just past block 5. mine[k] and
    theirs[k] are 1 if the light at block k is red when that
    car arrives (a red light costs one minute), else 0."""
    leave_me, t = {1: 0}, 0
    for k in range(2, 6):
        t = t + 1 + mine[k]            # one block, then wait
        leave_me[k] = t
    t = 0
    for k in range(1, 6):
        t = t + 1                      # pursuer arrives at k
        if k >= 2 and t <= leave_me[k]:
            return True                # I am still there
        t = t + theirs[k]
    return False

escapes = Fraction(0)
for bits in product([0, 1], repeat=9):
    mine = dict(zip(range(2, 6), bits[:4]))
    theirs = dict(zip(range(1, 6), bits[4:]))
    if not caught(mine, theirs):
        escapes += Fraction(1, 2 ** 9)
print("main: escape with probability", escapes)

It prints

main: escape with probability 63/128

Extra Credit

Now the city goes on for ever. Starting as before, how many minutes, on average, until you are caught?

Solution

The mirror argument works for any number of lights. You are still free after nn pairs of lights exactly when the walk of 2n2n steps has not reached −2-2, and the same reflection shows that these walks are the ones ending at 00 or 22. So P(free after n lights)  =  (2nn)+(2nn+1)4n  ≥  (2nn)4n.P(\text{free after } n \text{ lights}) \;=\; \frac{\binom{2n}{n} + \binom{2n}{n+1}}{4^n} \;\ge\; \frac{\binom{2n}{n}}{4^n} . This shrinks to zero, so you are caught in the end with certainty. But it shrinks slowly. Write (2nn)/4n\binom{2n}{n}/4^n as a product, cn  =  12⋅34⋅56⋯2n−12n.c_n \;=\; \frac12 \cdot \frac34 \cdot \frac56 \cdots \frac{2n - 1}{2n} . Each factor 2k−12k\frac{2k-1}{2k} with k≥2k \ge 2 is at least 2k−22k−1\frac{2k-2}{2k-1}, since (2k−1)2≥2k(2k−2)(2k - 1)^2 \ge 2k(2k - 2). So cnc_n is at least 12⋅23⋅45⋯2n−22n−1\frac12 \cdot \frac23 \cdot \frac45 \cdots \frac{2n-2}{2n-1}, and multiplying cnc_n by this second product makes almost everything cancel: cn2  ≥  12⋅12⋅24⋅46⋯2n−22n  =  14n,socn  ≥  12n.c_n^2 \;\ge\; \frac12 \cdot \frac12 \cdot \frac24 \cdot \frac46 \cdots \frac{2n - 2}{2n} \;=\; \frac{1}{4n}, \qquad\text{so}\qquad c_n \;\ge\; \frac{1}{2\sqrt{n}} . The average number of lights TT you pass before being caught is the sum of the chances of still being free after 0,1,2,…0, 1, 2, \dots lights (each light you get past adds one to TT). So E[T]  ≥  1+∑n≥112n,E[T] \;\ge\; 1 + \sum_{n \ge 1} \frac{1}{2\sqrt{n}} , and this sum has no limit: its terms shrink too slowly (the first mm of them add up to more than 12m\tfrac12\sqrt{m}, since each is at least 12m\frac{1}{2\sqrt m}). Every light passed takes at least a minute, so  the average time until you are caught is infinite. \boxed{\ \text{the average time until you are caught is infinite}. \ } Capture is certain, yet its average time is infinite: long escapes are rare, but not rare enough. The median, by contrast, is short. You are still free after three lights with chance 35/6435/64 and after four with 63/12863/128, so half of all chases are over by the fourth light.

The computation

An infinite average cannot be printed, but its signature can. The program tracks the exact distribution of the pursuer’s extra waiting, light by light, as the replay above defines it, dropping the cases in which you have been caught. It reports the chance of still being free after nn lights and the lower bound for the average number of lights given by the first nn of them. The chance falls roughly like 1/n1/\sqrt{n}, and the bound keeps climbing, roughly like n\sqrt{n}, with no sign of levelling off.

# Endless city. As the replay shows, after each pair of lights
# the pursuer's lateness behind me changes by (their red) minus
# (my red); I am caught once it drops below zero. Track its
# distribution exactly, light after light.
lead = {0: 1.0}           # lateness -> probability, not caught
survive = []
for n in range(1, 2001):
    new = {}
    for d, p in lead.items():
        for step, q in ((-1, 0.25), (0, 0.5), (1, 0.25)):
            if d + step >= 0:
                new[d + step] = new.get(d + step, 0) + p * q
    lead = new
    survive.append(sum(lead.values()))
for n in (10, 100, 1000, 2000):
    s, low = survive[n - 1], 1 + sum(survive[:n])
    print(f"{n:4} lights: free {s:.4f}, mean >= {low:.1f}")

It prints

  10 lights: free 0.3364, mean >= 5.7
 100 lights: free 0.1121, mean >= 20.8
1000 lights: free 0.0357, mean >= 69.4
2000 lights: free 0.0252, mean >= 99.0
Report an error on this page

Reports are stored by Netlify. See the privacy note.