Consider the sets A B C D = { 1 5 , 2 2 , 3 1 , 4 5 , 5 6 , 6 7 , 7 9 } = { 2 , 3 , 5 , 6 , 7 , 9 , 1 2 , 2 4 } = { 1 4 , 2 1 , 3 1 , 4 0 , 5 3 , 6 2 , 7 8 , 8 1 , 9 0 } = { 1 1 , 1 2 , 1 7 , 2 3 , 5 4 , 5 5 , 6 2 , 9 8 , 1 1 0 , 1 1 1 } .
How many ways are there to choose a number out of each set such that the sum of the four numbers is a multiple of 8 ?
This problem is posed by Daniel W .
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.
A powerful way to solve this is using modulo arithmetic. First step is to rewrite (and sort) the four sets modulo 8.
A = − 3 , − 2 , − 1 , − 1 , − 1 , 0 , 3
B = − 3 , − 2 , − 1 , 0 , 1 , 2 , 3 , 4
C = − 3 , − 3 , − 2 , − 2 , − 2 , − 1 , 0 , 1 , 2
D = − 2 , − 2 , − 2 , − 1 , − 1 , − 1 , 1 , 2 , 3 , 4
Notice that set B contains every possible remainder modulo 8, so the sum of the other three is irrelevant. Multiplying the number of elements in A, C and D gives
∣ A ∣ × ∣ C ∣ × ∣ D ∣ = 7 × 9 × 1 0 = 7 2 0
(Note that although we found duplicates when we rewrote the remainder modulo 8, each element is still distinct so we can simply multiply the sizes of each set)
Wonderful, never thought of that. I thought we would have to write cases considering all possible ways in which we could get a sum of 8 from the modulo 8 sets.
Log in to reply
That was my first thought too! Such a cunning trick hidden in plain sight.
I reduced all the sets to modulo 8, but just didn't get the observation after that.
just a small correction 7 * 9 * 10=630
This problem can be easily solved using modular arithmetic. Let the required sum be x .
Then,
x ≡ 0 ( mod 8 ) , that is, x leaves a remainder of 0 when divided by 8 .
The given sets can be rewritten ( mod 8 ) as follows:
A = { 7 , 6 , 7 , 5 , 0 , 3 , 7 }
B = { 2 , 3 , 5 , 6 , 7 , 1 , 4 , 0 }
C = { 6 , 5 , 7 , 0 , 5 , 6 , 6 , 1 , 2 }
D = { 3 , 4 , 1 , 7 , 6 , 7 , 6 , 2 , 6 , 7 }
If you notice, set B contains numbers which leave all possible remainders when divided by 8 . So, an appropriate number from B can be added to to sum of numbers from A , C and D to obtain a multiple of 8 .
For example, if the numbers chosen from A , C and D are 1 5 , 2 1 and 1 7 respectively, then they can be rewritten as 7 , 5 , and 1 ( mod 8 ) respectively.
Their sum is 5 3 , that is 5 ( mod 8 ) , so 3 will be chosen from set B , which is 3 ( mod 8 ) to ensure sum is 0 ( mod 8 ) .
Note that for every combination of element from sets A , C and D , there is exactly one element in set B which satisfies the required condition.
So, to find the total number of ways, we just need to find the number of combinations of elements possible from sets A , C and D .
Since no term is repeated in any set, the total number of ways to choose the three elements would be:
n ( A ) × n ( C ) × n ( D )
= 7 × 9 × 1 0
= 6 3 0
We convert all the numbers to mod 8. Then we see that B contains all the residue classes mod 8. Hence for any 3 numbers we pick from A,C,D, there is a unique B that makes the sum of the four numbers 0 mod 8. Hence there are $|A| * |C| * |D| = 7 9 10 = 630$ ways.
Notice that in modulo 8 , set B contains every residue exactly once. Thus, if we choose any three elements, one from each of A , C , D , there will be exactly one possible element to pick from B . There are 7 × 9 × 1 0 = 6 3 0 ways to pick elements from A , C , and D , so there are 6 3 0 ways total.
Really nice...I completed this by a little tedious calculations
First, analyze each element from every set modulo 8. After this, let´s pay special attention to set B. Rewriting each element modulo 8 yields:
B = { 2 , 3 , 5 , 6 , 7 , 1 , 4 , 0 ). After this, we see that every possible remainder when a number is divided by 8 is in this set.
Now, let´s say the sum after choosing the other three numbers from the other three sets is n. Regradless of the remainder of n when divided by 8, there will always be an element from B that we can choose so that [n + (element from B)] is divisible by 8, since the exact 8 possible congruences modulo 8 are in the set B.
Therefore, we see that the numbers from sets A,C,D can be chosen in any way, but the element from B can only be chosen in 1 way (depending on the remainder when the sum of the other three elements is divided by 8).
Since there are 7 elements in A, 9 in C, and 10 in D, the answer is: 7 * 9 * 10 * 1=630
awesome solution !!
Note that set B contains all the different residues modulo 8
( 9 ≡ 1 ( m o d 8 ) , 1 2 ≡ 4 ( m o d 8 ) , 2 4 ≡ 0 ( m o d 8 ) ). This means that for every triplet of numbers taken from sets A , C , D , there will be exactly one number from B where their sum will be divisible by 8. There are 7 , 9 , 1 0 elements in sets A , C , D respectively, giving the number of triplets and consequently the number of ways to choose the numbers to be 7 × 9 × 1 0 = 6 3 0
These sets have a LOT of numbers. This might look a bit frightening at first.. Until you start looking at it more closely.
Let's look at set B. If we find the numbers in that set (mod 8), we get:
B = 2 , 3 , 5 , 6 , 7 , 1 , 4 , 0
If we rearrange the numbers in that set, we get:
B = 0 , 1 , 2 , 3 , 4 , 5 , 6 , 7
Hey! That's interesting, isn't it? The set B has all of the possible remainders when dividing by 8.
This means that no matter what number we choose from sets A, C, and D.... there will always be one (and ONLY one) number from set B such that when you add the numbers together you get a multiple of 8.
So instead of checking all the possibilities that add up to a multiple of 8, we can check the amount of combinations of choosing numbers from sets A, C, and D. This is a lot easier to do!
The amount of combinations for sets A, C, and D, is the product of the amount of numbers in each of the sets.
The amount of numbers in set A is 7 .
The amount of numbers in set C is 9 .
The amount of numbers in set D is 10 .
So, the amount of combinations is:
7 ⋅ 9 ⋅ 1 0 = 6 3 ⋅ 1 0 = 6 3 0
Set B has 8 elements. Each happens to equal to a unique value mod 8. So no matter what integer you are given, exactly one element of set B can be added to it to create a multiple of 8.
Sets A, C, and D have 7, 9, and 10 elements. So there are 630 ways to choose elements from those sets. Each combination of elements from A, C, and D leaves only one choice from set B to create a sum that is a multiple of 8. Thus, a total of 620 possibilities
Problem Loading...
Note Loading...
Set Loading...
Note that set B , when reduced modulo eight, yields every possible residue modulo 8 , in the order { 2 , 3 , 5 , 6 , 7 , 1 , 4 , 0 } . Hence, for every one of the 7 × 9 × 1 0 = 6 3 0 ways there are to pick three numbers, one from each of the sets A , C , D , there exists exactly one number B that can be used to fill in the remaining gap such that the sum of the four numbers is divisible by 8 .