Been working on my homework and I've been stuck on a question for over a week now. Not really asking for a solution but if someone could point me towards the right direction that would be great, as I have literally no idea of how to go about this. A previous question asked us to show that for any DFA that accepts A, we can create a NFA that accepts {wR | w in A}, which was pretty easy (just reverse the DFA).

This question asks: Show that if A is a regular language, then so is {w|wwR in A}, where wR is the reverse of the string w.

I know that if I have two regular expressions, then their concatenation is also a regular expression, that's simple. But this asks me to show that the first-half of some of the strings in A is a regular expression. No idea how to show that this is true. It's not even intuitive to me that this is true, except that the question implies it is.

Anyone got any idea of where to start about this? Thanks!


1 Answer 1


You might want to study If $L$ is a regular language then so is $\sqrt L=\{w\mid ww∈L\}$.

The solution is to simulate the DFA in parallel with itself, from both sides of the string. For each letter one step forward (for $w$) and one step backward (for $w^R$). If the forward state reading $w$ reaches the same state as the backward simulation, both parts joined form a computation on $ww^R$.

  • 2
    $\begingroup$ To make this explicit: use non-determinism heavily. You can determinise it away after, if you want. $\endgroup$
    – Raphael
    Commented Sep 27, 2016 at 7:44

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.