A permutation π of { 1 , 2 , … , n } (with n ≥ 3 ) has a local maximum at a position k if the two neighbouring numbers (or, in case k = 1 or k = n , the one neighbouring number) are both smaller than the number in position k .
What is the average number of local maxima of a permutation of { 1 , 2 , … , n } , averaging over all such permutations for n = 2 0 1 5 ?
Bonus - Generalize the above problem for n .
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.
The general formula for the average number of local maxima over the set of permutations of A n = { 1 , 2 , … , n } is 3 n + 1 .
This can be proved formally by induction, but I won't write out the whole proof here. By looking at the case moving from n = 3 to n = 4 , we can gain a little intuition about how to count these maxima.
There are 6 ways to permute A 3 ; four of them result in one local maximum (i.e. 2 and 3 are adjacent) and the other two result in two local maxima (i.e. 1 is between 2 and 3). It should be clear that to get all 24 of the permutations of A 4 , we must "insert" the number 4 somewhere into one of the permutations of A 3 : this is because for each of the six permutations of A 3 , we can insert 4 in four different positions, and each of these must result in a distinct permutation of A 4 (why?).
Considering only the permutations of A 3 with one local maximum, we know that when we insert 4 ANYWHERE, it will be a local (in fact, absolute) maximum. However, not all of the available places for 4 will result in an additional local maximum. In fact, it's easy to see that out of the four slots available for inserting 4, exactly two of them will create a permutation of A 4 with two local maxima, and the other two will create a permutation of A 4 with only one local maximum. So, out of the 16 such permutations, exactly 8 will have two maxima, and the other 8 will have one maximum.
Now considering only the permutations of A 3 with two local maxima, we can see that no matter where we place the 4, we will always have two local maxima in our new larger permutation. So, out of the remaining 8 possible permutations of A 4 , each has 2 local maxima.
In total, we have an average of 2 4 1 6 ∗ 2 + 8 = 3 5 local maxima over all permutations of A 4 . This same reasoning can be used in an induction proof for the general formula. I'd love to see a full solution typed up, but I'm on my phone so this was already pretty taxing X-p
Sweet problem!!
Correct! But can you try to prove that it's 3 n + 1 without induction?
Problem Loading...
Note Loading...
Set Loading...
Key idea : Probabilistic Method and Linearity of expectation
Details: Assume that we generate a permutation uniformly at random from the set of all permutations of { 1 , 2 , … , n } . Let I k denote the indicator variable that the k th position in the permutation is a local maxima. Then it is clear that P ( I 1 = 1 ) = P ( I n = 1 ) = 2 1 and P ( I m = 1 ) = 3 1 , ∀ m = 1 , n The last equation follows because given any three distinct numbers, there are two ways in which we can arrange them (out of total six ways) such that the maximum number appears at the middle.
Hence if the random variable M denotes the number of local maxima in a given permutation then M = k = 1 ∑ n I k
Note that the random variables { I k } are mutually dependent. However, the linearity of expectation holds and we have E M = k = 1 ∑ n E I k = k = 1 ∑ n P ( I k = 1 ) = 2 . 2 1 + ( n − 2 ) 3 1 = 3 n + 1 ■