A unimodal permutation is a permutation with only one local maximum. That is, a unimodal permutation of n elements, σ 1 , σ 2 , ⋯ , σ n , must have σ 1 < σ 2 < ⋯ < σ k and σ k > σ k + 1 > ⋯ > σ n for some positive integer k ≤ n .
How many unimodal permutations are there of the set { 1 , 2 , 3 , 4 , 5 , 6 , 7 , 8 , 9 } ?
(Adapted from Analytic Combinatorics by Philippe Flajolet)
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.
Sorry, there was a typo in the problem making the answer 2 5 5 . I fixed it now.
I ended up getting it but I got it wrong the first time around. I am pretty sure it used to say k < n before it said k ≤ n and it caused me to miss two cases. Did you edit the question? It might have just been me not reading the question properly, I do that a lot.
Log in to reply
Yes, I edited it. Sorry for that mistake!
Hmm. Would you consider recursion at first glance? I never thought of recursion until now, and it's not too difficult to count directly.
Nice problem!
Log in to reply
I started by trying small numbers of elements and found a pattern. I think once you've found a pattern induction/recursion is a good method, although maybe it's just personal preference.
The number of unimodal permutations on n elements is 2 n − 1 . Proof: let U n be the set of unimodal permutations on { 1 , … , n } . (Identify an element of U n with the list σ 1 , … , σ n of its images.) Then the map U n + 1 → U n given by removing the largest element is surjective and two-to-one: Clearly removing the largest element preserves unimodality, and every element of U n is the image of exactly two elements of U n + 1 , because if we try to add n + 1 to an element of U n to get an element of U n + 1 , there are exactly two choices that will work: immediately before or after n .
So ∣ U n + 1 ∣ = 2 ∣ U n ∣ . The result follows by an easy induction. When n = 9 we get 2 9 − 1 = 2 5 6 .
Consider a constructive counting approach. In any unimodal permutation of our set, the 9 must be the local maximum, since it is the largest number in the set. Say that the 9 is at position i , where 1 ≤ i ≤ 9 . Then there are i − 1 elements to the left of the 9 , and 9 − i elements to the right of the 9 . We choose the elements on the left in ( i − 1 8 ) ways, and then the elements on the right are determined. The crucial step is to note that for every choice of the elements on the left, there is exactly one way to order them (in increasing order), and similarly there is one way to order the elements on the right (in decreasing order), so when 9 is at position i , there are exactly ( i − 1 8 ) unimodal permutations.
Thus, the total number of unimodal permutations is given by i = 1 ∑ 9 ( i − 1 8 ) , or, shifting indices, i = 0 ∑ 8 ( i 8 ) = 2 8 = 2 5 6 .
Problem Loading...
Note Loading...
Set Loading...
Here is the intended solution using a recurrence relation:
Begin with the case of 1 element. Obviously the only permutation is { 1 } , so there is 1 total in this case.
Now I seek to prove that the number of unimodal permutations with n elements is 2 n − 1 ; we already have the base case of n = 1 .
Assume we have proven this for n = k ; then, for n = k + 1 , increase every element in n = k by 1 and add 1 to either the beginning or the end of the new permutation. This establishes a correspondence, so that the number with n = k + 1 is precisely the number with n = k times 2 .
So by induction, the value for n elements is 2 n − 1 , so the answer is 2 9 − 1 = 2 5 6 .