Analyzing the Foundation
To solve this problem, we first define our sample space, n(S). A 5-digit number is represented by the slots d1d2d3d4d5.
The first digit d1 cannot be 0, leaving 9 choices (1 through 9). The remaining four slots can each be any of the 10 digits (0 through 9).
This value represents the total number of possible 5-digit numbers.
The Zero Dilemma
We must form numbers using exactly two distinct digits. Because 0 cannot occupy the first position, we must split our analysis into two mutually exclusive cases to avoid counting errors.
Case 1
The Zero-Included Scenario
Suppose our two digits are 0 and a non-zero digit x. There are 9 possible choices for x ({1,2,…,9}).
For the arrangement, the first slot d1 must be x (1 choice). The remaining four slots can be either 0 or x, yielding 24=16 raw combinations.
We must exclude the case where all four remaining slots are x, as that would result in a 1-digit number (xxxxx). Thus, we have 16−1=15 valid arrangements per pair.
Case 2
The Non-Zero Scenario
Now, consider the case where both chosen digits x and y are non-zero. We choose 2 digits from 9, which is given by:
Since neither digit is zero, there are no restrictions on d1. Each of the 5 slots can be either x or y, giving 25=32 raw arrangements.
We must exclude the two cases where the number consists of only one digit (all x's or all y's). This leaves 32−2=30 valid arrangements per pair.
Final Calculation
The total number of favorable outcomes n(E) is the sum of our two cases:
The probability P(E) is the ratio of favorable outcomes to the total sample space:
Dividing both the numerator and denominator by 135, we arrive at the final simplified probability: