are a*b* and (ab)* the same language? I am trying to make nfa for a*b*
Asked
Active
Viewed 4,387 times
-2
-
2`a*b*` not the same as `(ab)*`. You can have the word `a` with the first, but cannot with the second. – Eraklon Mar 25 '20 at 21:16
-
1I'm voting to close this question as off-topic because it belong on cs.stackexchange.com . – einpoklum Mar 25 '20 at 21:18
2 Answers
2
These two regular expressions define different languages.
a*b*
matches any number of repetitions (including zero) of a
followed by any number of repetitions (including zero) of b
. For example aaabb
.
(ab)*
matches any number of repetitions (including zero) of the ab
sequence, for example abab
.
The empty string and ab
are the only two words that match both regular expressions.

axiac
- 68,258
- 9
- 99
- 134