1
$\begingroup$

$a^n$ is a regular expression. $b^n$ is a regular expression. their concatenation is $a^nb^n$ which is not a regular expression.

$\endgroup$
12
$\begingroup$

If $n$ is fixed then $a^n$ is just a single word and so is $a^nb^n$.

If by $a^n$ you mean the language $\{a^n \mid n \ge 0\}$ (whose corresponding regular expression is $a^*$) then the problem is that the variable $n$ in $a^n$ is independent of the variable with the same name in $b^n$.

The language obtained by concatenating $A=\{a^n \mid n \ge 0\}$ with $B=\{b^n \mid n \ge 0\}$ is $\{xy \mid x \in A, y \in B\} = \{a^nb^m \mid n,m \ge 0\}$ and the corresponding regular expression is $a^*b^*$. As you can see this is exactly the concatenation of $a^*$ and $b^*$.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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