# In the game Mastermind there are 8 different colors. 4 pins are used to make different codes. If X is the number of colors that are used in a random code, what is the probability of X.

*print*Print*list*Cite

### 1 Answer

The codes in the game are made of 4 pins. Each of the pins can be of any of the 8 different colors.

The probability that all the colors are the same is P(1) = (1/8)^4

The probability that 2 colors are used P(2) = (8C2*4P2/(2!*2!))/8^4

=> (8*7*4*3)/(2!*2!*2!*8^4)

=> (7*3)/(2!*8^3)

=> 21/(2*8^3)

The probability that 3 colors are used is P(3) = 8C3*4/8^4

=> 8*7*6/(6*8^4)

=> 7/8^3

The probability that 4 colors are used is P(4) = 8C4/8^4

=> (8*7*6*5)/(4*3*2*8^4)

=> (7*5)/(4*8^3)