The set of integers is permuted into a random order. What is the expected number of peaks in the resulting permutation?
Details and assumptions
A peak in a permutation occurs when an integer is larger that the integers on both sides of it. A peak cannot occur in the first or last positions.
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.
Solution 1: Consider any 3 distinct integers from the set { 1 , 2 , … , n } . There are ( 3 n ) ways to choose 3 such integers and there are 2 ways to order them such that the larger one is first. There are ( n − 2 ) ! arrangements which will have this as a subsequence. Thus, over all n ! arrangements, there are ( 3 n ) × 2 × ( n − 2 ) ! peaks. The expected number of peaks will be 6 × n ! n × ( n − 1 ) × ( n − 2 ) × 2 × ( n − 2 ) ! = 3 ( n − 2 ) . When n = 8 0 0 this gives 3 7 9 8 = 2 6 6 .
Solution 2: For i = 1 to 7 9 8 , let I i be the indicator variable that the i + 1 th position is a peak. Then I i is independent of all the other values, except that of i , i + 1 , i + 2 . By considering all permutations of these values, we see that E [ I i ] = 3 1 . Hence, by linearity of expectation, the number of peaks is 7 9 8 E [ I i ] = 2 6 6 .