• edited by
23,297 views
70 70 votes

Consider the regular expression $R = (a + b)^* \ (aa + bb) \ (a + b)^*$

Which one of the regular expressions given below defines the same language as defined by the regular expression $R$ ?

  1. $(a(ba)^* + b(ab)^*)(a + b)^+$
  2. $(a(ba)^* + b(ab)^*)^*(a + b)^*$
  3. $(a(ba)^* (a + bb) + b(ab)^*(b + aa))(a + b)^*$
  4. $(a(ba)^* (a + bb) + b(ab)^*(b + aa))(a + b)^+$

8 Answers

Best answer
91 91 votes

$R = (a+b)^*(aa+bb)(a+b)^*$

Having,

Which is equivalent to the following Transition graph [by removing transition from $Q_1$ to $Q_2$ and $Q_2$ to $Q_1$ but does not affect the accepted language, be careful] and can be converted to an equivalent regular expression as shown below.

So, equivalent regular expression is $[a(ba)^*(a+bb) + b(ab)^*(b+aa)](a+b)^*$

Option C is answer.

• edited by
145 145 votes
Another quick approach of solving this question for keen observers :-

Observe that $aa$ or $bb$ is minimal string that is possible in first Regular Expression $(a + b)^* (aa + bb) (a + b)^*.$

(A) We can have $ba$ or $ab$ as minimal strings which is not possible in $(a + b)^* (aa + bb) (a + b)^*$

(B) We can have empty string, which is not possible in $(a + b)^* (aa + bb) (a + b)^*.$

(D) Minimum string length is $3,$ $aa$ or $bb$ is not possible in this RE.

This rules out options A, B and D. So, option C must be the answer.
11 11 votes

> "abab" does not belong to the language but accepted by A & B. (Cancel them)
> "aa" belongs to the language, not accepted by D. Hence C is the ans. 

4 4 votes
B produces null. The given expr does not. So, B is eliminated.

A accepts abab. The given expr does not. So, A is eliminated. [P.S.: (a+b)+ does not produce null.]

The first bracketed part of both C and D produce a string with a substring of aa or bb, which is asked by the expr. But after that (a+b)+ cannot produce null. So, D is eliminated.

C is the answer.
0 0 votes
We will eliminate a given option

1--if it generates a new string that is not generated by given expression

Or

2--if it doesn't generate a string generated by the given expression

Option a- generates "ab" Which is not generated by given expression. So eliminated

Option b- same reason as option a

Option d- can't generate "bb" Which is generated by given expression. So eliminated.

So we are left with option c.Hence it is the answer.

If none of the above is given as a option, we have to check the option we are left with intuitively..
0 0 votes

Option A: it can generate string like 'a' which is not a part of our language. So, rejected.

Option B: it generates NULL string, which is again not a part of our language.

Option C: it generates all our required strings. So it can be answer, since option D also looks similar.

Option D: it cannot generate string 'aa' or 'bb' which are the minimal length strings of our language. Hence, rejected.

So option C is therefore the right answer!

Answer:
Position:
Show:

Related questions

52 52 votes
8 answers 8 answers
13.3k
13.3k views
Ishrat Jahan asked Oct 30, 2014
13,309 views
Consider the regular expression $R = (a + b)^* (aa + bb) (a + b)^*$Which deterministic finite automaton accepts the language represented by the regular expression $R$?
59 59 votes
5 answers 5 answers
13.6k
13.6k views
Ishrat Jahan asked Oct 30, 2014
13,582 views
Consider the regular expression $R = (a + b)^* (aa + bb) (a + b)^*$Which of the following non-deterministic finite automata recognizes the language defined by the regular...
96 96 votes
8 answers 8 answers
27.4k
27.4k views
Ishrat Jahan asked Oct 30, 2014
27,434 views
Consider the following finite automata $P$ and $Q$ over the alphabet $\{a, b, c\}$. The start states are indicated by a double arrow and final states are indicated by a d...
92 92 votes
3 answers 3 answers
24.6k
24.6k views
Ishrat Jahan asked Oct 30, 2014
24,625 views
Consider the following grammars. Names representing terminals have been specified in capital letters.$$\begin{array}{|llll|}\hline G1 : & \text{stmnt} & \rightarrow & \...