-1
$\begingroup$

I have two questions. Are those regular expressions are the same?

(1) b*(ab*)* and (b*a)*b *

(2) b*(aaab*)* and (b*aaa) * b*

I feel like they both create language that have worlds palindrome. Is that right? In the first one, both a's are must and b's are zero or unlimited. The second one is the same. the string aaa is a must in both and b's are zero or unlimited.

Am I right?

  • 1
    Cross-posted: http://stackoverflow.com/q/41797205/781723, http://math.stackexchange.com/q/2109538/14578, http://cs.stackexchange.com/q/69162/755. Please [do not post the same question on multiple sites](http://meta.stackexchange.com/q/64068). Each community should have an honest shot at answering without anybody's time being wasted.2017-01-23
  • 0
    I'm voting to close this question as off-topic because this has been asked and answered on (multiple) other SE sites at the same time.2017-01-30

1 Answers 1

2

Both regular expressions in (1) define the same language, and it's the language of all possible words in the alphabet $\{a,b\}$, i.e. all possible finite strings consisting of letters $a$ and $b$. (So no, it's not the language of palindromes.) In particular, note that $a$ may not be present in these words at all, because of the Kleene star on $(ab^*)$ — meaning that this entire group may be used zero times, thus producing words of the form $b^*$, i.e. words of arbitrary length consisting of $b$ only.

Similarly, both expression in (2) define the same language, and it's the language of words where $a$'s only appear in groups of three (or any multiples of three).