Learn / Library / Expected value
Peaks in a random line
Balls numbered to are placed in a row in a uniformly random order. A ball in one of positions to is a peak if its number is larger than the numbers of both neighbours. What is the expected number of peaks? Give a fraction a/b in lowest terms.
Checking an answer needs JavaScript. The hint and the solution open without it.
Hint
For one interior position, look only at the relative order of the balls in positions i−, i and i+.
Solution
- Take an interior position and its neighbours. These balls are equally likely to be in any relative order.
- The middle position is a peak exactly when the largest of the balls is in the middle, which has probability .
- There are interior positions, from to .
- By linearity the expectation is .
Answer: