# Solve system of non commutative operators

I'd like to use mathematica to solve systems of linear equations, where the entries are non commutative matrices. I just tried the NC package but it doesn't help so far. For example I can solve:

 In[1]: NCSolve[a0 ** b0 + a1 ** b1 + a2 ** b2 + a3 ** b3 == 1, a0]
Out[1]: {a0 -> inv[b0] - a1 ** b1 ** inv[b0] - a2 ** b2 ** inv[b0] - a3 ** b3 ** inv[b0]}


what's fine. But NCSolve only works for one equation with one unknown. So I'd like to know if there is any tool to solve e.g.:

IN[2]: Solve[{a0 ** b0 + a1 ** b1 + a2 ** b2 + a3 ** b3 == 1,
a1 ** b0 + a0 ** b1 + I*(a2 ** b3 - a3 ** b2) == 0,
a2 ** b0 + a0 ** b2 + I*(a3 ** b1 - a1 ** b3) == 0,
a3 ** b0 + a0 ** b3 + I*(a1 ** b2 - a2 ** b1) == 0}, {a0, a1, a2,
a3}]


Unfortunately this isn't possible as I posted it and also it doesn't work with NCSolve. Any ideas or suggestions are welcome.

Additionally I'd like to know a way how to type this using matrices of non commuting matrices. I.e. what I posted before is just finding the inverse of in the Pauli-Spin basis of a 2x2 matrix, it would be nice to type something like

In[3]: a = a0*PauliMatrix[0] + a1*PauliMatrix[1] + a2*PauliMatrix[2] + a3*PauliMatrix[3]
b = b0*PauliMatrix[0] + b1*PauliMatrix[1] + b2*PauliMatrix[2] + b3*PauliMatrix[3]
NCSolve[a ** b == 1, {a0,a1,a2,a3]


Thanks a lot!

• Because a**b becomes a.b if you have a matrix representation of a and b, you can solve your Pauli spin matrix problem with Solve[a.b == IdentityMatrix[2], {a0, a1, a2, a3}] // Simplify. – Stephen Luttrell Jan 24 '14 at 13:49
• Thanks for your answer, but this is exactly what I dont want. In this solution mathematica assumes b0,b1,b2,b3,a0,a1,a2,a3 and their inverses to be commuting. But I want them to be not commuting. What makes the solution much more difficult. – PeMa Jan 24 '14 at 14:26
• Sorry, I was totally distracted by the non-commuting Pauli matrices, and I assumed that everything else commuted. However, building on my failure (?!), do you know enough about your non-commuting a's and b's to write them as a matrix representation, and then use the a**b -> a.b trick to reduce your problem to one in which the unknowns commute? – Stephen Luttrell Jan 24 '14 at 15:26
• The point is that I'm deriving a general solution for a special kind of problems. Actually all the a's and b's should never be commuting. That's like the central point of the story. Spoken in physical arguments this would result in zero current what is the trivial case of the problem. – PeMa Jan 24 '14 at 18:45
• I do understand that non-commutation is a basic property of your operators — after all, the operators have to “bump into each other” in order to generate non-trivial physics! I was sloppy with my notation when I wrote a**b -> a.b, because the a and b on the left hand side are non-commuting operators, whereas the a and b on the right hand side are a matrix representation of the same operators — in which the individual matrix elements are c-numbers but the overall matrices do not commute. … – Stephen Luttrell Jan 24 '14 at 23:17

This one is a loaded question. There is no general solver for equations involving non-commutative expressions. The NC Gröebner Basis algorithm in NCAlgebra provides one avenue to pursue solutions but would not be enough to "answer" the question without significant user input. What is necessary is a number of assumptions on invertibility of certain symbolic expressions that are not known a priori and have to be provided iteratively or algorithmically if one is to make progress.

In your case however, it is also possible to approach the problem from another vantage point. Because the unknowns {a0,a1,a2,a3} appear always multiplying on the left it is possible to construct an equivalent statement akin to taking Kronecker products to vectorize standard matrix equations. One could code such algorithm in NCAlgebra without too much effort. Furthermore, because the the product a ** b is also linear in b one can take advantage of standard (commutative) Mathematica tools. For example:

SNC[a0, a1, a2, a3]
SNC[b0, b1, b2, b3]
a = a0*PauliMatrix[0]+a1*PauliMatrix[1]+a2*PauliMatrix[2]+a3*PauliMatrix[3]
b = b0*PauliMatrix[0]+b1*PauliMatrix[1]+b2*PauliMatrix[2]+b3*PauliMatrix[3]
eqs = NCDot[a, b] - IdentityMatrix[2]


will produce the matrix equations represented by eqns. The following code vectorizes these equations:

vec = {Flatten[eqs]} // NCExpand
{bb, AA} = CoefficientArrays[CommuteEverything[Flatten[vec]],
{a0, a1, a2, a3}] // Normal
bb = {-bb};
AA = Transpose[AA];
EndCommuteEverything[]


using MMA's CoefficientArrays. The resulting vectorized equations corresponds to:

NCDot[{{a0, a1, a2, a3}}, AA] - bb


Indeed,

vec - NCDot[{{a0, a1, a2, a3}}, AA] + bb // NCExpand // Expand


should return all zeros. The coefficient array AA in this case is a 4x4 symbolic matrix with noncommutative entries. The solution to the equation

$$x \, AA = bb, \quad x = \{a0,a1,a2,a3\}$$

can be calculated symbolically using NCInverse and NCDot as in:

sol = NCDot[bb, NCInverse[A]]


Note that NCInverse implicitly assumes invertibility of all its pivots, which in this case is what you would need to provide.

The above operations produce the dazzling noncommutative rational sol which is more than 4000 terms long. Just expanding this with NCExpand will buy you time for a cup of coffee. Try NCSimplifyRational only on a long weekend :)

Producing algorithms for such types of problems is still part of our ongoing research and I would be curious to know of other similar relevant problems one would be interested.