The professor picking keys at random out of his pocket, then throwing them into his briefcase, is the same as the professor lining up all of his keys randomly (call them key 1, key 2, ..., key n) and then trying each, one-by-one, starting with key 1 (and then key 2, etc.).

Our original question was: On average, how many keys does the professor have to try? Similarly, our new question is: In what position is the correct key, on average?

Our answer, then, is:

$ \sum_{k=1}^n k p(k) $ (For each key, the position is k, and the chance it is correct is $ p(k) $

$ = \sum_{k=1}^n k (\frac{1}{n}) $ (Since any key is equally likely, with chance $ p(k) = \frac{1}{n} $.)

$ = (\frac{1}{n}) \sum_{k=1}^n k $ (n doesn't depend on k.)

$ = \frac{1}{n} (\frac{n(n+1)}{2}) $ (Simplification)

$ = \frac{n+1}{2} $ (Simplification)

Alumni Liaison

Ph.D. on Applied Mathematics in Aug 2007. Involved on applications of image super-resolution to electron microscopy

Francisco Blanco-Silva