$A$ is a set with elements $a$ and $b$. Here, $a = (a_1a_2...a_n)$ and $b = (b_1b_2...b_m)$.
An operation ($*$) known as $\textit{concatenation}$ is defined on the set. That is, $a*b = ab$.
For example,
if $a = \underbrace{aaaaa}_\text{5 times}$ and $b = \underbrace{bbb}_\text{3 times}$ then $a*b = \underbrace{aaaaa}_\text{5 times}\underbrace{bbb}_\text{3 times}$.
Show that the operation is associative.
My working,
For associativity to hold,
$$(x*y)*z = x*(y*z)$$ but since the set only contains $a$ and $b$, then there would be $(2\times2\times2) = 8$ possible operations i.e.
$$(a*b)*a = a*(b*a)$$ $$(a*b)*b = a*(b*b)$$ $$(b*a)*b = b*(a*b)$$ $$(b*a)*a = b*(a*a)$$ $$(a*a)*a = a*(a*a)$$ $$(b*b)*b = b*(b*b)$$ $$(a*a)*b = a*(a*b)$$ $$(b*b)*a = b*(b*a)$$
So if associativity were to hold, would I need to prove all eight cases?
I'm really not sure if I'm on the right track or completely off.
For case 1, $$(a*b)*a = a*(b*a)$$
$$LHS: (a*b)*a = [(a*b)_1(a*b)_2...(a*b)_n](a_1a_2...a_m) $$
$$=[\left\{(a_1a_2...a_n)(b_1b_2...b_m)\right\}_1\left\{(a_1a_2...a_n)(b_1b_2...b_m)\right\}_2...\left\{(a_1a_2...a_n)(b_1b_2...b_m)\right\}_n](a_1a_2...a_m) $$
$$=[(a_1a_2...a_n)_n(b_1b_2...b_m)_n](a_1a_2...a_m) $$
$$RHS: a*(b*a) = (a_1a_2...a_n)[(b*a)_1(b*a)_2...(b*a)_m] $$
and by the same process we arrive at,
$$=(a_1a_2...a_n)[(b_1b_2...b_n)_m(a_1a_2...a_m)_m] $$