Take any nonregular language $L$. Denote by $L^c$ the complement of $L$ in $A^*$. Then the languages $1 + L$ and $1 + L^c$ are also nonregular. However, $A^* = L + L^c \subseteq (1 + L)(1 + L^c)$ and thus $(1 + L)(1 + L^c) = A^*$. This gives you uncountably many counterexamples, since there are only countably many regular languages and uncountably many subsets of $A^*$ if $A$ is nonempty.
Note: Here $+$ denotes union and $1$ denotes the language reduced to the empty word.
Let us start with the definition of closure for an operator on a set. If you have an operation $f$ on a set $E$, a subset $S$ of $E$ is closed under $f$ if the result of applying $f$ to the elements of $S$ is still an element of $S$. The operation can be unary (like $f_1(x) = x^2$), binary (like $f_2(x,y) = x+y$), ternary (like $f_3(x, y, z) = xyz$), or $n$-ary for some $n$.
In the case of languages, some common operations are
- Union (binary): $L_1 \cup L_2$
- Intersection (binary): $L_1 \cap L_2$
- Complementation (unary): $L^c$
- Product (binary): $L_1L_2$
- Star (unary): $L^*$
As you know, the set of regular languages is closed under these operations, which means that, if $L, L_1, L_2$ are regular languages, then $L_1 \cup L_2$, $L_1 \cap L_2$, $L^c$, $L_1L_2$ and $L^*$ are also regular.
Now the notion of closure is also used in a larger setting. For instance, in the case of regular languages, let $A$ and $B$ be two alphabets and let $f:A^* \to B^*$ be a monoid homomorphism${}^*$. Then one says that "regular languages are closed under homomorphisms and under inverses of homomorphisms" to mean that:
- if $K$ is a regular language of $A^*$, then $f(K)$ is a regular language of $B^*$,
- if $L$ is a regular language of $B^*$, then $f^{-1}(L)$ is a regular language of $A^*$.
Now, some properties on regular languages can be proved using automata, but some other ones can be proved more easily by using the closure properties listed above or some more advanced closure properties. See this question for an example.
${}^*\scriptsize{\text{that is, a map satisfying $f(1) = 1$ and $f(uv) = f(u)f(v)$ for all words $u$ and $v$}}$
Best Answer
As a hint, a common way of showing two sets, $A\text{ and }B$ are equal is to show that $A\subseteq B$ and that $B\subseteq A$. Depending on your construction of $M$ you shouldn't have much difficulty showing that, first, any word in $L(M)$ is in $L(A_1)*L(A_2)$ and, second, that any word in $L(A_1)*L(A_2)$ is accepted by your $M$.