Associative property (source code)

= Associative property
{title2=$(a\ast b)\ast c=a\ast(b\ast c)$}
{wiki}

= Associativity
{synonym}

= Associative operation
{synonym}

= Associative
{synonym}

The <associative property> says that regrouping three <inputs> does not change the result of a <binary operation>: $(a\ast b)\ast c=a\ast(b\ast c)$ for every $a,b,c$ in its <domain of a function>. It changes parentheses while keeping the order of the <inputs>. <Commutativity> instead exchanges two <inputs>; the two properties are different.

For <addition> modulo three, $(2+1)+1\equiv2+(1+1)\equiv1\pmod3$. For <subtraction> modulo three,
$$
(2-1)-1\equiv0,\qquad 2-(1-1)\equiv2\pmod3,
$$
so the second <binary operation> fails the <associative property>. One failed triple disproves <associativity>; checking a few successful triples does not establish it for all <inputs>.

The useful consequence is that a finite ordered sequence can be combined in chunks. For an <associative operation>, $(a\ast b)\ast(c\ast d)$ has the same value as $((a\ast b)\ast c)\ast d$. Intermediate results can therefore summarize parts of a computation without retaining their internal parentheses. The order must still be preserved when the <binary operation> is not <commutative>. <Function composition> and <concatenation> provide examples where grouping is harmless but exchanging entries changes the result.