Power Laws for Monkeys Typing Randomly: The Case of Unequal Probabilities

An early result in the history of power laws, due to Miller, concerned the following experiment. A monkey types randomly on a keyboard with $N$ letters $(N >> 1)$ and a space bar, where a space separates words. A space is hit with probability $p$; all other letters are hit with equal probability $(1-p)/N$. Miller proved that in this experiment, the rank-frequency distribution of words follows a power law. The case where letters are hit with unequal probability has been the subject of recent confusion, with some suggesting that in this case the rank-frequency distribution follows a lognormal distribution. We prove that the rank-frequency distribution follows a power law for assignments of probabilities that have rational log-ratios for any pair of keys, and we present an argument of Montgomery that settles the remaining cases, also yielding a power law. The key to both arguments is the use of complex analysis. The method of proof produces simple explicit formulas for the coefficient in the power law in cases with rational log-ratios for the assigned probabilities of keys. Our formula in these cases suggests an exact asymptotic formula in the cases with an irrational log-ratio, and this formula is exactly what was proved by Montgomery.