Question:

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 __________.

Show Hint

Be careful to exclude numbers with leading 0s and apply inclusion-exclusion when counting overlapping digit patterns.
Updated On: May 19, 2025
Hide Solution
collegedunia
Verified By Collegedunia

Correct Answer: 267

Solution and Explanation

Step 1: Understand the set \( S \)

- \( S \) is the set of all seven-digit numbers formed using the digits 0, 1, and 2.

- A seven-digit number has the form \( d_1 d_2 d_3 d_4 d_5 d_6 d_7 \), where each \( d_i \in \{0, 1, 2\} \).

- Since it’s a seven-digit number, the first digit \( d_1 \) cannot be 0 (otherwise, it wouldn’t be a seven-digit number; e.g., 0210222 would be interpreted as 210222, a six-digit number).

- Thus:

\qquad - \( d_1 \in \{1, 2\} \) (2 choices),

\qquad - \( d_2, d_3, \ldots, d_7 \in \{0, 1, 2\} \) (3 choices each).

- Total number of seven-digit numbers in \( S \): \[ 2 \times 3 \times 3 \times 3 \times 3 \times 3 \times 3 = 2 \times 3^6. \]
- Compute \( 3^6 = 729 \), so: \[ 2 \times 729 = 1458. \]
- Therefore, \( |S| = 1458 \).
The example confirms this:

- 2210222 is a seven-digit number with digits from \{0, 1, 2\}, so it’s in \( S \).

- 0210222 is not a seven-digit number (it’s 210222, a six-digit number), so it’s not in \( S \). Step 2: Define the condition

- We need to find the number of elements \( x \in S \) such that the number of digits 0 and the number of digits 1 in \( x \) are equal.

- Let:

\qquad - Number of 0s in \( x = k \),

\qquad - Number of 1s in \( x = k \),

\qquad - Number of 2s in \( x = 7 - (k + k) = 7 - 2k \).

- Since the total number of digits is 7, and the number of 2s must be non-negative: \[ 7 - 2k \geq 0 \implies 2k \leq 7 \implies k \leq 3.5 \implies k \leq 3 \text{ (since } k \text{ is an integer)}. \]
- Also, \( k \geq 0 \). So, \( k \) can be 0, 1, 2, or 3. Step 3: Count the numbers for each \( k \)

For each value of \( k \), compute the number of valid seven-digit numbers, considering the restriction on the first digit.
Case 1: \( k = 0 \)

- 0s: 0, 1s: 0, 2s: \( 7 - 2 \times 0 = 7 \).

- All digits are 2: the number is 2222222.

- First digit is 2, which is fine.

- Number of such numbers: 1.
Case 2: \( k = 1 \)

- 0s: 1, 1s: 1, 2s: \( 7 - 2 \times 1 = 5 \).

- Total digits: 7.

- Choose 1 position out of 7 for the 0: \( \binom{7}{1} = 7 \).

- From the remaining 6 positions, choose 1 for the 1: \( \binom{6}{1} = 6 \).

- The remaining 5 positions are 2s.

- Total ways (without considering the first digit): \( 7 \times 6 = 42 \).

- Now, exclude numbers where the first digit is 0:

\qquad - First digit is 0: Fix position 1 as 0 (1 way).

\qquad - Choose 1 position out of the remaining 6 for the 1: \( \binom{6}{1} = 6 \).

\qquad - Remaining 5 positions are 2s.

\qquad - Number of invalid cases: 6.

- Valid cases: \( 42 - 6 = 36 \).
Case 3: \( k = 2 \)

- 0s: 2, 1s: 2, 2s: \( 7 - 2 \times 2 = 3 \).

- Choose 2 positions out of 7 for the 0s: \( \binom{7}{2} = \frac{7 \times 6}{2} = 21 \).

- From the remaining 5 positions, choose 2 for the 1s: \( \binom{5}{2} = \frac{5 \times 4}{2} = 10 \).

- Remaining 3 positions are 2s.

- Total ways: \( 21 \times 10 = 210 \).

- Exclude cases where the first digit is 0:

\qquad - First digit is 0: Fix position 1 as 0.

\qquad - Choose 1 more position out of positions 2 to 7 for the other 0: \( \binom{6}{1} = 6 \).

\qquad - From the remaining 5 positions, choose 2 for the 1s: \( \binom{5}{2} = 10 \).

\qquad - Remaining 3 positions are 2s.

\qquad - Invalid cases: \( 6 \times 10 = 60 \).

- Valid cases: \( 210 - 60 = 150 \).
Case 4: \( k = 3 \)

- 0s: 3, 1s: 3, 2s: \( 7 - 2 \times 3 = 1 \).

- Choose 3 positions out of 7 for the 0s: \( \binom{7}{3} = \frac{7 \times 6 \times 5}{3 \times 2 \times 1} = 35 \).

- From the remaining 4 positions, choose 3 for the 1s: \( \binom{4}{3} = 4 \).

- Remaining 1 position is a 2.

- Total ways: \( 35 \times 4 = 140 \).

- Exclude cases where the first digit is 0:

\qquad - First digit is 0: Fix position 1 as 0.

\qquad - Choose 2 more positions out of positions 2 to 7 for the other 0s: \( \binom{6}{2} = 15 \).

\qquad - From the remaining 4 positions, choose 3 for the 1s: \( \binom{4}{3} = 4 \).

\qquad - Remaining position is a 2.

\qquad - Invalid cases: \( 15 \times 4 = 60 \).

- Valid cases: \( 140 - 60 = 80 \).
Step 5: Sum the valid cases

- \( k = 0 \): 1,

- \( k = 1 \): 36,

- \( k = 2 \): 150,

- \( k = 3 \): 80.

- Total: \[ 1 + 36 + 150 + 80 = 267. \] Final Answer: The number of elements \( x \in S \) where the number of 0s equals the number of 1s is \( \boxed{267} \).
Was this answer helpful?
0
0

Questions Asked in JEE Advanced exam

View More Questions