Tom K. answered 02/11/21
Knowledgeable and Friendly Math and Statistics Tutor
There are many ways to approach this problem. I will use inclusion/exclusion for 2-4.
The easiest one, which you didn't provide, is the number of ways of getting one different result.
To have all be the same, we have 6 ways (all of each value), so
P(1) = 1/6^5 = 1/7776
P(2) We have C(6,2) possible pairs. Then, the number of ways with 2 numbers is 2^6 - 2*1 (all numbers the same), so P(2) = C(6,2)*(2^6-2)/6^6 = 15*62/6^6 = 155/7776
P(3) = C(6,3) * (3^6 - 3*2^6 + 3*1^6)/6^6 = 20 * 540/6^6 = 25/108
P(4) = C(6,4) *(4^6-4*3^6+6*2^6-4)/6^6 = 23400/6^6 = 325/648
P(5) = you have to have 1 number twice and 1 number not at all. Then, the number selected twice can be in C(6,2) positions, and the other 4 can be in 4!, so the probability is 6*5*C(6,2)*4!/6^6 =
10800/6^6 = 25/108
P(6) = 5/324 as given (you could have derived this as 6!/6^6)
Just for fun, I also programmed the solution in R.
The code is easy to understand. You could put it into your language of choice
counts <- rep(0,6)
for(a in 1:6){
for(b in 1:6){
for(c in 1:6){
for(d in 1:6){
for(e in 1:6){
for(f in 1:6){
flags <- rep(0,6)
flags[a]<- 1
flags[b] <- 1
flags[c] <- 1
flags[d]<- 1
flags[e] <- 1
flags[f] <- 1
count <- sum(flags)
counts[count] <- counts[count] + 1
}}}}}}
prob <- counts/6^6
counts