Probability & Random Variables


Answer & solution
Answer: [n! / ((n−K+1)! n^(K−1))]·(K−1)/n for 2≤K≤n+1; 0 otherwise. (no official key was published)
The event consists of two parts: the first K−1 insertions are collision-free, and the Kth key hits one of their occupied buckets. Given the first part, there are exactly K−1 occupied buckets, so the conditional probability of the second part is (K−1)/n.
For 2≤K≤n+1, the requested probability is therefore
[n(n−1)…(n−K+2)/nK−1]·(K−1)/n
= n!(K−1) / ((n−K+1)! nK).
The upper endpoint n+1 is legitimate: the first n keys could fill all n buckets without a collision, after which the next key certainly collides. Its probability is n!/nn. For K=1 the event is impossible because an empty table has no occupied bucket. For K>n+1, a first collision must already have happened, so the probability is also zero.
As a check, write pj for the probability of no collision after j insertions. Then P(first at K)=pK−1−p_K. Summing from K=2 to n+1 telescopes to p1−pn+1=1, as required. For n=2 the probabilities are 1/2 at K=2 and 1/2 at K=3. These arguments all use independent uniform bucket choices; the source's uniform marginals alone do not determine the distribution of the first collision.