# What are the basic properties of products in TOC?

Data Structure AlgorithmsComputer ScienceComputers

It is easy to see that for any language L the following simple properties hold −

L · {∧} = {∧} · L = L

L · ∅ = ∅ · L = ∅

Now let’s see the commutativity and associativity of the operation of concatenation.

Properties of products – commutativity

The operation of concatenation is not commutative. In other words, the order matters!

Given two languages L and M, it’s usually true that

L · M ≠ M · L

Example

If L = {ab, ac} and M = {a, bc, abc}, then the product

L · M is the language

L · M = {aba, abbc, ababc, aca, acbc, acabc},

But the product M · L is the language

M · L = {aab, aac, bcab, bcac, abcab, abcac}

These have no strings in common!

Properties of products – associativity

The operation of concatenation is associative. In other words, if L, M, and N are languages, then

L · (M · N) = (L · M) · N

Example

If L = {a, b}, M = {a, aa} and N = {c, cd}, then

L · (M · N) = L · {ac, acd, aac, aacd}

= {aac, aacd, aaac, aaacd, bac, bacd, baac, baacd}.

This is the same as,

(L · M) · N = {aa, aaa, ba, baa} · N

= {aac, aacd, aaac, aaacd, bac, bacd, baac, baacd}.