Let $Σ=\{a,b,c\}$. Which of the following statements is true? $1)$ For any $A\subseteq\Sigma^*$, if $A$ is regular, then so is $\{x∣ xx\in A\}$.
$2)$ For any $A\subseteq\Sigma^*$, if $A$ is context-free, then so is $\{x∣xx\in A\}$
According to me the $1^\text{st}$ statement should be correct but I am not getting any clue regarding $2^\text{nd}$ option since if $xx$ is CFL then I guess $x$ should also be CFL , but still I am confused with this option. I don't know how to approach this question.
 A: You are right about the statement for regular languages. This is a well known fact usually expressed by the phrase that regular languages are closed under square root (quite unfortunately, the operation you are describing is sometimes even denoted by $\sqrt{A}$) – the details of the proof should be easily googlable. 
The case of context-free languages is more interesting. Let us take the following language:
$$A = \{a^i b^i c^j a^n b^m c^m ~|~ i,j,n,m \in \mathbb{N};~i,j,n,m \geq 1\}.$$
The language $A$ is obviously context-free.
Now, the language $\{x ~|~ xx \in A\}$ contains precisely all words $x \in {\{a,b,c\}}^*$, such that $xx = a^i b^i c^j a^n b^m c^m$ for some suitable $i,j,n,m$. Quite obviously, this is the case if and only if
$$x = a^i b^i c^j = a^n b^m c^m$$ for some $i,j,n,m$. But this directly implies $i = j = n = m$. As a result, the square root of $A$ contains precisely all words $x \in {\{a,b,c\}}^*$, such that $x = a^n b^n c^n$ for some $n$. Put in another way,
$$\{x ~|~ xx \in A\} = \{a^n b^n c^n ~|~ n \in \mathbb{N};~n \geq 1\}.$$
This language is not context-free. So the family of context-free languages is not closed under square root. 
