# Poincare Project: Associativity

Previously, we introduced the concept of a set with a binary operation that takes as inputs two elements of the set and outputs an element of the set.

What about taking three inputs? After all, in the examples given of integers with the addition operation or strings with the concatenation operation, it isn't difficult to think of calculating a+b+c by applying the + operation twice. You just work out a+b and then apply the operation again to that and c.

In other words, a+b+c = (a+b)+c.

In fact, in the case of adding integers or concatenating strings, you could work from the right too and work out b+c first and then apply the operation to a and that.

In other words, a+b+c = a+(b+c)

The fact that you can work this out by successive applications of a binary operation working either from the left or right isn't true of all binary operations. For example, if our set is the integers and our operation is subtraction then we can get a different result depending on which pair we start this.

If we interpret 3-2-1 as (3-2)-1 we get 0. However, if we interpret 3-2-1 as 3-(2-1) we get 2.

Addition of integers has a property that subtraction on integers does not. This property is called associativity.

A binary operation # on a set is said to be associative if and only if (a#b)#c = a#(b#c) for all a, b and c in the set.

If a binary operation is associative, it doesn't matter which way we calculate a#b#c.

If a binary operation is non-associative, we have to decide, usually just as a convention, whether we calculate the left-most pair first or the right-most pair first. If we adopt a left-first convention, the operator is said to be left-associative and if we adopt a right-first convention, the operator is said to be right-associative.

Note that left-associative and right-associative mean that the operation is non-associative. In other words, a binary operation is either associative or not and if not, then (by convention) left-associative or right-associative.

Subtraction on the integers is left-associative by convention. 3-2-1 = 0 and not 2.

Exponentiation on the integers is taken to be right-associative. 3^3^2 = 3^(3^2) = 3^9 and not (3^3)^2 = 27^3.

UPDATE: next post

The original post was in the category: poincare_project but I'm still in the process of migrating categories over.