• retagged by
35,761 views
75 75 votes

Which one of the following regular expressions correctly represents the language of the finite automaton given below?

  1. $ab^{\ast}bab^{\ast} + ba^{\ast}aba^{\ast}$
  2. $(ab^{\ast}b)^{\ast}ab^{\ast} + (ba^{\ast}a)^{\ast} ba^{\ast}$
  3. $(ab^{\ast}b + ba^{\ast}a)^{\ast} (a^{\ast} + b^{\ast})$
  4. $(ba^{\ast}a + ab^{\ast}b)^{\ast} (ab^{\ast} + ba^{\ast})$

8 Answers

Best answer
90 90 votes

Answer : D

$\color{red}{\text{Method 1(Complete Analysis) :}}$

We have two final states, $Q,R.$

First find the regular expression for set of all strings that end up at the initial state $P$ when running the given $\textsf{NFA}.$ Let’s call this $P.$

Note that $P$ is the initial state, so, NFA execution starts at $P.$ Now, to end up on state $P$ at the end of the string, we can do any of the following, in any order, any number of times :

  1. Read $’a’$, go to state $Q,$ then read any number of $b’s$, then read $b$ to come back to state $P.$ So, $1 = ab^*b$
  2. Read $’b’$, go to state $R,$ then read any number of $a’s$, then read $a$ to come back to state $P.$ So, $2= ba^*a$

So, $P = (1+2)^* = [(ab^*b)+(ba^*a)]^*$ (Because we can do $1$ or $2$ in any order, any number of times)

Now, we want to find language of the given NFA $N$, whose final states are $Q,R.$

So, $RegEx(N) = Q + R $

Where $Q$ is the regular expression for set of all strings that end up at the state $Q$ when running the given $\textsf{NFA}$ and $R$ is the regular expression for set of all strings that end up at the state $R$ when running the given $\textsf{NFA}.$

$Q = P ab^*$

$R = Pba^*$

So, $RegEx(N) = Q + R = P ab^* + Pba^* = P(ab^* + ba^*)$

$RegEx(N) = [(ab^*b)+(ba^*a)]^* (ab^* + ba^*)$

Hence, Option D is Correct Answer.

$\color{blue}{\text{Method 2 (Option Elimination) :}}$

Option A :

The Strings $\text{“}a\text{”}$ and $\text{“}b\text{”}$ are accepted by the given NFA BUT these strings are Not generated by the regular expression in Option A. So Option A is wrong.

Option B :

The String $abbbbaa$ is accepted by the given NFA BUT this string is Not generated by the regular expression in Option B. So Option B is wrong.

Option C :

The Empty String is NOT accepted by the given NFA BUT this string is generated by the regular expression in Option C. So Option C is wrong.

Correct answer is D.

• edited by
42 42 votes

using state elimination method :

here option D matches RE:(ba*a+ab*b)*(ab*+ba*)

10 10 votes
For option A,

The String “a” is not accepted which is in the language.So it is false.

For Option B,

The String “abbbaa” is accepted by the NFA but it is not generated by the regular expression.So it is false.

For option C,

It will accepted empty string which is not in the language.So it is false.

Correct answer is D.
• edited by
8 8 votes

using adren’s lemma

P=∈+Qb+Ra

Q=Pa+Qb*

 by adren’s thorem

if R=Q+RP

then R=QP*

so, here

Q=Pa(b*)*……………..(1)

R=Pb+Ra*

so R=Pb(a*)*…………...(2) (by adren’s theorem)

now P=∈+Qb+Ra

     P=∈+Pa(b*)*b+ Pb(a*)*a

     P=∈+P{a(b*)*b+b(a*)*a}

    P=∈[a(b*)*b+b(a*)*a]*

    P=[a(b*)*b+b(a*)*a]*………..(3)

now from Eqn(1) and Eqn(2)

RE: Q+R=Pa(b*)*+Pb(a*)*

              =P[a(b*)*+b(a*)*]

put the value of P from equ(3)

RE: Q+R=[a(b*)*b+b(a*)*a]*[a(b*)*+b(a*)*]

RE: Q+R = [ab*b+ba*a]*[ab*+ba*]

so Option D is correct

 

Answer:
Position:
Show:

Related questions

24 24 votes
2 answers 2 answers
28.8k
28.8k views
Arjun asked Feb 15, 2022
28,772 views
Which of the following statements is/are $\text{TRUE}?$Every subset of a recursively enumerable language is recursive.If a language $\textit{L}$ and its complement $\over...
33 33 votes
6 answers 6 answers
23.9k
23.9k views
Arjun asked Feb 15, 2022
23,878 views
Which of the following is/are undecidable?Given two Turing machines $\textit{M}_{1}$ and $\textit{M}_{2},$ decide if $\textit{L(M}_{1}) = \textit{L(M}_{2}).$Given a Turin...
61 61 votes
3 answers 3 answers
18.9k
18.9k views
Arjun asked Feb 15, 2022
18,864 views
Consider the following languages:$L_{1} = \{ a^{n} wa^{n} | w \in \{a,b\}^{\ast}\}$$L_{2} = \{wxw^{R} | w, x \in \{a,b\}^{*}, |w|, |x| 0 \}$Note that $w^{R}$ is the reve...
45 45 votes
4 answers 4 answers
27.7k
27.7k views
Arjun asked Feb 15, 2022
27,696 views
Consider the following languages:$L_{1} = \{ ww | w \in \{a,b\}^{\ast} \}$$L_{2} = \{a^{n} b^{n} c^{m} | m,n \geq 0 \}$$L_{3} = \{a^{m} b^{n} c^{n} | m,n \geq 0 \}$Which ...