combinatorics- 10 digit code with at least one symbol

The question: How many $10$ character codes you can create using a-z, A-Z, 0-9 and 10 symbols (!@#$%...) with at least one symbol? The correct answer:$72^{10}-62^{10}$, counting all possible combinations minus the combinations without any symbol My way of thinking: I put to the first place a symbol ($10$ways), for the rest 9 positions a put whatever I want ($72^9$), I multiply by 10 to get every possible position of the symbol.$10^2 \cdot 72^9$What's wrong in my thinking? What am I double counting? Is there a way to find the same solution using my thinking? • Consider 11111111!!, which of the !'s is your "first place"? – peterwhy Aug 9 '17 at 10:01 • that's why i multiplied by 10 to get every possible position of the symbol. – user285936 Aug 9 '17 at 10:02 • My point was there are two !'s, and either can be your "first place", which is the source of double counting. – peterwhy Aug 9 '17 at 10:04 • There is an alternative route to find the same solution: for$i=1,\dots,10$find the number of codes having exactly$i$symbols, and then take the summation. Not recommended though. – drhab Aug 9 '17 at 10:05 • @drhab Σ(62^10-n * 10^n ) – user285936 Aug 9 '17 at 10:11 1 Answer A slight modification to your thinking: Give up the "multiply by 10 to get every possible position of the symbol", but say the first symbol appears on position$i$,$1\le i \le 10$. For each position$i$, each character before it has$62$independent choices, and each character after it has$72\$ independent choices. The number of choices is

\begin{align*} N &= \sum_{i = 1}^{10} 62^{i-1}\cdot 10 \cdot 72^{10-i}\\ &= \sum_{j = 0}^{9} 62^{j}\cdot 10 \cdot 72^{9-j}\\ &= 10\cdot72^9\sum_{j=0}^{9}\left(\frac{62}{72}\right)^j\\ &= 10\cdot72^9\cdot\frac{1-(62/72)^{10}}{1-62/72}\\ &= 10\cdot \frac{72^{10}-62^{10}}{72-62}\\ &= 72^{10}-62^{10} \end{align*}

• Ok, now it is clearer. thank you everyone – user285936 Aug 9 '17 at 10:21