Question
Question: Nine balls, numbered 1, 2, … ,9 are put randomly at 9 equally spaced points on a circle, each point ...
Nine balls, numbered 1, 2, … ,9 are put randomly at 9 equally spaced points on a circle, each point with a ball. Let S be the sum of the absolute values of the differences of the numbers of all two neighboring balls. The number of ways such that S has the minimum possible value is
18
Solution
Let the nine points on the circle be P1,P2,…,P9 in clockwise order. Let xi be the number on the ball at point Pi. The set {x1,x2,…,x9} is a permutation of {1,2,…,9}. The sum S is given by S=∑i=19∣xi−xi+1∣, where x10=x1.
We can rewrite the sum S by considering the contribution of each unit interval (j,j+1) for j∈{1,2,…,8}. The term ∣xi−xi+1∣ represents the number of unit intervals between xi and xi+1. The sum S is the total number of times the segments (xi,xi+1) cross the boundaries between consecutive integers on the number line.
Let Cj be the number of times the boundary between the set {1,2,…,j} and {j+1,…,9} is crossed by the path x1→x2→⋯→x9→x1. An edge (xi,xi+1) crosses this boundary if one endpoint is in {1,…,j} and the other is in {j+1,…,9}.
Since the path is a closed loop, the number of times it enters the set {j+1,…,9} from {1,…,j} must equal the number of times it enters {1,…,j} from {j+1,…,9}. Thus, Cj must be an even number for every j∈{1,2,…,8}.
The sum S=∑j=18Cj. To minimize S, we must minimize each Cj. The minimum possible value for an even number is 2.
If Cj=2 for all j=1,…,8, the sum S=∑j=182=8×2=16.
Let's check if S=16 is achievable.
Consider the arrangement where the numbers are in increasing order: 1,2,3,4,5,6,7,8,9. The differences are ∣1−2∣=1,∣2−3∣=1,…,∣8−9∣=1, and ∣9−1∣=8. The sum is 8×1+8=16.
In this arrangement, for any j∈{1,…,8}, the set {1,…,j} is 1,2,…,j and the set {j+1,…,9} is j+1,…,9. The path 1→2→⋯→j→j+1→⋯→9→1 crosses the boundary between {1,…,j} and {j+1,…,9} at two points: the edge (j,j+1) and the edge (9,1). So Cj=2 for all j. This confirms that the minimum value of S is 16.
We need to find the number of arrangements such that S=16.
The condition S=16 is equivalent to Cj=2 for all j=1,…,8.
Cj=2 means that the numbers {1,…,j} and {j+1,…,9} must be arranged in two contiguous blocks on the circle. For example, x1,…,xj are a permutation of {1,…,j} and xj+1,…,x9 are a permutation of {j+1,…,9}. The edges crossing the boundary are (xj,xj+1) and (x9,x1).
Consider the arrangement x1,x2,…,x9.
If Cj=2 for all j, then the set {1,…,j} must occupy j consecutive positions on the circle for each j.
For j=1, {1} must be in a block of size 1. This doesn't say much.
For j=8, {1,…,8} must be in a block of size 8. This means the numbers 1,…,8 must occupy 8 consecutive positions, and 9 occupies the remaining position.
Let the positions be P1,…,P9. Suppose 9 is at P1. Then P2,…,P9 must be occupied by a permutation of 1,…,8. The edges crossing the boundary between {1,…,8} and {9} are (x9,x1) and (x1,x2). So ∣x9−x1∣+∣x1−x2∣=∣x9−9∣+∣9−x2∣.
If 9 is at P1, then x1=9. The neighbors are x9 and x2. Both x9,x2∈{1,…,8}.
The sum of differences is ∣x1−x2∣+∣x2−x3∣+⋯+∣x8−x9∣+∣x9−x1∣.
With x1=9, S=∣9−x2∣+∣x2−x3∣+⋯+∣x8−x9∣+∣x9−9∣.
The remaining numbers x2,…,x9 are a permutation of {1,…,8}.
The sum of differences ∣x2−x3∣+⋯+∣x8−x9∣ is the sum of differences for an open chain of 7 numbers from {1,…,8}.
Let y1=x2,y2=x3,…,y8=x9. {y1,…,y8} is a permutation of {1,…,8}.
S=∣9−y1∣+∑i=17∣yi−yi+1∣+∣y8−9∣.
We know S=16.
∣9−y1∣+∑i=17∣yi−yi+1∣+∣y8−9∣=16.
Since yi∈{1,…,8}, ∣9−y1∣=9−y1 and ∣9−y8∣=9−y8.
18−(y1+y8)+∑i=17∣yi−yi+1∣=16.
∑i=17∣yi−yi+1∣=y1+y8−2.
The sequence y1,…,y8 is a permutation of 1,…,8. This is an open chain.
The sum of differences for an open chain y1,…,ym which is a permutation of 1,…,m is ∑i=1m−1∣yi−yi+1∣. This sum is minimized when the sequence is monotonic (increasing or decreasing).
For y1,…,y8 being a permutation of 1,…,8, the minimum value of ∑i=17∣yi−yi+1∣ is 8−1=7, achieved by 1,2,…,8 or 8,7,…,1.
If y1,…,y8 is 1,2,…,8, sum is 7. y1=1,y8=8. y1+y8−2=1+8−2=7. This matches.
If y1,…,y8 is 8,7,…,1, sum is 7. y1=8,y8=1. y1+y8−2=8+1−2=7. This matches.
So, if 9 is at P1, the numbers x2,…,x9 must be 1,2,…,8 in order, or 8,7,…,1 in order.
Arrangement 1: x1=9, x2=1,x3=2,…,x9=8. Sequence: 9,1,2,3,4,5,6,7,8.
Differences: ∣9−1∣+∣1−2∣+∣2−3∣+⋯+∣7−8∣+∣8−9∣=8+1+1+1+1+1+1+1+1=8+8=16. This works.
Arrangement 2: x1=9, x2=8,x3=7,…,x9=1. Sequence: 9,8,7,6,5,4,3,2,1.
Differences: ∣9−8∣+∣8−7∣+⋯+∣2−1∣+∣1−9∣=1+1+1+1+1+1+1+1+8=8+8=16. This works.
So, for a fixed position of 9 (say P1), there are 2 possible arrangements for the other numbers.
The number 9 can be placed at any of the 9 positions.
If 9 is at Pi, then its neighbors xi−1 (or x9 if i=1) and xi+1 (or x1 if i=9) must be the ends of a monotonic sequence of the numbers {1,…,8} arranged in the remaining 8 positions.
Let 9 be at P1. The sequence is 9,x2,…,x9. {x2,…,x9} is a permutation of {1,…,8}.
The sequence x2,x3,…,x9 must be 1,2,…,8 or 8,7,…,1.
This gives 9,1,2,3,4,5,6,7,8 and 9,8,7,6,5,4,3,2,1.
These arrangements are considered distinct if they are different when read from P1 clockwise.
Let's fix the position P1. There are 9 choices for the number at P1.
If x1=9, then x2,…,x9 must be 1,2,…,8 or 8,7,…,1. This gives 2 arrangements starting with 9 at P1.
9,1,2,3,4,5,6,7,8
9,8,7,6,5,4,3,2,1
What if x1=1? Then its neighbors x9,x2 must be the ends of a monotonic sequence of 2,…,9.
The remaining numbers x2,…,x9 are a permutation of {2,…,9}.
S=∣1−x2∣+∣x2−x3∣+⋯+∣x8−x9∣+∣x9−1∣=16.
Since xi∈{2,…,9} for i=2,…,9, ∣1−x2∣=x2−1 and ∣x9−1∣=x9−1.
(x2−1)+∑i=28∣xi−xi+1∣+(x9−1)=16.
∑i=28∣xi−xi+1∣=18−(x2+x9).
Let y1=x2,…,y8=x9. {y1,…,y8} is a permutation of {2,…,9}.
The minimum value of ∑i=17∣yi−yi+1∣ for a permutation of {2,…,9} is (9−2)=7, achieved by 2,3,…,9 or 9,8,…,2.
If y1,…,y8 is 2,3,…,9, sum is 7. y1=2,y8=9. 18−(y1+y8)=18−(2+9)=7. This matches.
If y1,…,y8 is 9,8,…,2, sum is 7. y1=9,y8=2. 18−(y1+y8)=18−(9+2)=7. This matches.
So, if x1=1, the sequence x2,…,x9 must be 2,3,…,9 or 9,8,…,2.
Arrangement 3: 1,2,3,4,5,6,7,8,9. Differences: 1, 1, ..., 1, 8. Sum = 16.
Arrangement 4: 1,9,8,7,6,5,4,3,2. Differences: 8, 1, ..., 1, 1. Sum = 16.
In general, the minimum sum S=16 is achieved when the numbers are arranged in an almost monotonic sequence.
The sequence must be of the form k,k+1,…,9,1,2,…,k−1 or its reverse, but with one break in monotonicity.
The arrangements that achieve the minimum sum are those where the numbers 1,2,…,9 are placed consecutively around the circle, either in increasing or decreasing order.
Sequence 1: 1,2,3,4,5,6,7,8,9. The sum is ∣1−2∣+∣2−3∣+⋯+∣8−9∣+∣9−1∣=1×8+8=16.
Sequence 2: 9,8,7,6,5,4,3,2,1. The sum is ∣9−8∣+∣8−7∣+⋯+∣2−1∣+∣1−9∣=1×8+8=16.
Any cyclic shift of these sequences is considered a different arrangement on the fixed points P1,…,P9.
From sequence 1:
1,2,3,4,5,6,7,8,9
2,3,4,5,6,7,8,9,1
...
9,1,2,3,4,5,6,7,8
There are 9 such cyclic shifts. All of them result in S=16.
From sequence 2:
9,8,7,6,5,4,3,2,1
8,7,6,5,4,3,2,1,9
...
1,9,8,7,6,5,4,3,2
There are 9 such cyclic shifts. All of them result in S=16.
Are there any overlaps between the two sets of arrangements?
The first set consists of sequences like (k,k+1,…,9,1,…,k−1).
The second set consists of sequences like (k,k−1,…,1,9,…,k+1).
For example, 1,2,…,9 (from set 1 with k=1) and 1,9,8,…,2 (from set 2 with k=1). These are different sequences.
The sequence 1,2,…,9 is not a cyclic shift of 9,8,…,1.
The sequence 1,2,3,…,9 has differences (1, 1, 1, 1, 1, 1, 1, 1, 8).
The sequence 9,8,7,…,1 has differences (1, 1, 1, 1, 1, 1, 1, 1, 8).
The cyclic shifts of 1,2,…,9 are 1,2,…,9; 2,3,…,9,1; ...; 9,1,…,8.
The cyclic shifts of 9,8,…,1 are 9,8,…,1; 8,7,…,1,9; ...; 1,9,…,2.
These two sets of sequences are distinct. For example, the sequence 1,2,3,4,5,6,7,8,9 increases initially, while 9,8,7,6,5,4,3,2,1 decreases initially. A cyclic shift preserves the relative order of elements (up to the wrap-around). So a cyclic shift of an increasing sequence (with one large drop) is still an increasing sequence (with one large drop). A cyclic shift of a decreasing sequence (with one large rise) is still a decreasing sequence (with one large rise).
Thus, the 9 cyclic shifts of 1,2,…,9 are distinct from the 9 cyclic shifts of 9,8,…,1.
Total number of ways = 9 (cyclic shifts of 1,2,…,9) + 9 (cyclic shifts of 9,8,…,1) = 18.
These are arrangements on fixed points. If the points are not fixed, we would divide by rotations and reflections. But the question says "put randomly at 9 equally spaced points on a circle, each point with a ball", implying the points are distinguishable.
The number of ways to arrange the balls on the 9 fixed points is the number of permutations of {1,…,9} that result in S=16.
These are the 18 sequences described above.
Example arrangements:
P1,P2,...,P9
1,2,3,4,5,6,7,8,9 (S=16)
9,1,2,3,4,5,6,7,8 (S=16)
...
9,8,7,6,5,4,3,2,1 (S=16)
1,9,8,7,6,5,4,3,2 (S=16)
...
Total number of arrangements = 18.