Solveeit Logo

Question

Question: Let S be the set of all seven-digit numbers that can be formed using the digits 0, 1 and 2. For exam...

Let S be the set of all seven-digit numbers that can be formed using the digits 0, 1 and 2. For example, 2210222 is in S, but 0210222 is NOT in S. Then the number of elements x in S such that at least one of the digits 0 and 1 appears exactly twice in x, is equal to _____________.

Answer

762

Explanation

Solution

Let S be the set of all seven-digit numbers that can be formed using the digits 0, 1 and 2. A seven-digit number must have the first digit non-zero. The digits allowed are 0, 1, 2. So, the first digit can be 1 or 2. The remaining six digits can be 0, 1, or 2. The total number of elements in S is 2×36=2×729=14582 \times 3^6 = 2 \times 729 = 1458.

We are looking for the number of elements x in S such that at least one of the digits 0 and 1 appears exactly twice in x. Let A be the set of numbers in S where the digit 0 appears exactly twice. Let B be the set of numbers in S where the digit 1 appears exactly twice. We want to find AB=A+BAB|A \cup B| = |A| + |B| - |A \cap B|.

To find A|A|, we count the number of 7-digit numbers in S with exactly two 0s. The digits used are two 0s, and five digits from {1, 2}. The first digit cannot be 0. Case 1: The first digit is 1. The first digit is 1. We need to place two 0s and four digits from {1, 2} in the remaining 6 positions. The number of ways to choose the positions for the two 0s from the remaining 6 positions is (62)\binom{6}{2}. The remaining 4 positions must be filled with digits from {1, 2}. There are 242^4 ways. Number of elements in this case = (62)×24=15×16=240\binom{6}{2} \times 2^4 = 15 \times 16 = 240.

Case 2: The first digit is 2. The first digit is 2. We need to place two 0s and four digits from {1, 2} in the remaining 6 positions. The number of ways to choose the positions for the two 0s from the remaining 6 positions is (62)\binom{6}{2}. The remaining 4 positions must be filled with digits from {1, 2}. There are 242^4 ways. Number of elements in this case = (62)×24=15×16=240\binom{6}{2} \times 2^4 = 15 \times 16 = 240.

Total number of elements in S with exactly two 0s is A=240+240=480|A| = 240 + 240 = 480.

To find B|B|, we count the number of 7-digit numbers in S with exactly two 1s. The digits used are two 1s, and five digits from {0, 2}. The first digit cannot be 0. Case 1: The first digit is 1. The first digit is 1. We need to place one more 1 and five digits from {0, 2} in the remaining 6 positions. The number of ways to choose the position for the second 1 from the remaining 6 positions is (61)\binom{6}{1}. The remaining 5 positions must be filled with digits from {0, 2}. There are 252^5 ways. Number of elements in this case = (61)×25=6×32=192\binom{6}{1} \times 2^5 = 6 \times 32 = 192.

Case 2: The first digit is 2. The first digit is 2. We need to place two 1s and four digits from {0, 2} in the remaining 6 positions. The number of ways to choose the positions for the two 1s from the remaining 6 positions is (62)\binom{6}{2}. The remaining 4 positions must be filled with digits from {0, 2}. There are 242^4 ways. Number of elements in this case = (62)×24=15×16=240\binom{6}{2} \times 2^4 = 15 \times 16 = 240.

Total number of elements in S with exactly two 1s is B=192+240=432|B| = 192 + 240 = 432.

To find AB|A \cap B|, we count the number of 7-digit numbers in S with exactly two 0s and exactly two 1s. The digits used are two 0s, two 1s, and three 2s (since 2+2+3=72+2+3=7). The first digit cannot be 0. Total permutations of two 0s, two 1s, and three 2s is 7!2!2!3!=50402×2×6=504024=210\frac{7!}{2! 2! 3!} = \frac{5040}{2 \times 2 \times 6} = \frac{5040}{24} = 210. We subtract the number of such arrangements that start with 0. If the first digit is 0, the remaining 6 digits must contain one 0, two 1s, and three 2s. The number of permutations of these 6 digits is 6!1!2!3!=7201×2×6=72012=60\frac{6!}{1! 2! 3!} = \frac{720}{1 \times 2 \times 6} = \frac{720}{12} = 60. Number of elements in S with exactly two 0s and exactly two 1s is AB=21060=150|A \cap B| = 210 - 60 = 150.

Using the principle of inclusion-exclusion: AB=A+BAB=480+432150=912150=762|A \cup B| = |A| + |B| - |A \cap B| = 480 + 432 - 150 = 912 - 150 = 762.

The number of elements x in S such that at least one of the digits 0 and 1 appears exactly twice in x is 762.

The final answer is 762\boxed{762}.