I have to create new language with languages $L_a = \{a\}, L_b = \{b\}$ and with set operations which contains only words

  1. with even length
  2. with odd length and first letter not equal to last letter

So my solution for part 1 is this. Am I rigth?

$L_n = \{aa, bb, ab, ba\}* = (L_a.L_a \cup L_b.L_b \cup L_a.L_b \cup L_b.L_a)*$

Regarding to part 2, I dont have any simple solution. In this language must be words like these: $abb,bba,baaaa, ababb$ etc. So before first and last word must be only word with odd length. But I dont know how to write it.

  • 2
    $\begingroup$ 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. $\endgroup$
    – D.W.
    Mar 5, 2017 at 13:53
  • $\begingroup$ Also, please ask only one question per post. If you have two questions (about two parts), they should be asked separately. Thank you. Also, note that we're happy to help you understand the concepts but just solving exercises for you is unlikely to achieve that. You might find this page helpful in improving your question. $\endgroup$
    – D.W.
    Mar 5, 2017 at 13:54
  • $\begingroup$ In part 2. I imagine you wanted to say 'with the first letter equal to the last letter', right? If yes, please modify your question accordingly. $\endgroup$
    – Maczinga
    Mar 5, 2017 at 14:15
  • $\begingroup$ @Maczinga No, I need first letter != last letter $\endgroup$
    – Johny
    Mar 5, 2017 at 14:31

1 Answer 1


Part 1. is ok. The idea behind is that you have to take the letters 2 by 2 and then make the star closure. Call $L_e$ the language of even words you just defined.

Part 2. Assume for a moment to have defined $L_o$ the language of words of even length from $L_a$ and $L_b$. Then to have even length and different initial and final letter you can just define

$L=L_a\cdot L_o\cdot L_b\cup L_b\cdot L_o\cdot L_a$

Remark that words in $L$ have length at least 3 since $a$ starts and finish with the same letter...

To define $L_o$ the idea is that an even word is just to exploit $L_e$:

$L_o=L_a\cdot L_e\cup L_b\cdot L_e$.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.