Coloring subsets

Problem:
Given a set with 2n elements, color its subsets with n elements by two colors (0 and 1) so that the following conditions hold
1) Complement condition: Each subset with n elements has the same color as its complement
2) Diffusion condition: Each subset with n+1 elements has an n-element subset with color 0 and an n-element subset with color 1

For previous results see Adam Pantel's page or paper "On splittable colorings of graphs and hypergraphs" by Z. Furedi and R. Ramamurthi

If n is even, there exists a coloring and a nice proof that it is correct. If n=1, it is trivial to show that no such coloring exists. If n is odd and more that 8 a probabilistic proof shows that such a coloring exists. We will give an explicit construction of a coloring for any odd n>1.

Solution - coloring when n>1 is odd :
Assign each element a number - we will assign each of {1,2,...2n-2,2n-1,2n+1} to exactly one element, but some other assignements will probably work too ({1...2n} does not work for small n). The sum of all elements is m = 2n2+n+1. This assignement can be generalized to subsets - the subsets will get the sum of values of its elements.
Each subset of size n now has a number between k=n(n+1)/2 and m-k , so what we now need to do is to select a function f: N -> {0,1} that will transform the sum of the subset to a color, such that the resulting coloring will fulfil the two conditions.

1) Complement condition:
If a set has sum s, then the sum of the complement will be m-s. So we will select f(s) only for s from {k..m/2}, the others will be defined as f(s)=f(m-s).

2) Diffusion condition :
This will follow from the definition of f. First, observe that m=2n2+n+1=0(mod 2) for any odd n.

f(s) will be defined as:
1 if k<=s<=m/2-2 and s-k=0 or 1(mod 4)
0 if k<=s<=m/2-2 and s-k=2 or 3(mod 4)
1 if s=m/2-1
0 if s=m/2

Because m/2-k = (n^2+1)/2 = 1(mod 4), the sequence f(k),f(k+1)...f(m-k) will always look as follows:
110011001100....11001010011....001100110011

Take a set S with n+1 elements and denote s its sum. The sums of its n+1 n-element subsets are different numbers from As={s-2n-1, s-2n+1, s-2n+2, ... s-1}. In the case analysis that will follow, we will take all the possible sums s and prove for each of them that the diffusion condition holds for each n+1-element set with this sum.
If f sends exactly n of these numbers to 0 and n of them to 1, there is always some subset with color 0 and some with color 1.
If f sends exactly n+1 of these numbers WLOG to 0 and n-1 to 1, denote b1 ... bn+1 those sent to 0 and let di = s-bi. The only bad case would be if all the n+1 subsets of size n had sums bi,  which would  imply that S consists of elements with numbers d1...dn+1 so the sum of elements in S should be d1+d2+...+dn+1. But in all the cases, this will be different from s, which is a contradiction, so S has some element such that its removal gives a subset with color 1.
The case that f sends more than n+1 of these numbers to 0 (or to 1) will never occur.


Case analysis

1)
if s<=m/2 or s>=m/2+2n+2, then As contains exactly n numbers with color 0 and n with 1.
To see this, first observe that s-2n-1 and s-2n+1 have different colors and the rest can be divided to quadruples {s-1-4p, s-2-4p, s-3-4p, s-4-4p} that always contain two numbers with color 0 and two with color 1.

2.1)
s=m/2+4p+1 where p is in {0,1,...,(n-3)/2}
The colors of numbers from As look as follows:

It contains n+1 numbers with color 0. Let's count the sum of numbers of elements whose removal leads to a set with color 0.
s' = d1+d2+...+dn+1 =(2+4i+3+4i) + 4p+1 + 4p+3 + 4p+4 +(4i+3+4i+4) + 2n+1 = (8i) + 5p + 7((n-3)/2-p) + 4p+8 + 2n+1 = (n-3)(n-1) + 5p + 7/2n - 21/2 -7p + 4p + 8 + 2n + 1 = n2 + 3/2n  + 2p + 3/2

But s = m/2+4p+1 = n2 + 1/2n + 4p + 3/2, so if s=s', then n=2p, which is impossible, because n is odd.

2.2) s=m/2+4p+2 where p is in {0,1,...,(n-3)/2}
The colors of numbers from As look as follows:

It contains n numbers with color 0 and n with number 1.

2.3) s=m/2+4p+3 where p is in {0,1,...,(n-3)/2}
The colors of numbers from As look as follows:

It contains n numbers with color 0 and n with number 1.

2.4) s=m/2+4p+4 where p is in {0,1,...,(n-3)/2}
The colors of numbers from As look as follows:

It contains n+1 numbers with color 0. Let's count the sum of numbers of elements whose removal leads to a set with color 0.
s' = d1+d2+...+dn+1 =(1+4i+2+4i) + 4p+1 + 4p+2 + 4p+4 +(4i+2+4i+3) + 2n+1 = (8i) + 3p + 5((n-3)/2-p) + 4p+7 + 2n+1 =  n2 - 4n + 3 + 3p + 5/2n - 15/2 -5p + 4p + 7 + 2n + 1 = n2 + 1/2n  + 2p + 7/2

But s = m/2+4p+4 = n2 + 1/2n + 4p + 9/2, so if s=s', then 0=2p+1, which is impossible, because p is at least 0.

3.1) s=m/2+2n-1 = n2+5/2n-1/2
The colors of numbers from As look as follows:

It contains n+1 numbers with color 0. Let's count the sum of numbers of elements whose removal leads to a set with color 0.

s' = (4i+2+4i+3) + 2n-1 + 2n+1 = (8i) + 5((n-1)/2) + 4n = n2 - 4n + 3 + 5/2n - 5/2 + 4n = n2 +5/2n + 1/2
But s = n2+5/2n-1/2, so if s=s', then 0=1, which is impossible.

3.2) s=m/2+2n = n2+5/2n+1/2
The colors of numbers from As look as follows:

It contains n+1 numbers with color 1. Let's count the sum of numbers of elements whose removal leads to a set with color 1.
s' = (4i+1+4i+2) + 2n-1 + 2n+1 = (8i) + 3((n-1)/2) + 4n = n2 - 4n + 3 + 3/2n - 3/2 + 4n = n2 +3/2n + 3/2
But s = n2+5/2n+1/2, so if s=s', then n=1, which was prohibited.

3.3) s=m/2+2n+1 = n2+5/2n+3/2
The colors of numbers from As look as follows:

It contains n+1 numbers with color 0. Let's count the sum of numbers of elements whose removal leads to a set with color 0.
s' = (4i+1+4i+4) + 2n-1 + 2n+1 = (8i) + 5((n-1)/2) + 4n = n2 - 4n + 3 + 5/2n - 5/2 + 4n = n2 +5/2n + 1/2
But s = n2+5/2n+3/2, so if s=s', then 0=1, which is impossible.

We have discussed all possible s, so the proof is complete.