Discrete Math Mastermind codes consist of an ordered row of
Discrete Math
Mastermind codes consist of an ordered row of four colors. (For instance, RED BLUE BLUE ORANGE is one code; BLUE RED BLUE ORANGE is a different code.)
How many Mastermind codes are palindromes (i.e., they read the same forward and backward)? For instance, RED BLUE BLUE RED is a palindrome; ORANGE ORANGE ORANGE ORANGE is a palindrome; but RED BLUE PURPLE RED is not
Solution
Code consist of 4 colors.
Color available = 4 ( Orange, Red, Bule, & Purple)
For a palindrome code of length 4, It is necessary that there should not be more than 2 different colour.
If we will take 3 or 4 different colour for making code of length 4, then the code will not be palindorme.
Case 1. Taking only one color.
Out of 4 color we have to take one color.
So we can choose in 4C1 ways = 4
Case 2. Taking 2 different color.
Out of 4 colors we have to choose 2 colors.
So we can choose in 4C2 ways = 6 ways.
In each of the case they can be arranged in only 2 ways.
For example we take color A and color B, They possible combination for palindrome are ABBA and BAAB only.
So total ways = 6 X 2 = 12 ways
Now taking case 1 and 2 together, total no of ways = 4 + 12 = 16 ways
