In the book I am reading it is written:
The associative law was enunciated only for three elements, but can in fact be easily proved in its more general form, namely that, without ambiguity,
$(A_1A_2...A_r)(A_{r+1}...A_n)=(A_1A_2...A_s)(A_{s+1}...A_n)$, where $r$ and $s$ are any two integers between $1$ and $n$.
There, this is proved with the help of mathematical induction, and I strongly dislike induction-based proofs because of some reasons.
But, to leave aside my personal feelings about method of mathematical induction, I am not satisfied with this generality and I think that it should be proved, if true, that the product of $n$ elements in a group does not change its value no matter where are the parentheses and how many of them there are?
In the example above from book there is only one pair of parentheses and I would like to see more general statement than this one from the book.
So, how to prove (without method of mathematical induction) that the product of $n$ elements in a group does not change its value no matter how many parentheses there are and no matter where are they placed?
Write $a(r,s)$ for the product $A_rA_{r+1} \dots A_s$ whenever this is well-defined. We know that it is well-defined (doesn't depend on bracketing) for products of two or three elements.
Now suppose we have a counterexample of minimal length. So that with $r\le s\lt n$ $$\left(a(1,r)\right)\left(a(r+1,n)\right)\neq \left(a(1,s)\right)\left(a(s+1,n)\right)$$taking the outermost brackets in each product. We can't have $r=s$ because the products would be the same, so $r\lt s$ and we can write $$\left(a(1,r)\right)\left(a(r+1,s)a(s+1,n)\right)\neq \left(a(1,r)a(r+1,s)\right)\left(a(s+1,n)\right)$$ because we can bracket the shorter terms however we like by minimality. And this inequality contradicts the associative law.
But then there are as many reasons to dislike proof by contradiction as proof by induction, and the inductive property of the natural numbers is always behind their use in proofs like this. eg How do you prove that any non-empty set of natural numbers has a smallest element? See this question for the answer to that.