Let a 1 , … , a 1 6 be the list of 2 4 = 1 6 distinct vectors which have 4 coordinates, whose values are either 0 or 1. What is the maximum possible value of a 1 ⋅ a 2 + a 3 ⋅ a 4 + ⋯ + a 1 5 ⋅ a 1 6 ?
Details and assumptions
u ⋅ v represents the dot product of vectors.
Examples of vectors which have 4 coordinates and whose entries are either 0 or 1 are: ( 0 , 0 , 0 , 0 ) , ( 1 , 1 , 1 , 1 ) , ( 0 , 1 , 0 , 1 ) , ( 1 , 0 , 0 , 0 ) .
The list is a set of all the 16 distinct vectors which satisfy the condition.
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.
This solution provides a very clear explanation for how to bound the sum, without too much considerations.
The difficulty that most solutions faced was in justifying that they had the maximum sum. Just because you maximize the possible value of a 1 ⋅ a 2 , doesn't mean that there isn't a way to reorder the vectors to increase the sum.
Arguments that start off with "clearly we want to pair the 4-vector with the 3-vector" would miss our cases where the 4-vector is paired with a 2-vector instead.
Recall that ( x 1 , x 2 , x 3 , x 4 ) ⋅ ( y 1 , y 2 , y 3 , y 4 ) = x 1 y 1 + x 2 y 2 + x 3 y 3 + x 4 y 4 equals the number of values i such that x i = y i .
Let k be the answer to the problem. Note that k also denotes the total number of "overlaps" of two 1 's among all the pairs of vectors. Also note that by symmetry, there is an equal number of "overlaps" of two 0 's among the pairs of vectors as well.
Since there are 8 pairings, each pair with 4 "overlaps" of numbers, there are 3 2 "overlaps" total. Hence, if c denotes the number of "overlaps" of one 0 and one 1 , then we have that 2 k + c = 3 2 . Thus we maximize k when we minimize c .
We see that if c < 8 , then by the Pigeon Hole Principle, there exists a pair that shares no "overlaps" of one 0 and one 1 . Since that implies the two vectors are equal, this case fails. Hence, c ≥ 8 . Since pairing vectors of the form ( 0 , x 1 , x 2 , x 3 ) with those of the form ( 1 , x 1 , x 2 , x 3 ) gets us c = 8 , that is our minimum value of c , and therefore our final value of k is 2 3 2 − 8 = 1 2 .
There are 1 6 ∗ 4 = 6 4 total entries, and 32 are 1's, 32 are 0's. That means the total sum is at most 3 2 / 2 = 1 6 .
However, that is clearly not attainable. Within any pair of vectors, there will be at least 1 "mis-matched" pair of entries where they are not the same number (otherwise the two vectors would be the same). That means that at least 8 of the 1's will be forcibly paired with 0's, which means that the total potential sum is reduced by 8 / 2 = 4 . Thus, our new maximum sum is 1 2 . This is attainable with
( 1 , 1 , 1 , 1 ) ⋅ ( 1 , 1 , 1 , 0 ) + ( 1 , 0 , 1 , 1 ) ⋅ ( 0 , 0 , 1 , 1 ) + ( 0 , 1 , 1 , 1 ) ⋅ ( 0 , 1 , 0 , 1 ) + ( 1 , 1 , 0 , 1 ) ⋅ ( 1 , 0 , 0 , 1 ) + ( 1 , 1 , 0 , 0 ) ⋅ ( 1 , 0 , 0 , 0 ) + ( 1 , 0 , 1 , 0 ) ⋅ ( 0 , 0 , 1 , 0 ) + ( 0 , 1 , 1 , 0 ) ⋅ ( 0 , 1 , 0 , 0 ) + ( 0 , 0 , 0 , 1 ) ⋅ ( 0 , 0 , 0 , 0 )
a 1 . a 2 + a 3 . a 4 + . . . + a 1 5 . a 1 6 = 2 1 ( ( ∑ i = 1 1 6 a i 2 ) − ( ∑ i = 1 8 ( a 2 i − 1 − a 2 i ) 2 ) ) . We see that: (I): ( ∑ i = 1 1 6 a i 2 ) = 3 2 because it's the sum of all squares of length of those vectors which have 4 coordinates, whose values are either 0 or 1. (II) : ( a 2 i − a 2 i − 1 ) = 0 and its coordinates are in integer , thus : ( a 2 i − a 2 i − 1 ) 2 ≥ 1 Together, (I) and (II) imply that : ∑ i = 1 8 a 2 i − 1 . a 2 i ≤ 2 1 ( 3 2 − 8 ) = 1 2 . And for: a 1 = ( 1 , 0 , 0 , 0 ) ; a 3 = ( 1 , 0 , 0 , 1 ) ; a 5 = ( 1 , 0 , 1 , 0 ) ; a 7 = ( 1 , 0 , 1 , 1 ) a 9 = ( 1 , 1 , 0 , 0 ) ; a 1 1 = ( 1 , 1 , 0 , 1 ) ; a 1 3 = ( 1 , 1 , 1 , 0 ) ; a 1 5 = ( 1 , 1 , 1 , 1 ) a 2 i = a 2 i − 1 − ( 1 , 0 , 0 , 0 ) ; i ∈ 1 ; 8 , we have the equality. Hence , the desired number is 12
The idea is to note certain inequalities regarding each of a i ⋅ a j to put an upper bound on that, and show that it's achievable. The inequalities come pretty intuitively (let the two vectors in a product to differ at exactly one position to maximize a i ⋅ a j ), but it needs to be proven formally...
For any v ∈ { 0 , 1 } 4 (basically v is a vector described in the problem), define ∣ v ∣ (called the value of v ) as the sum of its four coordinates. For example, ∣ ( 0 , 1 , 0 , 1 ) ∣ = 0 + 1 + 0 + 1 = 2 . Also, define ( i 1 , i 2 , i 3 , i 4 ) ∗ ( j 1 , j 2 , j 3 , j 4 ) as ( i 1 j 1 , i 2 j 2 , i 3 j 3 , i 4 j 4 ) ; hence the dot product u ⋅ v is ∣ u ∗ v ∣ . Note that this new operation is basically AND operation done to each component independently. Throughout this solution, u , v are distinct vectors over { 0 , 1 } 4 .
Note that ∣ u ∗ v ∣ ≤ min ( ∣ u ∣ , ∣ v ∣ ) . To see this, let u = ( i 1 , i 2 , i 3 , i 4 ) , v = ( j 1 , j 2 , j 3 , j 4 ) . Then ∣ u ∗ v ∣ = i 1 j 1 + i 2 j 2 + i 3 j 3 + i 4 j 4 , ∣ u ∣ = i 1 + i 2 + i 3 + i 4 , ∣ v ∣ = j 1 + j 2 + j 3 + j 4 . So we want to prove that i 1 j 1 + i 2 j 2 + i 3 j 3 + i 4 j 4 ≤ min ( i 1 + i 2 + i 3 + i 4 , j 1 + j 2 + j 3 + j 4 . But this is immediate; as j i ≤ 1 , i i ≥ 0 for all i , we have i 1 j 1 + i 2 j 2 + i 3 j 3 + i 4 j 4 ≤ i 1 ∗ 1 + i 2 ∗ 1 + i 3 ∗ 1 + i 4 ∗ 1 = i 1 + i 2 + i 3 + i 4 . We can prove i 1 j 1 + i 2 j 2 + i 3 j 3 + i 4 j 4 ≤ j 1 + j 2 + j 3 + j 4 by the same way, giving the desired inequality.
We will also prove that ∣ u ∗ v ∣ < max ( ∣ u ∣ , ∣ v ∣ ) . If ∣ u ∣ = ∣ v ∣ , the inequality is obvious by ∣ u ∗ v ∣ ≤ min ( ∣ u ∣ , ∣ v ∣ ) < max ( ∣ u ∣ , ∣ v ∣ ) . Otherwise, suppose ∣ u ∗ v ∣ = ∣ u ∣ = ∣ v ∣ . As u , v cannot be identical, they must differ somewhere; WLOG u has a first component of 1 and v has a first component of 0. Hence the first component of u ∗ v is 0 and hence is different from u . Meanwhile, since any component of u ∗ v cannot be greater than the corresponding component of u , the only way that ∣ u ∣ = ∣ u ∗ v ∣ is if they are identical, but we have proven that they differ at at least the first component. Hence ∣ u ∗ v ∣ < max ( ∣ u ∣ , ∣ v ∣ ) . Since ∣ u ∗ v ∣ and max ( ∣ u ∣ , ∣ v ∣ ) are integers, we have ∣ u ∗ v ∣ ≤ max ( ∣ u ∣ , ∣ v ∣ ) − 1 .
Adding the two inequalities together, we have 2 ∣ u ∗ v ∣ ≤ min ( ∣ u ∣ , ∣ v ∣ ) + max ( ∣ u ∣ , ∣ v ∣ ) − 1 = ∣ u ∣ + ∣ v ∣ − 1 ; call this inequality (1).
Now, multiply the desired expression by 2 to obtain 2 ∣ a 1 ∗ a 2 ∣ + 2 ∣ a 3 ∗ a 4 ∣ + … + 2 ∣ a 1 5 ∗ a 1 6 ∣ . We can now put an upper bound on this by (1) done to each product: 2 ∣ a 1 ∗ a 2 ∣ + 2 ∣ a 3 ∗ a 4 ∣ + … + 2 ∣ a 1 5 ∗ a 1 6 ∣ ≤ ( ∣ a 1 ∣ + ∣ a 2 ∣ − 1 ) + ( ∣ a 3 ∣ + ∣ a 4 ∣ − 1 ) + … + ( ∣ a 1 5 ∣ + ∣ a 1 6 ∣ − 1 ) = ( ∣ a 1 ∣ + ∣ a 2 ∣ + … + ∣ a 1 6 ∣ ) − 8
Now note that ( ∣ a 1 ∣ , ∣ a 2 ∣ , … , ∣ a 1 6 ∣ ) must be a permutation of ( 0 , 1 , 1 , 1 , 1 , 2 , 2 , 2 , 2 , 2 , 2 , 3 , 3 , 3 , 3 , 4 ) (the values of all possible vectors), and hence their sum is fixed: 0 + 1 + 1 + 1 + 1 + 2 + 2 + 2 + 2 + 2 + 2 + 3 + 3 + 3 + 3 + 4 = 3 2 . Hence:
2 ∣ a 1 ∗ a 2 ∣ + 2 ∣ a 3 ∗ a 4 ∣ + … + 2 ∣ a 1 5 ∗ a 1 6 ∣ ≤ ( 3 2 ) − 8 = 2 4
Hence a 1 ⋅ a 2 + a 3 ⋅ a 4 + … + a 1 5 ⋅ a 1 6 = ∣ a 1 ∗ a 2 ∣ + ∣ a 3 ∗ a 4 ∣ + … + ∣ a 1 5 ∗ a 1 6 ∣ ≤ 1 2 . It remains to find a possible configuration for this bound, which there exists:
a 1 = ( 1 , 1 , 1 , 1 ) , a 2 = ( 1 , 1 , 1 , 0 ) , a 3 = ( 1 , 1 , 0 , 1 ) , a 4 = ( 1 , 1 , 0 , 0 ) , a 5 = ( 1 , 0 , 1 , 1 ) , a 6 = ( 1 , 0 , 1 , 0 ) , a 7 = ( 0 , 1 , 1 , 1 ) , a 8 = ( 0 , 1 , 1 , 0 ) , a 9 = ( 1 , 0 , 0 , 1 ) , a 1 0 = ( 1 , 0 , 0 , 0 ) , a 1 1 = ( 0 , 1 , 0 , 1 ) , a 1 2 = ( 0 , 1 , 0 , 0 ) , a 1 3 = ( 0 , 0 , 1 , 1 ) , a 1 4 = ( 0 , 0 , 1 , 0 ) , a 1 5 = ( 0 , 0 , 0 , 1 ) , a 1 6 = ( 0 , 0 , 0 , 0 ) ,
Basically pair each vector with a 1 at its fourth component to an identical vector except that the new vector has a 0 at its fourth component. This configuration can be verified to achieve said maximum.
Hence the sought maximum is 1 2 .
Let ∣ a i ∣ be the number of coordinates equal to one in the vector a i .
If we have two vectors a i and a j , then a i ⋅ a j ≤ 2 ∣ a i ∣ + ∣ a j ∣ − 1 , because a i = a j and then we will have coordinates equal to one in a i and/or in a j that will be multiplied by zero in the dot product, so it will always be smaller than 2 ∣ a i ∣ + ∣ a j ∣ .
If all the dot products reach the maximum possible value, the sum of these values will be:
2 ( i = 1 ∑ 1 6 ∣ a i ∣ ) − 8
And:
i = 1 ∑ 1 6 ∣ a i ∣ = 0 ⋅ ( 0 4 ) + 1 ⋅ ( 1 4 ) + 2 ⋅ ( 2 4 ) + 3 ⋅ ( 3 4 ) + 4 ⋅ ( 4 4 ) = 3 2
So, the sum will be smaller or equal to 2 3 2 − 8 = 1 2 .
Now, we need to proof that is possible the sum be equal to 1 2 . For this, the vectors a 2 k − 1 and a 2 k , for k integer and 1 ≤ k ≤ 8 , need to have exactly one different coordinate, so a 2 k − 1 ⋅ a 2 k = 2 ∣ a 2 k − 1 ∣ + ∣ a 2 k ∣ − 1 .
For this, just associate the vector a i to the correspondent of the decimal number i − 1 in the Gray code so that if the 4 -bit representation of the i − 1 Gray code number is p 1 p 2 p 3 p 4 , let a i = ( p 1 , p 2 , p 3 , p 4 ) .
Call a vector (a, b, c, d) a k-vector if k of the elements are 1s. Call a 1 , a 2 , a 3 , a 4 , ..., a 1 5 , a 1 6 pairs.
Note that there is 1 4-vector, 4 3-vector, 6 2-vector, 4 1-vector and 1 0-vector.
a) The 4-vector is paired with a 3-vector,
Then we have the dot product of the two vectors 3. Now consider the other 3 3-vectors. If 1 of them is paired with 3-vector, then the resulting dot product is at most 2, and the last 3-vector can be paired with either a 2-vector or a 1-vector (or a 0-vector). Note that the all cases produces at most 4 in the sum, which gives 9 < 12. If at least 1 of them is paired with a 1-vector or 0-vector, then we are left with 2 3-vectors, 6 2-vectors, 4 1 or 0-vectors. And it's obvious that we can get at most 8 for them, and so the sum is at most 11<12. Finally consider the case where all three 3-vectors are paired with 2-vectors, then we can get at most 2 ⋅ 3 + 3 + 1 ⋅ 3 = 1 2 from them.
And we can deal with the other cases similarly so the sum is at most 1 2 .
Now 1 2 is attainable by pairing as follows :
1,1,1,1 with 1,1,1,0 giving 3
1,0,1,1 with 0,0,1,1 giving 2
1,1,0,1 with 1,1,0,0 giving 2
1,1,1,0 with 1,0,1,0 giving 2
1,0,0,1 with 1,0,0,0 giving 1
0,1,1,0 with 0,1,0,0 giving 1
0,1,0,1 with 0,0,0,1 giving 1
0,0,1,0 with 0,0,0,0 giving 0
Therefore, the answer is 3 + 2 ∗ 3 + 1 ∗ 3 = 1 2 .
To maximize its sum, the vector paired with ( 1 , 1 , 1 , 1 ) should have three 1 's, since the dot product of this pair would be the sum of the entries of the other vector, so the maximum dot product for this pair is 3 . Similarly, the vector paired with ( 0 , 0 , 0 , 0 ) should have three 0 's, since the dot product of this pair is clearly zero so we minimize the sum of the entries of the other vector. Consider any other vector with three 1 's. Since there is no other same vector, the dot product cannot be 3 . Therefore the maximum dot product for this pair is 2 . The maximum sum of dot products of pairs with vectors that has three 1 's excluding the first one mentioned is 6 . Consider any other vector with three 0 's. Since there is only one 1 , therefore the maximum dot product for this pair is 1 . The maximum sum of dot products of pairs with vectors that has three 0 's excluding the first one mentioned is 3 . Summing these up gives us 0 + 3 + 6 + 3 = 1 2 . Such a combination exists for example { ( 0 , 0 , 0 , 0 ) , ( 0 , 1 , 0 , 0 ) } , { ( 1 , 0 , 0 , 0 ) , ( 1 , 0 , 1 , 0 ) } , { ( 0 , 0 , 0 , 1 ) , ( 1 , 0 , 0 , 1 ) } , { ( 0 , 0 , 1 , 0 ) , ( 0 , 0 , 1 , 1 ) } , { ( 1 , 1 , 1 , 0 ) , ( 1 , 1 , 0 , 0 ) } , { ( 0 , 1 , 1 , 1 ) , ( 0 , 1 , 1 , 0 ) } , { ( 1 , 1 , 0 , 1 ) , ( 0 , 1 , 0 , 1 ) } , { ( 1 , 1 , 1 , 1 ) , ( 1 , 0 , 1 , 1 ) } .
Our main strategy is to minimize the scenario of 0 1 or 1 0 appearing in our dot product as what we want is 1*1, which contributes to the sum.
Claim: for a vector with n entries of one, the way to minimize the dot product is to pair it with a suitable vector of n+1 entries of one. we define a 'suitable' vector as those vectors having their n entries of one (out of n+1)coincide with all the entries of one of the vector having n entries of one.
Proof: This is obvious. Any such pairing will yield a sum of n, which is of course the maximum attainable.
With this in mind, we try to construct the sequence of vectors which will fit the above criterion. One such vector is (0,0,0,0)(1,0,0,0)+ (0,1,0,0)(1,1,0,0)+(0,0,1,0)(0,0,1,1)+(0,0,0,1)(0,1,0,1)+(1,0,1,0)(1,1,1,0)+(1,0,0,1)(1,0,1,1)+(0,1,1,0)(0,1,1,1)+(1,1,1,1)(1,1,0,1) Calculating the dot product, we find that the maximum occurs at 12.
Each vector here can be represented by a unique ordered quadruplet of 0s and 1s: a n = [ x n 1 , x n 2 , x n 3 , x n 4 ]
So, each product can be represented by a n a n + 1 = x n 1 x ( n + 1 ) 1 + x n 2 x ( n + 1 ) 2 + x n 3 x ( n + 1 ) 3 + x n 4 x ( n + 1 ) 4
In order to maximize all the products, we must maximize the number of times we have 1 × 1 in our products. In order to do so, we must minimize the number of times we have 1 × 0 , which wastes a 1.
We have 1 vector with 4 ones, 4 vectors with 3 ones, ( 2 4 ) = 6 vectors with 2 ones, 4 vectors with 1 one, and 1 vector with 0 ones.
Suppose we have a 1 = [ 1 , 1 , 1 , 1 ] . Since each vector is unique, a 2 can have at most 3 ones, and thus the product a 1 ⋅ a 2 can be at most 1 × 1 + 1 × 1 + 1 × 1 + 1 × 0 = 3 . In this case, we have one instance of 1 × 0 .
Our next largest product must be at most 2 since each vector with 3 ones must multiply by a vector with at most 2 ones that line up to produce a product. To produce a product of 2 with the minimum number of times we have 1 × 0 , we can multiply a vector with 3 ones by one with 2 ones, e.g. 1 × 1 + 1 × 0 + 0 × 0 + 1 × 1 .
There still remains 2 vectors with 3 ones, so we can have at most 2 more products of 2.
Afterwards, what's remaining are 3 vectors with 2 ones, 4 vectors with 1 one, and 1 vector with 0 ones.
Matching the 3 vectors with 2 ones with 3 vectors with 1 one gives 3 maximum products of 1. Afterwards, we match the last vector with 1 one with the 0 vector, creating a product of zero.
In the end, we have an upper limit of 3 + 2 + 2 + 2 + 1 + 1 + 1 + 0 = 1 2 as our product sum, which exists only if each product has exactly one 1 × 0 . To show that this upper limit product can exist, we can have the set of vectors a 1 = [ 1 , 1 , 1 , 1 ] , a 2 = [ 0 , 1 , 1 , 1 ] [4 pairs with 3, making 3]
a 3 = [ 1 , 0 , 1 , 1 ] , a 4 = [ 0 , 0 , 1 , 1 ] [3 pairs with 2, making 2]
a 5 = [ 1 , 1 , 0 , 1 ] , a 6 = [ 1 , 0 , 0 , 1 ] [3 pairs with 2, making 2]
a 7 = [ 1 , 1 , 1 , 0 ] , a 8 = [ 1 , 1 , 0 , 0 ] [3 pairs with 2, making 2]
a 9 = [ 1 , 0 , 1 , 0 ] , a 1 0 = [ 1 , 0 , 0 , 0 ] [2 pairs with 1, making 1]
a 1 1 = [ 0 , 1 , 0 , 1 ] , a 1 2 = [ 0 , 1 , 0 , 0 ] [2 pairs with 1, making 1]
a 1 3 = [ 0 , 1 , 1 , 0 ] , a 1 4 = [ 0 , 0 , 1 , 0 ] [2 pairs with 1, making 1]
a 1 5 = [ 0 , 0 , 0 , 1 ] , a 1 6 = [ 0 , 0 , 0 , 0 ] [1 pairs with 0, making 0]
This has a product sum of 12, our determined upper limit.
Beginning with (1,1,1,1), find pairs of vectors with the most corresponding 1s and eliminate. There is one vector pair with 3 corresponding 1s, three pairs with 2 corresponding 1s, three pairs with 1 corresponding 1s, and one pair left over with no corresponding 1s. An example pairing is listed below:
3: (1,1,1,1), (1,1,1,0)
2: (1,1,0,1), (1,1,0,0); (1,0,1,1), (1,0,1,0); (0,1,1,1), (0,1,1,0)
1: (1,0,0,1), (1,0,0,0); (0,1,0,1), (0,1,0,0); (0,0,1,1), (0,0,1,0)
0: (0,0,0,1), (0,0,0,0)
Thus, the value will be 3 ( 1 ) + 2 ( 3 ) + 1 ( 3 ) + 0 ( 1 ) = 1 2 .
The list of 16 vectors consists of: 1 vector with all of its components equal to 1 ( type I ), 1 vector with all of its components equal to zero ( type II ), 4 vectors with three 1's and one 0 as components ( type III ), 4 vectors with three 0's and one 1 as components ( type IV ), and 6 vectors with two 1's and two 2's as components ( type V ).
In order to maximize the sum of the dot products, the type IV vector must be dotted to one of the four type III vectors, thus yielding a product equal to 3 and leaving three type III vectors in the process. It is essential to realize that the highest possible dot product after such is 2 since the type III vectors (which are the only potential vectors to give a product of 3) could not have the same coordinates. To maximize the sum, the 3 type III vectors should be dotted to 3 type V vectors with the position of the 1's in the type V corresponding to its type III pair. This yields three 2's as products and also leaving three type V vectors in the process. Using the same reasoning earlier, the remaining V vectors should be dotted to three type IV vectors such that the 1 in the type IV vector corresponds to a 1 in its pair. This yields three 1's as products. Lastly, the remaining type IV vector should be dotted with the type II vector to give a product equal to zero.
Therefore, the maximum sum is equal to 3+2+2+2+1+1+1+0= 12 .
The vectors in consideration are (0;0;0;0), (0;0;0;1), (0;0;1;0), ... , (1;1;1;0), (1;1;1;1). For convenience, I will refer to the "1" values as bits. Note the following observations:
The maximum value is 12. We show that the ordering below actually produces this sum and is optimal:
a1 = (0;0;0;0), a2 = (0;0;0;1) a1.a2 = 0 a3 = (0;0;1;0), a4 = (0;0;1;1) a3.a4 = 1 a5 = (0;1;0;0), a6 = (0;1;0;1) a5.a6 = 1 a7 = (0;1;1;0), a7 = (0;1;1;1) a7.a8 = 2 a9 = (1;0;0;0), a10 = (1;0;0;1) a9.a10 = 1 a11 = (1;0;1;0), a12 = (1;0;1;1) a11.a12 = 2 a13 = (1;1;0;0), a14 = (1;1;0;1) a13.a14 = 2 a15 = (1;1;1;0), a17 = (1;1;1;1) a15.a16 = 3
Let wt(v) denote the number of ones in the vector v. First we prove:
Claim : For any a i = a j , we have 2 a i ⋅ a j ≤ w t ( a i ) + w t ( a j ) − 1 .
Proof : Consider two cases.
Thus, if S : = a 1 ⋅ a 2 + a 3 ⋅ a 4 + … + a 1 5 ⋅ a 1 6 , we have:
2 S ≤ w t ( a 1 ) + … + w t ( a 1 6 ) − 8 = 2 4
so S ≤ 1 2 . On the other hand, equality can be attained by pairing up ( x 1 , x 2 , x 3 , 0 ) and ( x 1 , x 2 , x 3 , 1 ) for all 8 possibilities of ( x 1 , x 2 , x 3 ) .
Hence, maximum value of S is 12.
Group the vectors in pairs such that you maximize the common 1's per pair. so pair four 1's with 3, the other 3 three's with two, the other 2 with 1, and the last 1 with 0. Now multiplying(dot product of vectors), (1 1 1 1) (1 1 1 0)=3 (1 1 0 1) (1 1 0 0)=2 (1 0 1 1) (1 0 1 0)=2 (0 1 1 1) (0 1 1 0)=2 (1 0 0 1) (1 0 0 0)=1 (0 1 0 1) (0 1 0 0)=1 (0 0 1 1) (0 0 1 0)=1 (0 0 0 1) (0 0 0 0)=0
Therefore,sum of the dot products of vectors=3+2+2+2+1+1+1=12.
Let me try yet a different approach. I like its elegance. It is really short, except that I give a very detailed proof here... And I will generalize it to n -tuples. (For this problem, obviously n = 4 .)
First solve a (slightly) different problem.
Let S = { ± 1 } n be the set of all n -tuples with coordinates ± 1 . There are 2 n such tuples.
Claim 1. If a , b are two distinct vectors in S , then the maximum value of a ⋅ b = n − 2 .
Proof : If k is the number of coordinates in which a and b are the same , then a ⋅ b = k − ( n − k ) = 2 k − n . If a = b then k ≤ n − 1 . Therefore the maximum value of the dot product is 2 ( n − 1 ) − n = n − 2 .
Claim 2. The elements of S can be partitioned into 2 n − 1 pairs, so that for each pair { a , b } , the dot product is a ⋅ b = n − 2 .
Proof: For any ( n − 1 ) -tuple ( c 1 , … , c n − 1 ) , take the pair a = ( c 1 , … , c n − 1 , − 1 ) and b = ( c 1 , … , c n − 1 , + 1 ) . They differ only in one coordinate, so apply Claim 1 with k = n − 1 .
From Claims 1 and 2 follows obviously:
Claim 3. This partition results in the maximum possible value of the sum of dot products, 2 n − 1 pairs ∑ a ⋅ b = 2 n − 1 ⋅ ( n − 2 ) .
Now tweak this conclusion so it fits our current problem.
To transform the coordinates ± 1 into 0 , 1 , we apply the transformation a = ( a 1 , … , a n ) ↦ a ′ = ( 2 1 ( a 1 + 1 ) , … , 2 1 ( a n + 1 ) ) = 2 1 ( a + e ) , where e = ( 1 , 1 , … , 1 ) .
Under this transformation, the dot product transforms as follows: a ′ ⋅ b ′ = 4 1 ( a + e ) ⋅ ( b + e ) = 4 1 ( a ⋅ b + ( a + b ) ⋅ e + e ⋅ e ) . The last term e ⋅ e = n .
Now take the partitioning in pairs from Claim 2 above, and apply this transformation. The sum of the 2 n − 1 dot products becomes ∑ a ′ ⋅ b ′ = ∑ 4 1 ( a ⋅ b + ( a + b ) ⋅ e + n ) = 4 1 ∑ a ⋅ b + 4 1 ( ∑ a + b ) ) ⋅ e + 4 1 ⋅ 2 n − 1 ⋅ n = 4 1 ⋅ 2 n − 1 ⋅ ( n − 2 ) + 0 + 4 1 ⋅ 2 n − 1 ⋅ n = 4 1 ⋅ 2 n − 1 ⋅ ( 2 n − 2 ) = 2 n − 2 ⋅ ( n − 1 ) .
In the last step, we used ∑ x ∈ S x = 0 , because of the symmetry of our original set of n -tuples.
Substituting n = 4 we find the answer 2 4 − 2 ⋅ ( 4 − 1 ) = 2 2 ⋅ 3 = 1 2 .
a1 should be (0,0,0,0) and a16 should be (1,1,1,1) (ascending order of binary number) so the answer is 4x3=12
Consider a single dot product x ⋅ y . In order for this dot product to be at least k , x and y must both have at least k components that are 1 . Moreover, since x and y are different, they must differ in at least one component. Therefore, the total number of components that are 1 in x and y combined must be at least 2 k + 1 .
Stated in reverse, if the total number of ones in x and y is n , then their dot product is at most 2 1 n − 2 1 . Therefore, the sum of all 8 dot products is at most 2 1 N − 4 , where N is the total number of ones in all vectors, which is easily found to be 3 2 . Therefore, we establish an upper bound 1 2 on the answer.
If we pair up the vectors such that in each dot product, the vectors differ only in the first component, which is trivially possible, it is easy to see that all the inequalities in the previous paragraph turn into equalities. Therefore, this pairing yields precisely the maximum value 1 2
In general, for 2 d vectors in d dimensions, the answer is ( d − 1 ) 2 d − 2 .
We must pair the 16 vectors and find the sum of all pairs of 1's that correspond in each pair. For example, (0,1,0,1) and (0,1,1,1) have a dot product of 2, since the second and fourth coordinates are both 1 in each. For convenience, let an n-vector be a vector with n 1's, and let a wasted 1 be one that is paired with a 0.
The total number of 1's is 32 (count, or do 2 1 6 ⋅ 4 ). We can subtract those 1's that must be paired with a 0 and divide by two to get our answer. For each 2-vector (there are 6), one 1 must be wasted when being paired. If a 2-vector is paired with a 1-vector, one 1 is wasted from the 2-vector. If a 2-vector is paired with a 3-vector, one 1 is wasted from the 3-vector. If a 2-vector is paired with another 2-vector, a 0-vector, or a 4-vector, at least 2 1's are wasted. To minimize waste, let each 2-vector be paired with either a 1-vector or a 3-vector. Now, we have 3 2 − 6 = 2 6 1's left. However, whichever vector the 0-vector is paired with, clearly at least another 1 is wasted. If a 2-vector is paired is instead paired with the 0-vector, there is two wastage instead of 1. Similarly, whichever vector the 4-vector is paired with, at least another 1 is wasted. Now, we have 3 2 − 8 = 2 4 1's left, so if 2 4 is achievable, it is correct.
Here is one way to achieve 24:
( 0 , 0 , 0 , 0 ) − ( 0 , 0 , 0 , 1 )
( 0 , 0 , 1 , 0 ) − ( 0 , 1 , 1 , 0 )
( 0 , 1 , 0 , 0 ) − ( 1 , 1 , 0 , 0 )
( 1 , 0 , 0 , 0 ) − ( 1 , 0 , 1 , 0 )
( 0 , 1 , 0 , 1 ) − ( 1 , 1 , 0 , 1 )
( 1 , 0 , 0 , 1 ) − ( 1 , 0 , 1 , 1 )
( 0 , 0 , 1 , 1 ) − ( 0 , 1 , 1 , 1 )
( 1 , 1 , 1 , 0 ) − ( 1 , 1 , 1 , 1 )
Therefore, the answer is 2 2 4 = 1 2 .
We have one vector with no 1's, four vectors with one 1's, 6 vectors with two 1's, 4 vectors with three 1's, and one vector with 4 1's.
Since the dotproduct of vectors equals the sum of the products of corresponding coordinates, clearly we should pair (0, 0, 0, 0) with any of the vectors with one 1. Using the same logic, we should pair (1, 1, 1, 1) with any of the vectors with three one's. There are 12 vectors left.
If we pair the vectors with the same number of 1's with each other, the most we could possibly get is n-1 since they are distinct. However, if we pair a vector with n-1 1's with a vector with n 1's, we can get n-1 vectors optimally. So, we pair the three remaining one-1 vectors with three two-1 vectors, and the other two-1 vectors with the three three-1 vectors, making sure that our dot products are maximized, i.e. vectors with 1's in the same places are paired with each other.
Adding these all together, we have 0 + 3 + 3(1) + 3(2), or 12 as our dot product sum.
vectors are:
a1 = 0 0 0 0
a2 = 0 0 0 1
a1.a2 = 0
a3 = 0 0 1 0
a4 = 0 0 1 1
a3.a4 = 1
a5 = 0 1 0 0
a6 = 0 1 0 1
a5.a6 = 1
a7 = 0 1 1 0
a8 = 0 1 1 1
a7.a8 = 2
a9 = 1 0 0 0
a10 = 1 0 0 1
a9.a10 = 1
a11 = 1 0 1 0
a12 = 1 0 1 1
a11.a12 = 2
a13 = 1 1 0 0
a14 = 1 1 0 1
a13.a14 = 2
a15 = 1 1 1 0
a16 = 1 1 1 1
a15.a16 = 3
so sum is = 0 + 1 + 1 + 2 + 1 + 2 + 2 + 3 = 1 2
A good solution should explain why the answer is what it is, not just show it. In your post you made no explanation of why it should be that and why that is the maximum (and, by the way, it does not have to be in those specific pairings, so your solution is flawed in that way, too).
Problem Loading...
Note Loading...
Set Loading...
So we are basically just maximizing the number of 1's in the same place paired together when we divide all 16 binary numbers into pairs, as the dot product will be 0 unless two 1's are in the same place. Note that each pair must have at least one 0 and 1 in the same place, as otherwise the two numbers in the pair would have to be the same, which is of course impossible. Therefore, of the 16*4/2=32 1's in all 16 numbers, at least 8 must not be paired with another 1. This number is the only one that matters in our dot product. With some playing around with the numbers, we see that we can achieve this maximum: 1000 0100 0010 0001 1111 1011 1101 0111 0000 1100 0011 1001 1110 1010 1001 0110 There are therefore 24 1's which are paired with other 1's, or 12 total pairs, and so the answer is 12 (We could have gotten this from counting the pairs in our pairing)