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 are placed at the end (in that order, with no other letters between them).
What is the expected value of the number of characters in this string?
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.
Let X PI be the length of the string until the first PI is concatenated, and let P be the event that the most recent letter was a P . For the sake of readability, let
x y = E [ X PI ] = E [ X PI ∣ P ]
Applying linearity of expectation :
x y = 2 6 1 ( 1 + y ) + 2 6 2 5 ( 1 + x ) = 2 6 1 ( 1 ) + 2 6 1 ( 1 + y ) + 2 6 2 4 ( 1 + x )
Solving this system yields x = 6 7 6 , and so the expected value of the length of the string is 6 7 6 .