## Associativity is About Composition

## Objects as Actions

It's natural to think of mathematical objects as 'things'. $1$ is *a natural*. $\varnothing$ is *a set*. $(6, 7)$ is *a tuple*. And we can then do things *to* these objects. We can, for instance, *add* numbers, or perhaps, *find the union of* sets. These are the actions we pair with our objects. However, it can be useful to instead think of our objects as, themselves, actions.

How does this work? Consider the real number line. It has a bunch of numbers on it. It's got $0$. It's got $1$. It's got $1.5$. It's got $\frac{1 + \sqrt{5}}{2}$. You name it. As discussed, these numbers don't just sit there and do *nothing*; we get to have fun with them! We can add them! We can subtract them! We can multiply them! We can divide them! And we can do many other things as well.

When we apply one of these operations to two numbers, we get another number back out. For instance, $2 + 3 = 5$. And $5$ is a number (I'm sure of it). In this manner, numbers somehow kind of have actions associated with them: adding $2$ is an action which moves a given number two to the right on the number line. Subtracting $1$ moves a given number one to the left. (Multiplication and division represent dilations by some factor.)

Okay, but so what? Well, now we have a new way to think about numbers and a new way to read operations. Now we can read $2 + 3$ not as just plain "two plus three, the result of an algebraic operation", but rather as "the result of applying the action 'move $2$ to the right' to the number $3$". Either way, we get $5$, but the differing thought process is interesting.

And this thought process gets espeically interesting when you apply it to associativity...

## Associativity

Addition is an assocative operation. This is a fact. We write this fact as follows:

$$ x + (y + z) = (x + y) + z $$Let's experiment and try to think of this statement in terms of actions, like we just discussed. In order to facilitate this, I will make a variable replacement, as follows:

$$ f + (g + x) = (f + g) + x $$Now let's read it. The left side says to start with $x$, and then apply the action of $g$, within the context of addition, and then, to the result, apply the action of $f$. Take $x$, and apply two actions to it, as specified by $f$ and $g$. The right side says something slightly different. Start with $x$, it says, and apply the action $f + g$ to it.

Now, hold up. What is $f + g$? If we're thinking of both $f$ and $g$ as actions, it doesn't really make sense to add them—to apply one action to another action. However, since $f$ and $g$ are just numbers, we *can* add them; we just don't yet know what doing so *means*.

Luckily, we can find out! Note the equal sign in the middle of the equation. It tells us that the two sides are just two ways of doing the *same thing*.

This solves our mystery. Since the two sides are equal, then applying $f + g$ to $x$, which is given by the right side, must be the same as applying $g$ and then applying $f$, which is given by the left side. That is, $f + g$ somehow combines the two actions $f$ and $g$ into only one action, so that applying $f+g$ to a number applies $f$ and then $g$. Canonically, $f + g$ is a kind of *composition* of the actions $f$ and $g$.

Thus, I claim, the deep meaning of associativity is about *composition*: if an operator $\star$ is associative, that means that for two actions $f$ and $g$, there is a third action which is the composition of those two; this third action is called $f \star g$.

To close, I'd like to juxtapose the definition of associativity with that of composition, and note that they are, indeed, quite similar. And under the "objects as actions" understanding, they essentially read the same:

$$ \begin{align*} \text{Composition: } & (f \circ g)(x) \hspace{2pt} = f(g(x)) \\ \text{Associativity: } & (f \star g) \star x = f \star (g \star x) \end{align*} $$