# Given the alphabet $\{a, b, c\}$, how many words can we form with 4 letters?

Question: Given the alphabet $\{a, b, c\}$, how many words can we form with 4 letters? And how many words can we form with up to 4 letters?

I was thinking about the logic behind this and came up with this: perhaps the number of words that can be formed with 4 letters is $4^3 = 64$ words. Is that correct?

I could not think about how many words up to 4 letters, because that includes words with 1, 2 and 3 letters.

• Hint: by the same token, the words having only 1 letter are $1^3 = 1$. Does it look right? For "up to four", count the words having 0,1,2,3,4 letters using the same "corrected" formula. – chi May 1 '17 at 19:32

## 2 Answers

Assume you have the alphabet $\{A,B,C\}$ and you want to form words of length 4.

For the first letter you have 3 choices, $A, B$ or $C$. For the second letter you have again 3 choices, $A,B$ or $C$ and so on. In total: $3 \cdot 3 \cdot 3 \cdot 3 = 3 ^ 4 = 81$ possibilities.

Does not "with up to 4 letters" mean that we should count 1-letter, 2-letter, 3-letter, and 4-letter words? Then the answer is $3 + 3^2 + 3^3 + 3^4$.

• You forgot the empty word. This is computer science after all :) – 6005 Jun 1 '17 at 0:08
• @6005. Sorry, you are right. :-D – fade2black Jun 1 '17 at 0:13