Is $\{ WxW^{\mathrm{R}} \mid W,x\in\{0,1\}^+\}$ a regular language? If so, why?

The notation $W^{\mathrm{R}}$ means the reverse string of $W$?

If we consider the best answer in this solution, if the language is regular, then its FA should reject all strings not in the language. However, a string such as 0110100 would also be accepted by the FA, since it compares only the starting and end characters! Please explain.

  • $\begingroup$ Try the following post. $\endgroup$
    – Shaull
    Commented Dec 13, 2015 at 13:43
  • $\begingroup$ @Shaull it doesn't explain why the string 0110100 would also be accepted by the FA!! $\endgroup$ Commented Dec 13, 2015 at 13:54
  • 1
    $\begingroup$ Ah, sorry, I misread your language. The string 0110100 should be accepted, since it's of the form $wxw^R$, where $w=0$ and $x=11010$. $\endgroup$
    – Shaull
    Commented Dec 13, 2015 at 14:01
  • $\begingroup$ @Shaull but the string 0110100 doesn't really fit the definition of the initial language where |w|>1 , does it? $\endgroup$ Commented Dec 13, 2015 at 14:05
  • 3
    $\begingroup$ There's no requirement stated in the question that $|W|>1$. The requirement that $W$ matches $(0+1)^+$ just says that $|W|\ge1$. $\endgroup$ Commented Dec 13, 2015 at 14:18

3 Answers 3

  • $W^R$ means the reverse string of $W$.

  • You are right about the DFA. If a DFA $A$ accepts the language $L$ then it rejects all the words that are not in $L$. But the word $\sigma = 0110100$ is in the language!. Consider $W=0$ and $x=11010$.

  • As G.Bach eloquently stated in his comment(a very interesting property of the language):

$$\{WxW^R : W,x\in \{0,1\}^+\} = \{WxW : W\in\{0,1\} , x\in \{0,1\}^+\}$$


Because there is little restriction to $x$. We can consider that $x$ is almost the whole word with the exception of the first and the last symbol(because in the original language $|W|>0$). The reverse string of any word with unitary size is the same word. So words like:

$$\sigma_1 = 01110000$$ $$\sigma_2 = 11111101$$

Are in the language. All that matter is the first and the last symbol. This language is very interesting because it appears to be irregular at the first sight.

  • $\begingroup$ So this would be 0.+0|1.+1 with $.\in \{0,1\}$ :-) $\endgroup$
    – Harald
    Commented Dec 16, 2015 at 12:05
  • $\begingroup$ $L = \mathscr{L}(\,0 (0|1)^+ 0\, |\, 1 (0|1)^+ 1\,)$ $\endgroup$ Commented Dec 16, 2015 at 14:13
  • $\begingroup$ So what happened is that a language L was described in a way that makes it look really complicated, but it’s a bluff and in reality it’s really simple. And therefore proving that it is regular also looks really difficult but turns out to be really simple, once you figure out someone’s playing a trick on you. $\endgroup$
    – gnasher729
    Commented Oct 2, 2020 at 21:02

Sure !! this is a Regular Language
Language : Start & End with same Symbol.

eg; W: 000111 WR : 111000

WxWR : 0 0011111100 0

First & Last symbol of language is W & WR respectively & remaining is in x. You can check any input for W, the language hold the properties Start & End with same Symbol.

  • 3
    $\begingroup$ Welcome. While your answer is correct, I don't see what it adds. The observation that the language is just the set of strings that start and end with the same symbol has been made multiple times already, both in the existing answer and in the comments. We have plenty of unanswered questions and it would be much better to use your time answering some of those, rather than duplicating existing answers. $\endgroup$ Commented Dec 16, 2015 at 12:08

it's a tricky question but quite simpe one when you know the logic...

say w = 100, x= 101 => wr= 001

the complete string wxwr will be 100101001

now what we can do here is extend x in both direction so it consumes parts of w and wr leaving only the starting and ending symbol now x = 0010100 and w,wr = 1;

so simply the problem is reduced to string starting and ending with same symbol, now a DFA can be constructed.

so yes this is a regular language.

  • $\begingroup$ Thanks for taking the time to answer! Your answer is correct but we already have basically this answer twice already on this page so there's not really much benefit in posting it for a third time, just in slightly different words. $\endgroup$ Commented Jan 15, 2019 at 15:06

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.