6-digit code combinations

combinatorics

I've stumbled upon this question: if I want to create a 6-lettered code using only the letters Κ and F, how many combinations do I get? So, in case that I can use just K and F (but there is the chance I will use only one of them), I assume that the answer is P(6,2). But what about the case, where I have to use BOTH K and F necessarily?

Best Answer

The number of ways of creating a six character code using only the letters A and Z is $2^6$ since there are two choices for each of the six positions. To illustrate with a smaller example, notice that there $2^3 = 8$ possible codes with three characters: AAA, AAZ, AZA, AZZ, ZAA, ZAZ, ZZA, ZZZ.

The number of ways of creating a six character code using only the letters K and F which contain both K and F is $2^6 - 2$ since there are two choices for each of the six positions, but we must exclude the two codes FFFFFF and KKKKKK.

The answer is not $P(6, 2)$. That is the number of ways of forming a two-digit code with two different characters chosen from a set with six characters.