Combinatorics
DAILY_CHALLENGE
Grade None

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

Step-by-Step Solution

Key Concept: Inclusion-exclusion on digit frequency constraints in numbers with restricted leading digit
Total 7-digit numbers using $\{0,1,2\}$: first digit $\in\{1,2\}$, rest $\in\{0,1,2\}$. Total $= 2 \times 3^6 = 1458$. Let $A$ = numbers where digit $0$ appears exactly twice. Let $B$ = numbers where digit $1$ appears exactly twice. We want $|A \cup B| = |A| + |B| - |A \cap B|$. $|A|$: Choose 2 positions from 7 for the 0s. First digit can't be 0. Cases: - Both 0s in positions 2-7: $\binom{6}{2}=15$ ways; remaining 5 positions use $\{1,2\}$ with first digit $\in\{1,2\}$: $2^5=32$. Subtotal: $15\times32=480$. Wait, need to be careful: if neither zero is in position 1, then position 1 $\in\{1,2\}$. - Count directly: 2 positions for 0 chosen from positions 2-7 ($\binom{6}{2}=15$), position 1 from $\{1,2\}$ (2 choices), remaining 4 positions from $\{1,2\}$ ($2^4=16$). Total $= 15\times2\times16=480$. $|B|$: Choose 2 positions from 7 for the 1s. No restriction on position 1. - Both 1s not in position 1: position 1 $\in\{0,2\}$ but $\neq0$ so $\in\{2\}$: $\binom{6}{2}\times1\times2^4=15\times16=240$. - Exactly one 1 in position 1: choose other 1 position from 2-7 ($6$ ways), remaining 5 positions from $\{0,2\}$ ($2^5=32$). Subtotal: $6\times32=192$. $|B|=240+192=432$. $|A\cap B|$: exactly two 0s and exactly two 1s. 4 positions for 0s and 1s, remaining 3 positions get digit 2. Position 1 must be 1 or 2. - Position 1 = 2: choose 2 positions from remaining 6 for 0s ($\binom{6}{2}=15$), choose 2 from remaining 4 for 1s ($\binom{4}{2}=6$). Subtotal: $15\times6=90$. - Position 1 = 1: choose 1 more position from 2-7 for second 1 (6 ways), choose 2 positions from remaining 5 for 0s ($\binom{5}{2}=10$). Subtotal: $6\times10=60$. $|A\cap B|=90+60=150$. $|A\cup B|=480+432-150=762$.
Correct Answer: 762

Master Combinatorics with Mathbee

Practice this topic under real exam conditions with strict timers, or ask our AI Mentor to explain the concepts step-by-step.

Start Practicing for Free