Consider the character set of total 62 characters : - 26 capital letters 26 small letters 10 digits
I know that i can solve this by
Total passwords - Total passwords only containing characters
That is $62^4 - 52^4$.
But i want to know why this following direct approach is not correct?
$(10 x 52 x 52 x 52) + (10 x 10 x 52 x 52) + (10 x 10 x 10 x 52) + 10 x 10 x 10 x 10)$
Consider the case of exactly 1 digit. (10 x 52 x 52 x 52) Should we not only consider to multiply the total number of digits at single place to the product of total number of characters at 3 other places. Multiplication is associative so placing 10 at any position should not change the result like
$(10 x 52 x 52 x 52) = (52 x 10 x 52 x 52) = (52 x 52 x 10 x 52) = (52 x 52 x 52 x 10)$
please explain in detail different ways of approaching this problem.
For the case where there is only one digit, you must consider the 4 places where the digit can be so you should multiply $10\cdot {52}^3$ by ${4 \choose 1}$ to account for the four different placements of the digit. Applying this to the other three cases yields:
$$\left(10 \cdot {52}^3 \cdot {4 \choose 1}\right) + \left(10^2 \cdot {52}^2 \cdot {4 \choose 2}\right) + \left({10}^3 \cdot 52 \cdot {4 \choose 3}\right) + \left({10}^4 \cdot {4 \choose 4}\right)=7464720={62}^4-{52}^4$$