You are on page 1of 6

AUTOMATA CHAPTER 2: LANGUAGES (PROBLEMS)

By: F.A

4/1/2014
Chapter 2:
LANGUAGES
Problems:

1. Consider the language S*, where S = {a, b}. How many words does this
language have of length 2? Of length 3? Of length n?
Solution:
S = {a, b}

S* = {, a, b, aa, ab, bb, ba, aaa, aab, aba, abb, bbb, bba, bab, baa,…. }

 So this language have words of length 2 = 4

Of length 3 = 8

Of length n = 2n

 We can solve this question in the following way too

Let number of words = nm

Then words of length 2 = 22 = 4

Of length 3 = 23 = 8

Of length n = 2n

2. Consider the language S*, where S = {aa, b}. how many words does this
language have of length 4? Of length 5? Of length 6? What can be said
in general?
Solution:
S = {aa, b}

S* = {, aa, b, aaaa, aab, bb, baa, aaaaaa, aaaab, aabb, aabaa, baaaa, baab, bbb,
bbaa, aaaaaaaa, aaaaaab, aaaabb, aaaabaa, aabaaaa, aabaab, aabbb, aabbaa,
bbbb, bbbaa, bbaaaa, bbaab, baabb, baabaa, baaaaaa, baaaab, aaaaaaaaaa,
…….}

 So words of length 4 = 24 = 16

Of length 5 = 25 = 32

Of length 5 = 26 = 64

In general:
In general we can say that

3. Consider the language S*, where S = {ab, ba}. Write out all the words in
S* that have seven or fewer letters. Can any word in this language
contain the substrings aaa or bbb? What is the smallest word that is not
in this language?
Solution:
S = {ab, ba}

S* = {, ab, ba, abab, abba, baba, baab, ababab, ababba, abbaba, abbaab,
baabab, baabba, bababa, babaab, abababab, abababba, ababbaba, ababbaab,
abbaabab, abbaabba, abbababa, abbabaab, baababab, baababba, baabbaba,
baabbaab, babaabab, babaabba, babababa, bababaab, ababababab,
ababababba, abababbaba, abababbaab, ababbaabab, ababbaabba, ababbababa,
ababbabaab, abbaababab, abbaababba, abbaabbaba, abbaabbaab, abbabaabab,
abbabaabba, abbabababa, abbababaab, baabababab, baabababba, baababbaba,
baababbaab, baabbaabab, baabbaabba, baabbababa, baabbabaab, babaababab,
babaababba, babaabbaba, babaabbaab, bababaabab, bababaabba, bababababa,
babababaab, abababababab, abababababba, ababababbaba, ababababbaab,
abababbaabab, abababbaabba, abababbababa, abababbabaab, ababbaababab,
ababbaababba, ababbaabbaba, ababbaabbaab, ababbabaabab, ababbabaabba,
ababbabababa, ababbababaab, abbaabababab, abbaabababba, abbaababbaba,
abbaababbaab, abbaabbaabab, abbaabbaabba, abbaabbababa, abbaabbabaab,
abbabaababab, abbabaababba, abbabaabbaba, abbabaabbaab, abbababaabab,
abbababaabba, abbababababa, abbabababaab, ababababababab,
ababababababba, abababababbaba, abababababbaab, ababababbaabab,
ababababbaabba, ababababbababa, ababababbabaab, abababbaababab,
abababbaababba, ababbaabbaba, ababbaabbaab, ababbabaabab,
abababbabaabba, abababbabababa, abababbababaab, ababbaabababab,
ababbaabababba, ababbaababbaba, ababbaababbaab, ababbaabbaabab,
ababbaabbaabba, ababbaabbababa, ababbaabbabaab, ababbabaababab,
ababbabaababba, ababbabaabbaba, ababbabaabbaab, ababbababaabab,
ababbababaabba, ababbababababa, ababbabababaab, baabababababab,
baabababababba, baababababbaba, baababababbaab, baabababbaabab,
baabababbaabba, baabababbababa, baabababbabaab, baababbaababab,
baababbaababba, baababbaabbaba, baababbaabbaab, baababbabaabab,
baababbabaabba, baababbabababa, baababbababaab, baabbaabababab,
baabbaabababba, baabbaababbaba, baabbaababbaab, baabbaabbaabab,
baabbaabbaabba, baabbaabbababa, baabbaabbabaab, baabbabaababab,
baabbabaababba, baabbabaabbaba, baabbabaabbaab, baabbababaabab,
baabbababaabba, baabbababababa, baabbabababaab,…}

 All words in S* that have seven or fewer letters:

