Homework 1 Solution
Homework 1 Solution
Next, we prove by induction that (LR)k = (Lk)R, for any k 0. For the
induction basis, when k = 0, (LR)k = {} and (L k) R = {} and thus
(LR)k = (L k) R. For the induction hypothesis, assume when k n that
(LR)n = (L n) R. For the induction step, when k = n+1,
(L R) n+1 = (L R) n LR and (L n+1) R = (L Ln)R = (L n) R LR. By the
induction hypothesis it follows that (LR)n+1=(L n+1) R. Subsequently, the
statement holds for any k.
2. Problem 2 on page 45
For = {a,b}, construct DFA’s that accept the sets consisting of
(a) all strings with exactly one a
b b a
a a
b
(b) all strings with at least one a
b b
a
a
(d) all strings with at least one a and exactly two b’s
a a a
b b
a
b
a a a
a b b
b
a
b
b
a b
(e) all the strings with exactly two a’s and more than two b’s
3. Problem 6 on page 45
Give a set notation description of the language accepted by the
automation depicted in the following diagram. Can you think of a simple
verbal characterization of the language?
a
b b
a
q0 q1
q2
a
L = {w: wb*a or w b*a(a|b)*b}
The language is all the strings with exactly one a or more than one a but
end with b.
4. Problem 9 on page 53
(a) Find an NFA with three states that accepts the language
L = {an : n1} {bmak : m0, k0}
Notice that L = {bmak : m0, k0}, since for n=1 and m=0 and k=1
an = bmak. Therefore an automaton with three states is the following.
b a
q0 q1 q2
(b) Do you think the language in part (a) can be accepted by an NFA with
fewer than three states?
b a
q0 q1
a {q1, q2}
a {q1, q2}
b
Transitions from {q1, q2}:
{q0}
b
{q0}
b a
b
a
a, b
Transitions from :
a {q1, q2}
b
{q0}
b a
a, b
a {q1, q2}
b
{q0}
b
a