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


1 Answer 1


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^*$.


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.