For the Brilliant Worldwide Competition, 1000 schools sent in teams of several male and female students. Every student competes in exactly one match with every other student that is not in the same school. A match between 2 students of the same sex is called single , and a match between 2 students of different sexes is called double . Given that the difference between total male and female students is at most 2, and the difference between single and double matches is at most 3, what is the maximum number of schools which can send an odd number of people?
Details and assumptions
There is no restriction on the number of male or female students that a particular school can send. In particular, some schools may only send students of one sex.
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.
Here's something interesting to think about (for anyone). In the given question, we have a bound of x = 2 for the difference between the number of male and female students, and a bound of y = 3 on the difference between single and double matches.
From these values, we arrive at a value of z = 1 0 for an upper bound on the number of schools that can send an odd number of students, which is derived as a function of x and y . For these values of x and y we are able to find an assignment of students to school such that we can attain the bound of 10 exactly.
When we change the values of x and y , the approach/formula we currently have will give a different answer. For what values of x and y will we be able to find an assignment of schools that we are able to exactly meet the bound z that we find? (You should ignore the 1000 schools restriction) For values where we cannot meet the z bound, are there tighter bounds that we can find?
Log in to reply
The argument goes: if ∣ M − F ∣ = x and ∣ S − D ∣ = y , then i ∑ ( m i − f i ) 2 ≤ x 2 + 2 y and hence, if N is the number of schools sending an odd number of candidates, then N ≤ x 2 + 2 y . The question, then, is whether or not it is possible to have a set-up for which N = x 2 + 2 y .
Suppose that b schools send exactly one boy and no girls, and that g schools send exactly no boys and one girl (with no other school sending in any candidates), where b = 2 1 x ( x + 1 ) + y g = 2 1 x ( x − 1 ) + y Then the number of schools sending an odd number of candidates is N = b + g = x 2 + 2 y Moreover there are M = b boys entered and F = g girls entered, so that M − F = b − g = x Finally, there are S = ( 2 b ) + ( 2 g ) single matches, and D = b g double matches. But D − S = = b g − ( 2 b ) − ( 2 g ) = 2 1 [ 2 b g − b ( b − 1 ) − g ( g − 1 ) ] 2 1 [ ( b + g ) − ( b − g ) 2 ] = 2 1 [ ( x 2 + 2 y ) − x 2 ] = y Thus it is always possible to achieve the optimal result N = x 2 + 2 y .
Suppose that School i sends m i boys and f i girls. Then the total number of male and female entrants is M = i ∑ m i F = i ∑ f i The total number of single and double games is S = 2 1 i = j ∑ ( m i m j + f i f j ) D = 2 1 i = j ∑ ( m i f j + f i m j ) Thus we have M − F = i ∑ ( m i − f i ) S − D = 2 1 i = j ∑ ( m i − f i ) ( m j − f j ) and so the requirements that ∣ M − F ∣ ≤ 2 and ∣ S − D ∣ ≤ 3 can be restated as ∣ ∣ ∣ ∣ ∣ i ∑ ( m i − f i ) ∣ ∣ ∣ ∣ ∣ ≤ 2 ∣ ∣ ∣ ∣ ∣ ∣ i = j ∑ ( m i − f i ) ( m j − f j ) ∣ ∣ ∣ ∣ ∣ ∣ ≤ 6 and hence i ∑ ( m i − f i ) 2 = ≤ [ i ∑ ( m i − f i ) ] 2 − i = j ∑ ( m i − f i ) ( m j − f j ) 2 2 + 6 ≤ 1 0 Now School i sends an odd number of entrants precisely when m i + f i is odd, which occurs precisely when m i − f i is odd. Since at most 1 0 of the values m i − f i can be nonzero, it is certainly true that no more than 1 0 schools can send an odd number of entrants.
It remains to show that it is possible for 1 0 schools to send an odd number of entrants. From the above calculations, it is clear that only the difference m i − f i matters for each school, and so we can look for an example with small numbers, which makes the counting easier. Suppose that 4 schools send 1 boy and 0 girls, while 6 schools send 0 boys and 1 girl, while the other 9 9 0 schools send nobody! Then M = 4 and F = 6 , so that ∣ M − F ∣ = 2 as required. Moreover S = 4 C 2 + 6 C 2 = 6 + 1 5 = 2 1 D = 4 × 6 = 2 4 and hence ∣ S − D ∣ = 3 . This is an example where 1 0 schools send an odd number of entrants.
Let us call the schools 1 through 1000. We denote the number of males that School i sends as m i and the number of females that School i sends as f i . For example, School 26 would send m 2 6 male students and f 2 6 female students.
Now, consider a particular configuration of m 1 , m 2 , m 3 , . . . , m 1 0 0 0 , f 1 , f 2 , f 3 , . . . , f 1 0 0 0 . We denote the difference in total male and female students as x , and the difference between single and double matches as y (let us for awhile ignore the conditions of x ≤ 2 and y ≤ 3 ).
We consider what happens when we decrease m 1 and f 1 each by 1 (of course assuming they are both ≥ 1 to begin with).
The total number of male students decreases by 1, and the total number of female students decreases by 1 as well; hence x remains constant.
The total number of single matches among the males decreases by ( m 2 + m 3 + m 4 + . . . + m 1 0 0 0 ) , i.e. the number of single matches the removed male student would have played; similarly, the total number of single matches among the females decreases by ( f 2 + f 3 + f 4 + . . . + f 1 0 0 0 ) . On the other hand, considering the double matches, the removed male student was supposed to play ( f 2 + f 3 + f 4 + . . . + f 1 0 0 0 ) of these, and the removed female student was supposed to play ( m 2 + m 3 + m 4 + . . . + m 1 0 0 0 ) of these; hence, the total number of single matches decreases by ( m 2 + m 3 + m 4 + . . . + m 1 0 0 0 + f 2 + f 3 + f 4 + . . . + f 1 0 0 0 ) , and the total number of double matches decreases by the same number, i.e. y remains constant.
Of course, it is easy to see that this method works with any School i , and illustrating with School 1 was simply for ease of explanation
Hence, noting that x and y are invariant when we remove male-female pairs of students from each school, and that the parity of the number of students sent by each school is invariant with respect to this removal as well, we may simplify the problem by removing all possible male-female pairs of students from each school, i.e. each school sends students of only one sex, and we aim to find the maximum number of schools that send an odd number of students, while fulfilling the same two conditions in the question.
note that because we have removed all possible male-female pairs, it is possible that some schools will end up sending 0 students in this new problem, that is, the schools that would have sent an equal number of male-female students
With this new problem, let us re-denote the variables for convenience. Let there be n schools sending all-males, and m schools sending all-females, where n + m = 1 0 0 0 . We denote the number of males and females sent by these schools as a 1 , a 2 , a 3 , . . . , a n and b 1 , b 2 , b 3 , . . . , b m , respectively (again note that any of these can be 0, since some schools can end up sending 0 students). We also denote A = a 1 + a 2 + a 3 + . . . + a n and B = b 1 + b 2 + b 3 + . . . + b m for convenience.
Number of males in total: A
Number of females in total: B
Number of male single matches: 2 ( a 1 ) ∗ ( a 2 + a 3 + a 4 + . . . + a n ) + ( a 2 ) ∗ ( a 1 + a 3 + a 4 + . . . + a n ) + . . . + ( a n ) ∗ ( a 1 + a 2 + a 3 + . . . + a n − 1 )
= 2 ( a 1 ) ∗ ( A − a 1 ) + ( a 2 ) ∗ ( A − a 2 ) + ( a 3 ) ∗ ( A − a 3 ) + . . . + ( a n ) ∗ ( A − a n )
= 2 A ∗ ( a 1 + a 2 + a 3 + . . . + a n ) − ( a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 )
= 2 A 2 − ( a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 )
Number of female single matches (similarly): 2 B 2 − ( b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 )
Number of double matches: A B
Therefore, the conditions reduce to the following 2 equations:
Note that (2) can be further simplified to:
∣ 2 A 2 + B 2 − 2 A B − 2 a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 + b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 ∣ ≤ 3
⇒ ∣ 2 ( A − B ) 2 − 2 a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 + b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 ∣ ≤ 3
Since both fractions are clearly ≥ 0 ,
⇒ 2 ( A − B ) 2 − 3 ≤ 2 a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 + b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 ≤ 2 ( A − B ) 2 + 3
By the first condition, 0 ≤ ( A − B ) 2 ≤ 4 , so,
⇒ 0 − 3 ≤ 2 a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 + b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 ≤ 2 + 3
The left half of the inequality is obvious, but when we examine the right half,
⇒ a 1 2 + a 2 2 + a 3 2 + . . . + a n 2 + b 1 2 + b 2 2 + b 3 2 + . . . + b m 2 ≤ 1 0
Of course, all of a 1 , a 2 , a 3 , . . . , a n and b 1 , b 2 , b 3 , . . . , b m are integers, hence, it is clear that at most 10 of these variables have a nonzero value. That is, at least n + m − 1 0 = 9 9 0 of the other variables will have to be 0. Recall here that if any of the variables here are 0, the corresponding school would have sent '0' students, i.e. an equal number of male-female students, which is an even number of students. Thus, there are at least 990 schools sending an even number of students, and the maximum number of schools which can send an odd number of students is simply 10 (of course this can be easily constructed by setting an arbitrary 10 of a 1 , a 2 , a 3 , . . . , a n , b 1 , b 2 , b 3 , . . . , b m to be 1, and the rest 0).
Will setting an arbitrary set of 10 of a 1 , a 2 , … a n , b 1 , b 2 , … b m equal to 1 always result in a set that satisfies the given conditions?
Log in to reply
Oops missed that out! We would need the first condition of ∣ A − B ∣ ≤ 2 to hold as well, so the possible cases would be 4 a 's 6 b 's, or 5 each. Thanks!
Log in to reply
Do both of those possibilities give a valid number of ∣ singles matches − doubles matches ∣ ?
Log in to reply
@Lino Demasi – For 4 a 's 6 b 's, there will be 6 A single matches, and 15 B single matches, and 24 double matches in total, so this is valid.
For 5 each, there will be 10 A and B single matches each, and 25 double matches in total, which is not valid though.
Let's denote the number of males and females in the i th school as m i and f i . The number of single matches is then S = i < j ∑ m i m j + f i f j and the number of double matches is D = i < j ∑ m i f j + f i m j .
We want to get our hands on the difference S − D . So let's write S − D = i < j ∑ ( m i − f i ) ( m j − f j ) .
We note here the useful identity 2 a b = ( a + b ) 2 − a 2 − b 2 that helps us rewrite S − D using only squares 2 ( S − D ) = ( i ∑ ( m i − f i ) ) 2 − i ∑ ( m i − f i ) 2 . The first term of the right is simply the square of the difference between the total number of males and females. Let's denote this as A 2 . The second sum is over squares of differences in individual teams. If every team had the same number of males and females the second sum would vanish and we would have 2 ( S − D ) = A 2 . But in this case every school would have even number of players. So what we want to do instead is maximize the second sum by having as many schools as possible having k males and k + 1 females (or vice versa). In that case the second sum precisely measures the number of schools having odd number of players. Denote the second sum by B 2 .
We have B 2 = A 2 + 2 ( D − S ) . We know that ∣ A ∣ , the total difference in gender, is at most 2 and D − S is at most 3 . Making them both as big as possible maximizes B 2 so that, B 2 = 2 2 + 2 ⋅ 3 = 1 0 .
This shows that 10 is an upper bound, but doesn't show that it is the correct answer. You have 2 and 3 as upper bounds on ∣ A ∣ and D − S , but it is not cleat that there is a configuration of schools which will attain those maximums simultaneously, so for a complete solution you also need to show that there exists a configuration where there are 10 such schools.
Log in to reply
Sure, but that's so simple I omitted it. Just let 9 9 0 schools have the same number of males and females, 6 schools one more female than male and 4 schools one more male than female. Then the total gender difference is 2 and there are 3 more doubles than singles, according to the main equation.
You can ignore any students at any school who can be paired off in a male-female pair, since they do not change any male-female or single-double differences.
Let M = # unpaired males
Let F = # unpaired females
Let S = # singles matches involving unpaired students of same sex
Let D = # doubles matches involving unpaired students of different sexes
S <= M(M-1)/2 + F(F-1)/2 (equality if max of 1 unpaired student per school)
D = MF
MF = D <= S + 3 <= (MM-M)/2 + (FF-F)/2 + 3
2MF <= MM - M + FF - F + 6
M+F <= MM - 2MF + FF + 6 = (M-F)^2 + 6 <= 2^2 + 6 = 10
Maximum # of odd schools <= Maximum # of unpaired students = M+F = 10
The maximum occurs when M=6, F=4 or when F=6, M=4 and no school has more than one unpaired student.
In that case: S = 6 5/2 + 4 3/2 = 15+6 = 21
D = 6*4 = 24
Without loss of generality we can number the schools, so we will say that there is a first, a second a third school and so on...
We will call m n the number of male students sent by the n -th school, f n the number of female students sent by the n -th school. And we will call d n the difference between them. i.e. d n : = m n − d n
Now we can rewrite our problem in term of those variables. Saying that the difference between total male and female students is at most 2 equivalent to say that ∣ ∣ ∣ ∣ ∣ i = 1 ∑ 1 0 0 0 d i ∣ ∣ ∣ ∣ ∣ ≤ 2 . While saying that the difference between single and double matches is at most 3 is the same as ∣ ∣ ∣ ∣ ∣ 1 ≤ i < j ≤ 1 0 0 0 ∑ d i d j ∣ ∣ ∣ ∣ ∣ ≤ 3 In fact the total number of single matches is 1 ≤ i < j ≤ 1 0 0 0 ∑ ( m i m j ) + 1 ≤ i < j ≤ 1 0 0 0 ∑ ( f i f j ) = 1 ≤ i < j ≤ 1 0 0 0 ∑ ( m i m j + f i f j ) the total number of double matches is 1 ≤ i < j ≤ 1 0 0 0 ∑ ( m i f j ) + 1 ≤ i < j ≤ 1 0 0 0 ∑ ( f i m j ) = 1 ≤ i < j ≤ 1 0 0 0 ∑ ( m i f j + f i m j ) Therefore the difference between them is 1 ≤ i < j ≤ 1 0 0 0 ∑ ( m i m j − m i f j − f i m j + f i f j ) = 1 ≤ i < j ≤ 1 0 0 0 ∑ ( ( m i − f i ) ( m j − f j ) ) Whose absolute value is equal to the L H S of the previous inequality.
We have a well known identity: i = 1 ∑ 1 0 0 0 d i 2 = ( i = 1 ∑ 1 0 0 0 d i ) 2 − 2 ⋅ 1 ≤ i < j ≤ 1 0 0 0 ∑ ( d i d j ) Using the inequalities we have found we can show that i = 1 ∑ 1 0 0 0 d i 2 ≤ 2 2 + 2 ⋅ 3 = 1 0 We know that every d i is an integer. Therefore there are at most 1 0 of them that are non-zero.
It should be clear at this stage that the number of students sent by the n -th school has the same parity as d n . This can be seen by the fact that m n + f n ≡ m n + f n − 2 ⋅ f n ≡ d n ( m o d 2 )
This means that there are at most 1 0 schools that sent an odd number of students. We will now show that it is actually possible that only 1 0 schools sent an odd number of students.
It is sufficient to take: d i = 1 1 ≤ i ≤ 6 d j = − 1 7 ≤ j ≤ 1 0 d k = 0 1 1 ≤ k ≤ 1 0 0 0
The 2 inequalities holds, in fact: ∣ ∣ ∣ ∣ ∣ i = 1 ∑ 1 0 0 0 d i ∣ ∣ ∣ ∣ ∣ = 2 . and ∣ ∣ ∣ ∣ ∣ 1 ≤ i < j ≤ 1 0 0 0 ∑ d i d j ∣ ∣ ∣ ∣ ∣ = ( 2 6 ) + ( 2 4 ) − 6 ⋅ 4 = 1 5 + 6 − 2 4 = 3 because we can ignore the 0 s and we get 1 iff we multiply 1 by 1 or − 1 by − 1 . While we get − 1 otherwise.
Now... how came that this week I have solved all the combinatorics problem and I got from level 5 to level 4 ? I have even given this nice proof of the hardest one!
Looks like a big Trololo from Brilliant!
If we add or remove a boy,girl pair from one school then the difference between double and single matches is unchanged, by symmetry. So we can assume without loss of generality that each school only sends students of one gender, with some schools perhaps not sending any students.
Let B be the total number of boys sent, and G be the total number of girls sent. Then D = B × G is the total number of double matches.
To work out the number of single matches: if each boy is from a different school, then the number of boy-boy matches will be 2 1 B ( B − 1 ) . However, if some boys are from the same school, they do not play each other. So we can say that the number of singles matches S:
2 S = B ( B − 1 ) + G ( G − 1 ) − k
where k is an even non-negative integer. Combining these two formulae with the constraint that ∣ D − S ∣ ≤ 3 we get:
∣ B ( B − 1 ) + G ( G − 1 ) − k − 2 B G ∣ ∣ B 2 − 2 B G + G 2 − ( B + G ) − k ∣ ∣ ( B − G ) 2 − ( B + G + k ) ∣ ≤ 6 ≤ 6 ≤ 6
We are also given the constraint ∣ B − G ∣ ≤ 2 . Applying this constraint to the last line above gives:
B + G + k ≤ 1 0
Thus the maximum possible value for B + G is 10, which may occur when B − G = 2 . This maximal value can be realized by a configuration where all students are from a school that sent an odd number of students, i.e. 6 schools send 1 boy and 4 schools send 1 girl (or vice versa), so the answer we want is 1 0 .
This actually proves that the only configurations which attain the maximum are when 6 schools send 1 more boy than girl, and 4 schools send 1 more girl than boy, and vice versa. Otherwise k > 0 .
Problem Loading...
Note Loading...
Set Loading...
Let m i be the number of males on the i th team and let f i be the number of females on the i th team. We can write our two conditions as follows:
∣ ∣ ∣ ∣ ∣ i ∑ ( m i − f i ) ∣ ∣ ∣ ∣ ∣ ≤ 2 ∣ ∣ ∣ ∣ ∣ i , j ∑ ( m i − f i ) ( m j − f j ) ∣ ∣ ∣ ∣ ∣ ≤ 3
(Here we are noting that, between schools i and j, the number of single games is m i m j + f i f j and the number of double games is m i f j + m j f i , so their difference is m i m j − m i f j − m j f i + f i f j = ( m i − m j ) ( f i − f j ) ). From here on, let n i = m i − f i . Note that if school i sends an odd number of people, then n i is at least 1 (since there cannot be the same number of males and females from this school).
Now, squaring the first inequality we get that
i ∑ n i 2 + 2 i , j ∑ n i n j ≤ 4
But we know that ∣ ∣ ∣ ∑ i , j n i n j ∣ ∣ ∣ ≤ 3 , so ∑ i , j n i n j ≥ − 3 and it follows that
i ∑ n i 2 ≤ 1 0
This, along with our previous observation, implies that at most 10 schools can send an odd number of people. Equality is attained when six schools send one male and four schools send one female.