# Setting non-commutativity between two variables

Question: I have three functions that I am declaring.

Rx[\[Alpha]_] := Exp[-I \[Alpha] Gx];
Ry[\[Alpha]_] := Exp[-I \[Alpha] Gy];
Rz[\[Alpha]_] := Exp[-I \[Alpha] Gz];


I want to Series expand and simplify the product:
Rx[-v] Ry[-v] Rx[v] Ry[v]

i.e. Series[Rx[-v] Ry[-v] Rx[v] Ry[v], {v, 0, 2}]

The catch is, Gx, Gy and Gz don't commute with one another...

Is there a way to Series expand this product, and then simplify it, given that these three variables alone don't commute? (They commute with everything else...)

• You would need to define a custom operator which doesn't allow commutativity between the elements, Mathematica's standard Times (reference.wolfram.com/language/ref/Times.html) is not suitable for this use case. – user6014 Nov 1 '16 at 15:46
• How might I specify, not that the functions do not commute, but specifically the variables gx gy and gz? – jackskis Nov 1 '16 at 15:48
• @user6014, that's what NonCommutativeMultiply[] is intended for. – J. M. will be back soon Mar 29 '17 at 13:59

One approach would be to define a new multiplication operator (e.g. using CenterDot or any other predefined binary operator without a set definition), and define multiplication rules differentiating between expressions that do and do not contain Gx, Gy, Gz.

For example:

CenterDot[a___, b_?(FreeQ[#, Gx | Gy | Gz] &), c___] :=  b CenterDot[a, c]
CenterDot[a___, b_?(FreeQ[#, Gx | Gy | Gz] &) d_, c___] :=  b CenterDot[a, d, c]
CenterDot[a___, b_ + d_, c___] :=  CenterDot[a, b, c] + CenterDot[a, d, c]
CenterDot[] := 1
CenterDot[a_] := a

Series[
CenterDot[Exp[I v Gx],Exp[I v Gy],Exp[-I x Gx],Exp[-I v Gy]] /.
Exp[A_] :> Normal@Series[Exp[A], {v, 0, 2}]
,
{v, 0, 2}
]


Would produce the result for your example.

Update: Adding the following rule will help in dealing with powers of the same element

CenterDot[a___, (b : (Gx | Gy | Gz))^n_., (b : (Gx | Gy | Gz))^m_.,   c___] :=
CenterDot[a, b^(n + m), c]

• My example should simplify to 1 - (GxGy - GyGx)v^2, but it doesn't. It's close though. Know the problem? – jackskis Nov 1 '16 at 16:34
• @jackskis There was a silly typo. The last rule should have read CenterDot[a_] := a (now it does.) – mmeent Nov 4 '16 at 9:33