S* = { abababababab, abababababba, ababababbaba, ababababbaab,


abababbaabab, abababbaabba, abababbababa, abababbabaab, ababbaababab,
ababbaababba, ababbaabbaba, ababbaabbaab, ababbabaabab, ababbabaabba,
ababbabababa, ababbababaab, abbaabababab, abbaabababba, abbaababbaba,
abbaababbaab, abbaabbaabab, abbaabbaabba, abbaabbababa, abbaabbabaab,
abbabaababab, abbabaababba, abbabaabbaba, abbabaabbaab, abbababaabab,
abbababaabba, abbababababa, abbabababaab, ababababababab,
ababababababba, abababababbaba, abababababbaab, ababababbaabab,
ababababbaabba, ababababbababa, ababababbabaab, abababbaababab,
abababbaababba, ababbaabbaba, ababbaabbaab, ababbabaabab,
abababbabaabba, abababbabababa, abababbababaab, ababbaabababab,
ababbaabababba, ababbaababbaba, ababbaababbaab, ababbaabbaabab,
ababbaabbaabba, ababbaabbababa, ababbaabbabaab, ababbabaababab,
ababbabaababba, ababbabaabbaba, ababbabaabbaab, ababbababaabab,
ababbababaabba, ababbababababa, ababbabababaab, baabababababab,
baabababababba, baababababbaba, baababababbaab, baabababbaabab,
baabababbaabba, baabababbababa, baabababbabaab, baababbaababab,
baababbaababba, baababbaabbaba, baababbaabbaab, baababbabaabab,
baababbabaabba, baababbabababa, baababbababaab, baabbaabababab,
baabbaabababba, baabbaababbaba, baabbaababbaab, baabbaabbaabab,
baabbaabbaabba, baabbaabbababa, baabbaabbabaab, baabbabaababab,
baabbabaababba, baabbabaabbaba, baabbabaabbaab, baabbababaabab,
baabbababaabba, baabbababababa, baabbabababaab }
 No, No words can contain aaa or bbb because the first a in string ab and the a in
ba never allow to make aaa or bbb.
 The smallest word is of length zero (0) that is  (capital lambda) and it is present
in the language so other than it there is no smallest word that is not in the
language.

4. Consider the language S*, where S = {a, ab, ba}. Is the string (abbba) a
word in this language? Write out all the words in this language with six
or fewer letters. What is another way in which to describe the words in
this language? Be careful this is not simply the language of all words
without bbb.
Solution:

 No, the string abbba a word is not present in the language, because b
individually does not exist in the given string S, so (ab b ba) can’t exist in this
language.
 All the words with six or fewer letters in this language are written below:
