0

Let A={a,b}. So the question is to write regular expression such that L(r) which consists of all words.

My answer is this:

L(r)= (a+b)* a* b* (a+b)*

Is this correct?

Also another solution is:

L(r)=(a+b)*

Is this correct?

Is (a+b)* same as (a,b)* ?

  • 1
    We discourage "please check whether my answer is correct" questions, as only "yes/no" answers are possible, which won't help you or future visitors. See here and here. Can you edit your post to ask about a specific conceptual issue you're uncertain about? As a rule of thumb, a good conceptual question should be useful even to someone who isn't looking at the problem you happen to be working on. If you just need someone to check your work, you might seek out a friend, classmate, or teacher. – D.W. Dec 15 '19 at 22:24
  • 1
    https://cs.stackexchange.com/q/11315/755, https://cs.stackexchange.com/q/1331/755, https://cs.stackexchange.com/q/52745/755, https://cs.stackexchange.com/a/83515/755 – D.W. Dec 15 '19 at 22:26
  • Your answer is correct but by my count is ten symbols longer than it needs to be. – Rick Decker Dec 15 '19 at 23:28

1 Answers1

1

Is (a+b)* same as (a,b)* ?

Close, but try not to mix domains. If the regular expression $r$ is the string $(a{+}b)*$, then the language of $r$ is the set of all strings over $\{a,b\}$, or $L(r) = \{a,b\}^*$.

So, $(a{+}b)*$ and $\{a,b\}^*$ denote the same set of strings. The first one as regular expression, the second one in set notation.

Hendrik Jan
  • 30,578
  • 1
  • 51
  • 105