# Are interaction terms commutative?

Im trying to understand interaction effects a little better. My question is, if I have a model that's described by:

$$y = \beta_{0} + \beta_{0}x_{1} + \beta_{0}x_{2} + \beta_{0}x_{1}x_{2} + \epsilon$$

where, $$\mathit{x_i\sim N(0,1)}$$ and $$\epsilon\sim N(0,1)$$.

Is the interaction between $$x_1$$ and $$x_2$$ commutative?

As in, if I change the order of the variables to the following, does it make a difference... and if so, why?

$$y = \beta_{0} + \beta_{0}x_{1} + \beta_{0}x_{2} + \beta_{0}x_{2}x_{1} + \epsilon$$

• Is it really the intention that all the $\beta$'s shall have the same subscipt $_0$, so be identical? – kjetil b halvorsen Aug 15 '19 at 15:24
• yes, that's intentional. In the toy model I'm experimenting with I've set all the $\beta$'s to have the same value. However, it's not a necessity that they are all equal. – Electrino Aug 15 '19 at 15:29

If $$x_1$$ and $$x_2$$ are real numbers, then their multiplication commutes.

You could rewrite your equation like this:

$$y = \beta_0 + \beta_0x_1 + \beta_0 x_2 + \beta_0x_3 +\epsilon$$

$$x_3 = x_1x_2$$

I think this makes it clear that the interaction commutes.

Yes, under the commutativity law for multiplication, $$\beta_{0}x_{2}x_{1}$$ and $$\beta_{0}x_{1}x_{2}$$ are the same.

• Follow up question, if $\beta_{0}x_{1}x_{2}$ and $\beta_{0}x_{2}x_{1}$ are commutative, then am I correct in saying that if I measure the interactions $x_{1}:x_{2}$ and $x_{2}:x_{1}$, then I should get the same value (i.e., the interactions are symmetrical?) – Electrino Aug 15 '19 at 16:00
• @Electrino Yes: $x_1x_2$ and $x_2x_1$ are literally the exact same numbers. – Dave Aug 15 '19 at 16:39
• thanks for the clarification. The main reason I'm being explicitly clear is because, for some reason, in my model, the interactions aren't exactly symmetrical. I'll post a different question to try get to the bottom of this. – Electrino Aug 15 '19 at 18:02
• @Electrino I wonder if it's because of some numerical issue when you switch the multiplication order. When you multiply the $x_1$ and $x_2$ columns to produce $x_3$, are the numbers slightly different than when you reverse the multiplication order? – Dave Aug 15 '19 at 18:33

Conventionally speaking, there is no interaction terms in the model. Rewritten as $$y=\beta_0(x_1 + x_2 + x_1x_2) + \epsilon$$, we see this is simple linear regression of $$y$$ on $$z=x_1+x_2+x_1x_2$$ with forcing the intercept term to be zero.

Given that $$z$$ is symmetric in $$x_1$$ and $$x_2$$, it seems clear that the "interaction" is "symmetric" in $$x_1$$ and $$x_2$$ in any sense of the word.