S* = {, a, ab, ba, aa, aab, aba, aba, abab, abba, baa, baab, baba, aaa, aaab,
aaba, aaba, aabab, aabba, abaa, abaab, ababa, abaa, abaab, ababa, ababa,
ababab, ababba, abbaa, abbaab, abbaba, baaa, baaab, baaba, baaba, baabab,
baabba, babaa, babaab, bababa, aaaa, aaaab, aaaba, aaaba, aaabab, aaabba,
aabaa, aabaab, aababa, aabaa, aabaab, aababa, aababa, aababab, aababba,
aabbaa, aabbaab, aabbaba, abaaa, abaaab, abaaba, abaaba, abaabab, abaabba,
ababaa, ababaab, abababa, abaaa, abaaab, abaaba, abaaba, abaabab, abaabba,
ababaa, ababaab, abababa, ababaa, ababaab, abababa, abababa, abababab,
abababba, ababbaa, ababbaab, ababbaba, abbaaa, abbaaab, abbaaba, abbaaba,
abbaabab, abbaabba, abbabaa, abbabaab, abbababa, baaaa, baaaab, baaaba,
baaaba, baaabab, baaabba, baabaa, baabaab, baababa, baabaa, baabaab,
baababa, baababa, baababab, baababba, baabbaa, baabbaab, baabbaba,
babaaa, babaaab, babaaba, babaaba, babaabab, babaabba, bababaa, bababaab,
babababa, aaaaa, aaaaab, aaaaba, aaaaba, aaaabab, aaaabba, aaabaa, aaabaab,
aaababa, aaabaa, aaabaab, aaababa, aaababa, aaababab, aaababba, aaabbaa,
aaabbaab, aaabbaba, aabaaa, aabaaab, aabaaba, aabaaba, aabaabab, aabaabba,
aababaa, aababaab, aabababa, aabaaa, aabaaab, aabaaba, aabaaba, aabaabab,
aabaabba, aababaa, aababaab, aabababa, aababaa, aababaab, aabababa,
aabababa, aabababab, aabababba, aababbaa, aababbaab, aababbaba, aabbaaa,
aabbaaab, aabbaaba, aabbaaba, aabbaabab, aabbaabba, aabbabaa, aabbabaab,
aabbababa, abaaaa, abaaaab, abaaaba, abaaaba, abaaabab, abaaabba, abaabaa,
abaabaab, abaababa, abaabaa, abaabaab, abaababa, abaababa, abaababab,
abaababba, abaabbaa, abaabbaab, abaabbaba, ababaaa, ababaaab, ababaaba,
ababaaba, ababaabab, ababaabba, abababaa, abababaab, ababababa, abaaaa,
abaaaab, abaaaba, abaaaba, abaaabab, abaaabba, abaabaa, abaabaab,
abaababa, abaabaa, abaabaab, abaababa, abaababa, abaababab, abaababba,
abaabbaa, abaabbaab, abaabbaba, ababaaa, ababaaab, ababaaba, ababaaba,
ababaabab, ababaabba, abababaa, abababaab, ababababa, ababaaa, ababaaab,
ababaaba, ababaaba, ababaabab, ababaabba, abababaa, abababaab,
ababababa, abababaa, abababaab, ababababa, ababababa, ababababab,
ababababba, abababbaa, abababbaab, abababbaba, ababbaaa, ababbaaab,
ababbaaba, ababbaaba, ababbaabab, ababbaabba, ababbabaa, ababbabaab,
ababbababa, abbaaaa, abbaaaab, abbaaaba, abbaaaba, abbaaabab, abbaaabba,
abbaabaa, abbaabaab, abbaababa, abbaabaa, abbaabaab, abbaababa,
abbaababa, abbaababab, abbaababba, abbaabbaa, abbaabbaab, abbaabbaba,
abbabaaa, abbabaaab, abbabaaba, abbabaaba, abbabaabab, abbabaabba,
abbababaa, abbababaab, abbabababa,…} [upto six letters]
 Another way….

5. Consider the language S*, where S = {xx, xxx}. In how many ways
can x 19 be written as the product of words in S? This means: How
many different factorizations are there of x 19 into xx and xxx?
Solution:
(xx) (xx) (xx) (xx) (xx) (xx) (xx) (xx) + (xxx) = x16 + x3 = x19

x19 can consist of 8 double xx combinations and 1 triple xxx combination i.e

= 8 * 2 + 1 * 3 = 19

x19 can consist of 5 double xx combinations and 3 triples xxx combinations

= 5 * 2 + 3 * 3 = 19

x19 can consist of 2 double xx combinations and 5 triples xxx combinations

= 2 * 2 + 5 * 3 = 19

3 double xx combinations can be replaced by 2 triple xxx combinations like


(xx)(xx)(xx) = (xxx)(xxx)