# How to recover Pauli matrices properties in Mathematica?

I want to do a cross or dot product involving a vector of Pauli matrices
$$\vec\sigma=(\sigma^1, \sigma^2, \sigma^3)$$; for example, $$\vec\sigma\times\vec\sigma=2\mathrm i\vec\sigma$$ and $$\vec\sigma\cdot\vec\sigma=3 I_{2\times2}$$.

Is there a simple way to do these operations?

• Vectors like your $\sigma$ can be mapped to quaternions. You could consider doing this and using the Quaternions package. I'm saying this because implementing the algebraic properties of these matrices is the same as implementing quaternion calculations. Also, we do need a fourth basis vector $I$ as evidenced by your last relationship ($\sigma_i^2 = I$). – Szabolcs Oct 28 '16 at 13:51

The Pauli vector:

σ = Table[PauliMatrix[i], {i, 1, 3}]
MatrixForm /@ σ


One can define a dot product of matrices (in spaces of arbitrary dimension):

dot[a_, b_] := Total @ MapThread[Dot, {a, b}]


Then

dot[σ, σ] // MatrixForm


For the cross product of matrices, I literally took the cross product of vectors

Cross[{a, b, c}, {x, y, z}] /. {Times[A_Symbol, B_Symbol] -> Dot[A, B]}


{b.z - c.y, -a.z + c.x, a.y - b.x}

and redefined it as (in a 3D space)

cross[{a_, b_, c_}, {x_, y_, z_}] := {b.z - c.y, -a.z + c.x, a.y - b.x}


This gives

MatrixForm /@ cross[σ, σ]


i.e.

cross[σ, σ] == 2 I σ


True

Because I particularly like the multidimensional cross product of vectors, I'd like to post a few links:

There is a function called PauliMatrix. Here is the product of two such matrices:

PauliMatrix[1].PauliMatrix[2]


For example:

PauliMatrix[1].PauliMatrix[1] == PauliMatrix[4]

True


or

PauliMatrix[1].PauliMatrix[2] == -PauliMatrix[2].PauliMatrix[1]

True

• I think the OP wants symbolic results, rather than explicitly specifying the matrices. – QuantumDot Oct 27 '16 at 22:43
• The Pauli matrices are just particular case of geometric (Clifford) algebra orthonormal base elements. So you need some software of geometric algebra. Till you find better one, can look at my own implementation github.com/ArturasAcus/GeometricAlgebra. To mimic Pauli matrices you can use Cl[3,0] algebra (or Cl[2,0], where the role of third matrix is plays a bivector. – user18792 Nov 4 '16 at 7:02
• If you want to go the GeometricAlgebra way (as suggested in @user18792 's comment), there is a thread on this: mathematica.stackexchange.com/a/223597/63709 and a slick Paclet based implementation of generalized Geometric Algebra github.com/sw1sh/GeometricAlgebra – Joshua Schrier Aug 4 '20 at 16:43

Let

pv = σ /@ Range[3];


Then this verifies $$\vec{\sigma}\cdot\vec{\sigma}=3I$$:

(Inner[Dot, pv, pv] /. σ -> PauliMatrix) == 3 IdentityMatrix[2]

True


And this verifies $$\vec{\sigma}\times\vec{\sigma}=2\mathrm i\vec{\sigma}$$:

2 HodgeDual[Outer[f, pv, pv]] // Normal;
(% /. {f -> Dot, σ -> PauliMatrix}) == (2 I pv /. σ -> PauliMatrix)

True


Another possibility using FeynCalc 9.3 or above (could be interesting for particle physicists)

CLC[i, j, k] CSI[j].CSI[k] // PauliSimplify[#, PauliReduce -> True] & // FCE

2 I CSI[i]

CSI[i].CSI[i] // PauliSimplify // FCE

3


CSI is a shortcut for a Cartesian Pauli sigma matrix, while CLC denotes a Cartesian Levi-Civita tensor. PauliSimplify handles simplifications of the Pauli algebra. The option PauliReduce is used to reduce every Pauli chain to at most one Pauli matrix per term. FCE converts the output into a notation that is easier to read (external notation).