# If $L^2$ is regular. Does that imply L is regular [duplicate]

If $$L^2$$ is regular. Does that imply L is regular.

I think L need not be regular. But I can't find any example where L is not regular but $$L^2$$ is regular.

My teacher told me an example where L={$$0^k$$ | k is composite} clearly L is not regular. But he claims that $$L^2$$ is regular. I don't know why it is regular? Please help.

• Your teacher gave good example. You should just write out some words in $L^2$ to see what $L^2$ is actually equivalent to. That's the hint. – Apiwat Chantawibul Sep 2 '19 at 11:17
• I added an answer to the other question, explaining why your teacher's claim is true. – David Richerby Sep 2 '19 at 18:56