The search for PI

A string of letters is formed by selecting one letter at a time (uniformly at random among the 26 letters of the alphabet) and concatenating it to the end of the string. The string ends when the letters PI \text{PI} are placed at the end (in that order, with no other letters between them).

KJDMNQHTYANQDV PI \ldots \text{KJDMNQHTYANQDV}{\color{#D61F06}\text{PI}}

What is the expected value of the number of characters in this string?


The answer is 676.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Andy Hayes
May 17, 2017

Let X PI X_\text{PI} be the length of the string until the first PI \text{PI} is concatenated, and let P P be the event that the most recent letter was a P . \text{P}. For the sake of readability, let

x = E [ X PI ] y = E [ X PI P ] \begin{aligned} x &= \text{E}\left[X_\text{PI}\right] \\ y &= \text{E}\left[X_\text{PI} \mid P \right] \end{aligned}

Applying linearity of expectation :

x = 1 26 ( 1 + y ) + 25 26 ( 1 + x ) y = 1 26 ( 1 ) + 1 26 ( 1 + y ) + 24 26 ( 1 + x ) \begin{aligned} x &= \frac{1}{26}(1+y)+\frac{25}{26}(1+x) \\ y &= \frac{1}{26}(1)+\frac{1}{26}(1+y)+\frac{24}{26}(1+x) \end{aligned}

Solving this system yields x = 676 , x=676, and so the expected value of the length of the string is 676 . \boxed{676}.

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...