Solveeit Logo

Question

Question: number of ways we can form a number of 4 digits that have atmost 2 different digits...

number of ways we can form a number of 4 digits that have atmost 2 different digits

Answer

576

Explanation

Solution

To find the number of 4-digit numbers that have at most 2 different digits, we consider two cases:

Case 1: The number has exactly 1 different digit.

This means all four digits are the same. Let the number be AAAAAAAA. Since it is a 4-digit number, the first digit AA cannot be 0. So, AA can be any digit from 1 to 9. Possible numbers are 1111, 2222, ..., 9999. Number of ways = 9.

Case 2: The number has exactly 2 different digits.

Let the two distinct digits be d1d_1 and d2d_2. The 4-digit number must contain both d1d_1 and d2d_2. We need to consider two subcases based on whether 0 is one of the digits.

Subcase 2.1: One of the distinct digits is 0.

Let the two distinct digits be xx and 00, where x{1,2,...,9}x \in \{1, 2, ..., 9\}. There are 9 choices for xx. The 4-digit number must contain both xx and 00. Since the number is a 4-digit number, its first digit cannot be 0. Therefore, the first digit must be xx. So the number is of the form xBCDxBCD. The remaining three digits (B,C,DB, C, D) can be either xx or 00. There are 23=82^3 = 8 possible arrangements for BCDBCD. However, we must ensure that 00 is present among B,C,DB, C, D. The only arrangement that does not contain 00 is xxxxxx. So, we exclude the case xBCD=xxxxxBCD = xxxx (which would fall under Case 1). Number of valid arrangements for BCDBCD is 231=72^3 - 1 = 7. For each of the 9 choices for xx, there are 7 ways to form the number. Number of ways = 9×7=639 \times 7 = 63.

Subcase 2.2: Neither of the distinct digits is 0.

Let the two distinct digits be xx and yy, where x,y{1,2,...,9}x, y \in \{1, 2, ..., 9\} and xyx \neq y. The number of ways to choose two distinct digits from {1,2,...,9}\{1, 2, ..., 9\} is (92)\binom{9}{2}. (92)=9×82=36\binom{9}{2} = \frac{9 \times 8}{2} = 36. For each chosen pair {x,y}\{x, y\}, we need to form a 4-digit number using only xx and yy, such that both xx and yy are present. Since neither xx nor yy is 0, the first digit can be either xx or yy. Each of the four positions in the number can be filled with either xx or yy. So there are 24=162^4 = 16 total arrangements. From these 16 arrangements, we must exclude the cases where only xx is used (xxxxxxxx) and where only yy is used (yyyyyyyy). These cases would fall under Case 1. So, the number of valid arrangements for each pair {x,y}\{x, y\} is 242=142^4 - 2 = 14. Number of ways = (92)×14=36×14=504\binom{9}{2} \times 14 = 36 \times 14 = 504.

Total number of ways:

Sum of ways from Case 1, Subcase 2.1, and Subcase 2.2.

Total = 9+63+504=5769 + 63 + 504 = 576.