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_________.
Correct Answer :
Solution :
The correct answer is 762.
Let us solve the problem step-by-step using the Principle of Inclusion-Exclusion.
A seven-digit number is formed using the digits 0, 1, and 2. Since it is a seven-digit number, the first digit (the most significant digit) cannot be 0. Thus, the first digit must be either 1 or 2.
Let be the set of seven-digit numbers in where the digit 0 appears exactly twice.
Let be the set of seven-digit numbers in where the digit 1 appears exactly twice.
We need to find the number of elements in such that at least one of the digits 0 and 1 appears exactly twice. This is represented by the cardinality of the union of and :
Step 1: Finding (0 appears exactly twice)
Since 0 cannot be the first digit, the first digit must be 1 or 2. The remaining 6 positions must contain exactly two 0s. The other 4 positions can be filled with either 1 or 2.
We consider two cases based on the first digit:
Case 1: The first digit is 1.
We choose 2 positions for 0 from the remaining 6 positions in ways.
The remaining 4 positions can be filled with 1 or 2 in ways.
Number of ways = .
Case 2: The first digit is 2.
Similarly, we choose 2 positions for 0 from the remaining 6 positions in ways.
The remaining 4 positions can be filled with 1 or 2 in ways.
Number of ways = .
Therefore, the total number of ways is:
Step 2: Finding (1 appears exactly twice)
The first digit can be 1 or 2. We consider two cases based on the first digit:
Case 1: The first digit is 1.
Since the first digit is 1, and 1 must appear exactly twice overall, we need to place exactly one more 1 in the remaining 6 positions.
We choose 1 position for the second 1 in ways.
The remaining 5 positions can be filled with 0 or 2 in ways.
Number of ways = .
Case 2: The first digit is 2.
Since the first digit is 2, the remaining 6 positions must contain exactly two 1s.
We choose 2 positions for the 1s in ways.
The remaining 4 positions can be filled with 0 or 2 in ways.
Number of ways = .
Therefore, the total number of ways is:
Step 3: Finding (both 0 and 1 appear exactly twice)
In this case, the number must contain exactly two 0s and exactly two 1s. The remaining three digits must be 2. The first digit can be 1 or 2.
Case 1: The first digit is 1.
We need one more 1 and two 0s in the remaining 6 positions.
First, choose 1 position out of 6 for the 1: ways.
Then, choose 2 positions out of the remaining 5 for the 0s: ways.
The remaining 3 positions are automatically filled with 2s.
Number of ways = .
Case 2: The first digit is 2.
We need two 1s and two 0s in the remaining 6 positions.
First, choose 2 positions out of 6 for the 1s: ways.
Then, choose 2 positions out of the remaining 4 for the 0s: ways.
The remaining 2 positions are automatically filled with 2s.
Number of ways = .
Therefore, the total number of ways is:
Step 4: Applying the Principle of Inclusion-Exclusion
We now compute the final count:
Thus, there are exactly 762 such seven-digit numbers.
Access expert-curated educational resources and study materials—completely free.
Create, conduct, and manage professional online assessments with Mindyard. Perfect for teachers and institutes.
Copyright © 2026 Mindyard. All Rights Reserved.