In how many ways can the sequence be rearranged so that no three consecutive terms are increasing and no three consecutive terms are decreasing?
- A)
- B)
- C)
- D)
- E)
Answer
D
Key insight
The terms must go up, down, up, down, or the reverse. In the up-down pattern 5 must sit in position 2 or 4, and each spot gives 8 ways.
Solution
1. Between each pair of neighbours the sequence goes either up or down. Two ups in a row would make three increasing terms, and two downs in a row three decreasing terms. So ups and downs must alternate.
2. That leaves two patterns: up, down, up, down (like ) and down, up, down, up.
3. Count the up-down pattern first: . Positions and are "peaks" (bigger than both neighbours) and positions are "valleys".
4. The biggest number, , cannot be in a valley, because a valley is smaller than a neighbour. So is at position or position .
5. at position . The condition holds automatically, so can be any of the other four numbers: choices. The three numbers left fill positions with , so the biggest of the three goes in the middle and the other two can go either way round: choices. That is ways.
For example, with the numbers left are , giving and .
6. at position . Reading a sequence backwards turns this case into the last one, so it also gives ways.
7. So there are up-down sequences.
8. For the down-up pattern, replace every number by (so , , and stays). This turns every up into a down, so each up-down sequence becomes a down-up one: becomes . There are down-up sequences too.
9. Total: .
The answer is .
Why this works
"No three in a row going the same way" forces the sequence to zigzag, and in a zigzag the biggest number must be a peak. Placing the biggest number first makes the rest of the count short, and two flips (reading backwards, and replacing by ) mean only one small case has to be counted by hand.
Alternative approach
In the up-down pattern, count by which two numbers are the peaks (positions and ).
- Peaks and : they can be in either order, and the valleys can go anywhere, since every valley is smaller than every peak. That is ways.
- Peaks and : the valley is bigger than , so it may only touch . It must sit at the end next to , and then and fill the other two valleys in ways. With in either peak spot, that is ways.
- A peak of or less is impossible, since it would need two smaller neighbours.
That gives , and doubling for the down-up pattern gives .
The trap
Counting only the pattern that starts by going up and answering 16, forgetting the pattern that starts by going down.
Concise solution
Between consecutive terms the sequence either rises or falls. Two rises in a row would be three increasing terms, and two falls in a row three decreasing terms, so rises and falls must alternate. There are two shapes: up-down-up-down () and down-up-down-up.
Count the up-down shape. The value can only sit at a peak, position or .
- in position : the condition is automatic, so can be any of the other four values. The remaining three values fill positions with : must be their maximum and can be in either order, ways. Total .
- in position : the mirror image (read the sequence backwards), also .
So there are up-down arrangements. Replacing each term by flips every comparison, matching up-down arrangements with down-up ones, so there are of those too.
Total: . The answer is .
Review in the AoPS books
- Introduction to Counting & Probability, Chapter 2: Basic Counting Techniques (§2.5)
- Introduction to Algebra, Chapter 22: Special Manipulations (§22.3)
- Introduction to Counting & Probability, Chapter 3: Correcting for Overcounting (§3.2, §3.4)
- Prealgebra, Chapter 14: Counting (§14.3)
Techniques
Split into exhaustive cases and handle each · Exploit symmetry to reduce work or pair up objects