# How to represent $2n \times 2n$ Dirac matrices in terms of Pauli matrices in block matrix format?

I am interested in building matrices out of smaller matrices, do calculations, and express the results in a block matrix form, in terms of the smaller matrices.

For example, say I define the following $2\times 2$ Pauli matrices

σ0 = PauliMatrix[0]; (*{{1, 0}, {0, 1}}*)
σ1 = PauliMatrix[1]; (*{{0, 1}, {1, 0}}*)
σ2 = PauliMatrix[2]; (*{{0, -I}, {I, 0}}*)
σ3 = PauliMatrix[3]; (*{{1, 0}, {0, -1}}*)


In matrix format they look like $$\sigma0=\left(\begin{array}{rr} 1 & 0 \\ 0 & 1 \\ \end{array}\right), \sigma1=\left(\begin{array}{rr} 0 & 1 \\ 1 & 0 \\ \end{array}\right), \sigma2=\left(\begin{array}{rr} 0 & -i \\ i & 0 \\ \end{array}\right), \sigma3=\left(\begin{array}{rr} 1 & 0 \\ 0 & -1 \\ \end{array}\right).$$

Then, I define

O2 = {{0, 0}, {0, 0}};


and the following $4\times 4$ Dirac matrices

γ0 = ArrayFlatten[{{σ0, O2}, {O2, σ0}}];
γ1 = ArrayFlatten[{{O2, σ1}, {-σ1, O2}}];
γ2 = ArrayFlatten[{{O2, σ2}, {-σ2, O2}}];
γ3 = ArrayFlatten[{{O2, σ3}, {-σ3, O2}}];


For example, $\gamma2$ has the following matrix form $$\left(\begin{array}{rrrr} 0 & 0 & 0 & -i \\ 0 & 0 & i & 0 \\ 0 & i & 0 & 0 \\ -i & 0 & 0 & 0 \\ \end{array}\right),$$ and $\gamma1.\gamma2$ has the form $$\left(\begin{array}{rrrr} -i & 0 & 0 & 0 \\ 0 & i & 0 & 0 \\ 0 & 0 & -i & 0 \\ 0 & 0 & 0 & i \\ \end{array}\right).$$

What can I do to display $\gamma2$ in the form

$$\left(\begin{array}{rr} 0 & \sigma2 \\ -\sigma2 & 0 \\ \end{array}\right)$$

and $\gamma1.\gamma2$ in the form

$$\left(\begin{array}{rr} -i \sigma3 & 0 \\ 0 & -i \sigma3 \\ \end{array}\right)?$$

Note that

MatrixForm[{{O2, σ1}, {-σ1, O2}}]


works to display them as I need only as long as I don't define the symbols $O2$ and $\sigma2$, otherwise the result is in the usual matrix form.

• Please, do not post images of your code. Include it. Go over the help, to how to do it. – José Antonio Díaz Navas Nov 20 '17 at 20:59
• You can display the matrices as MatrixForm[{{O2, \[Sigma]1}, {-\[Sigma]1, O2}}]. Regarding the multiplication of matrices consisting in blocks I suggest you read this – José Antonio Díaz Navas Nov 20 '17 at 22:38
• @JoséAntonioDíazNavas: I replaced the pictures with with code. As for MatrixForm[{{O2, [Sigma]1}, {-[Sigma]1, O2}}], it works to display them as I need only as long as I don't define the symbols O2 and σ2, otherwise the result is in the usual matrix form. And I need to have the sigmas and gammas defined, but the result simplified into a block matrix format, not just to write them in the final form after I do the calculation myself, but to use Mathematica to find the final form automatically. – Cristi Stoica Nov 21 '17 at 7:15
• Have you looked at FeynCalc ? I think it has some cool functionality for Dirac algebra. – Sumit Nov 21 '17 at 9:45
• @Sumit: this FeynCalc looks great, I will look at it closer, thanks! – Cristi Stoica Nov 21 '17 at 10:57

Here is a way to do it.

1. Break your matrix into $2 \times2$ blocks.
2. Express the block in terms of Pauli matrices.

For step 2, I am using the method of @ybeltukov defined in answer of Expressing a matrix in terms of four basis matrices.

sigma[M__] := Module[{submat, basis, fb, nrm, cf},
submat = Partition[M, {2, 2}, 2]; (*2x2 submatrices*)
basis = PauliMatrix[#] & /@ {0, 1, 2, 3};(*Pauli Matrices*)
fb = Flatten[basis, {{1}, {2, 3}}];
nrm = Diagonal[fb.ConjugateTranspose[fb]]; (*norm of basis*)
cf[m_] := Flatten[m].ConjugateTranspose[fb]/nrm; (*coeff for σ*)
Map[{"I", "σ1", "σ2", "σ3"}.cf[#] &, submat, {2}]]


The last line is for output text.

Example 1

sigma[γ2] // MatrixForm


$\left( \begin{array}{cc} 0 & \text{$\sigma $2} \\ -\text{$\sigma $2} & 0 \\ \end{array} \right)$

sigma[γ1.γ2] // MatrixForm


$\left( \begin{array}{cc} -i \text{$\sigma $3} & 0 \\ 0 & -i \text{$\sigma $3} \\ \end{array} \right)$

Example 2: Visualising Outer product

M = ArrayFlatten@Outer[Times, σ2, σ3];
MatrixForm[M]
sigma[M] // MatrixForm


$\left( \begin{array}{cccc} 0 & 0 & -i & 0 \\ 0 & 0 & 0 & i \\ i & 0 & 0 & 0 \\ 0 & -i & 0 & 0 \\ \end{array} \right)$ $\left( \begin{array}{cc} 0 & -i \text{$\sigma $3} \\ i \text{$\sigma $3} & 0 \\ \end{array} \right)$

• This works like charm even for larger matrices containing Pauli matrices! – Cristi Stoica Nov 21 '17 at 11:16
• @CristiStoica, this method should work with any orthogonal basis set. It is easier to construct higher order Dirac matrices with Outer if you don't want to write them explicitly. I give an example (Example 2) for that. – Sumit Nov 21 '17 at 17:20