# Finding $L^*$ when $L=\{a^nb^n | n \geq 1\}$

Let $L=\{a^nb^n | n \ge 1\}$, then $L^\star=L^0 \cup L^1 \cup L^2 \cup L^3 \cup \dots = \{\epsilon\} \cup \{a^nb^n\} \cup L^2 \cup L^3 \cup \cdots$ .

How to find $L^2$ and $L^3$, and is $L^2=\{a^nb^na^nb^n\}$? In this video https://youtu.be/rnGpW6RRAcw at 31:51, the professor said that $L^2 = \{a^{n_1}b^{n_1}a^{n_2}b^{n_2}\}$, how did she find this form.

• "Find"? You apply the definition. – Raphael Jul 28 '17 at 4:47

$L^2 = LL = \{uv | u,v\in L\}$. In words, $L^2$ is a set of all strings that formed by concatenation of all strings from $L$. For instance, if $u=a^kb^k \in L$ and $v=a^tb^t \in L$ then $uv = a^kb^ka^tb^t$. That's why $L^2 =\{ a^{n_1}b^{n_1}a^{n_2}b^{n_2}\}$ for all $n_1, n_2 \geq 1$. Similarly $L^3, L^4,\dots$
Example with a finite set: $L=\{ab, cd\}$. Then $L^2 = \{abab, abcd, cdab, cdcd\}$.