Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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, 

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!

share|improve this question
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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.