In this post, I’ll describe my solution to June 2007′s Ponder This. I had felt that my solution was kind of nifty, and different from the one that was published. It had actually taken me several days to work the whole thing out.

Here’s part (2), the tougher part, of the problem: Values for a random variable are generated independently and uniformly over . By accumulating these values, your job is to reach a sum between and , where is a positive integer, and . You can ask for successive values of this variate as many times as you wish, but you must add each such value to the running total you maintain. If the accumulating sum exceeds , you loose; if you manage to get a sum between and , you win. What is the probability of winning as ?

Earlier that year, I had finished studying Knuth’s Selected Papers on Discrete Mathematics. That is a precious collection for anyone interested in discrete structures, combinatorics, asymptotics, random structures etc. I had especially enjoyed one of the papers, “The first cycles in an evolving graph” (with Flajolet & Pittel as co-authors), not only for the neat results but also for the techniques used to get asymptotic values/bounds of certain integrals. That paper helped introduce me to, and drive home the importance of, the fascinating field I later came to know as Analytic combinatorics (also this). That paper analyzes the evolution of a random graph, where edges are successively added to a set of vertices(under different random graph models). Among other results, it shows that expected length of the first cycle to appear is proportional to and the size of the component having this cycle is — quite fascinating stuff. At any rate, with these analytic techniques still fresh in my mind, I attacked the problem by trying to find a bound on the probability integral. Details follow (with a I-to-we switch).

To begin with, we use the classical Central Limit Theorem to replace the sum of independently and uniformly distributed variates (each of which had mean and variance ) with a Normal variate with mean and variance .

Now, the probability of “hitting” (i.e., achieving a sum lying within the interval) in *exactly* “moves” is , where is the probability of hitting in exactly moves and is the probability of jumping from to the desired interval in the m^{th}-move.

When , ; and when , . is the probability density function of the aforementioned normal variate; so

Thus the probability of success in precisely moves is

which simplifies to

Since we’re interested in a success in any number of moves, we must evaulate , and finish by taking the desired limit .

To evalutate the sum over , we replace the summation by integration (see caveat below) and substitute the variable of integration from to (resulting in an extra factor of ). So our final integral turs out to:

Expanding the integrand (of the first integral) in powers of , the integrand becomes:

When we integrate over and take limit , all terms other than the first go away. As for the first term, it yields since

(where is the Error function).

Whew! That was heavy going. Let us catch our breath. Okay. So the answer to the original problem turns out to be . As a sanity check, it’s value turns out to be 0 at and 1 at . Good.

*Caveat*: The above derivation is *not rigorous* (in fact, it is somewhat sloppy) for at least the following reasons:

- Convergence of many integrals/summations is implictly assumed
- The error term has not been calculated when changing a summation to an integration. Euler Summation Formula (also TAOCP 1.2.11.2) should have been used to bound the error terms.
- The Central Limit approximation has been used without being demonstrated that it is being applied only close to the peak of the distribution, and not far into the tails (unless justified)

*A question:* If you read the publisher solution on Ponder This, it says, “Values between 0 and 1 are equally likely but larger values are more likely to cause the sum to exceed . So as the differential probability that is .” *Can the reader explain the reasoning behind this differential probability?*