Checking your quantum algebra with Mathematica

⇠ Back to Blog:Science

Here is a list of relations to normal-order the ladder operators of a two-level system, with $\mu, \nu\in\{0,1\}$:

  1. $[\ud{\sigma}\sigma,\ud{\sigma}^\mu\sigma^\nu]=(\mu-\nu)\ud{\sigma}^\mu\sigma^\nu$
  2. $[\sigma,\ud{\sigma}^\mu]=\mu(\mathbb{1}-2\ud{\sigma}^\mu\sigma)$
  3. $[\ud{\sigma},\sigma^\nu]=\nu(2\ud{\sigma}\sigma^\nu-\mathbb{1})$
  4. $[\sigma,\ud{\sigma}^\mu]\sigma^\nu=\mu\ud{\sigma}^{1-\mu}\sigma^\nu-2\mu(1-\nu)\ud{\sigma}^\mu\sigma^{1-\nu}$
  5. $\ud{\sigma}^\mu[\ud{\sigma},\sigma^\nu]=2(1-\mu)\nu\ud{\sigma}^{1-\mu}\sigma^\nu-\nu\ud{\sigma}^\mu\sigma^{1-\nu}$
  6. $\sigma^{\nu+1}=(1-\nu)\sigma^{1-\nu}$
  7. $\ud{\sigma}^{\mu+1}=(1-\mu)\ud{\sigma}^{1-\mu}$
  8. $\sigma^\nu\ud{\sigma}=\nu\mathbb{1}+(1-2\nu)\ud{\sigma}\sigma^\nu$
  9. $\sigma\ud{\sigma}^\mu=\mu\mathbb{1}+(1-2\mu)\ud{\sigma}^{\mu}\sigma$
  10. $\ud{\sigma}^\mu\sigma^\nu\ud{\sigma}=\nu\ud{\sigma}^\mu\sigma^{1-\nu}+(1-2\nu)(1-\mu)\ud{\sigma}^{1-\mu}\sigma^\nu$
  11. $\ud{\sigma}^\mu\sigma^\nu\ud{\sigma}=\nu\ud{\sigma}^\mu\sigma^{1-\nu}+(1-2\nu)(1-\mu)\ud{\sigma}^{1-\mu}\sigma^\nu$,
  12. $\ud{\sigma}\sigma\ud{\sigma}^\mu\sigma^\nu=\mu\ud{\sigma}^\mu\sigma^\nu+(1-\mu)(1-\nu)\ud{\sigma}^{1-\mu}\sigma^{1-\nu}$,
  13. $\ud{\sigma}^\mu\sigma^\nu\ud{\sigma}\sigma=\nu\ud{\sigma}^\mu\sigma^\nu++(1-\mu)(1-\nu)\ud{\sigma}^{1-\mu}\sigma^{1-\nu}$,
  14. $\sigma\ud{\sigma}^{1+\mu}\sigma^\nu=(1-\mu)\ud{\sigma}^\mu\sigma^\nu-(1-\mu)(1-\nu)\ud{\sigma}^{1-\mu}\sigma^{1-\nu}$,
  15. $\ud{\sigma}^\mu{\sigma}^{1+\nu}\ud{\sigma}=(1-\nu)\ud{\sigma}^\mu\sigma^\nu-(1-\mu)(1-\nu)\ud{\sigma}^{1-\mu}\sigma^{1-\nu}$,
  16. $\sigma\ud{\sigma}^\mu\sigma^\nu\ud{\sigma}=(1-\mu-\nu)(\ud{\sigma}^\mu\sigma^\nu-\ud{\sigma}^{1-\mu}\sigma^{1-\nu})$,

(They are in a footnote of my Electrodynamic's Wolverhampton Lectures on Physics). They are extremely useful to speed up quantum algebra, provided that they are all correct and trustable. This page details the process of their verification.

First, this all follows from straightforward algebra:

$$\{\ud{\sigma},\sigma\}=\mathbb{1}$$

from which it is easy to get:

$$[\ud{\sigma},\sigma]=2\ud{\sigma}\sigma-\mathbb{1} \quad\text{and}\quad [\sigma,\ud{\sigma}]=\mathbb{1}-2\ud{\sigma}\sigma\,.$$

For our regmat method of computing such correlators, one has to find closure relations involving, typically, operators of the type $\ud{\sigma}^\mu\sigma^\nu$ where $\mu, \nu\in\{0,1\}$. They are easy enough to obtain in the first place, but easier still to make a mistake, somewhere. The last thing you want in a heavy calculation that you have checked several times is to eventually recognize that the mistake lies in one of the relations above. This is similar to the joke of the despaired womanizer who tells his friend that he received a note with the mention "if you still see my wife, I will kill you!" The friend asks what problem does that pause, since, with so many women acquaintances, he can just stop seeing this one? "The note was not signed!" weeps the other one. The following thus make sure that the mistake lies in your calculation, not in the identities above.

We are checking with Mathematica. A first thing to take care of is that this language does not take the 0th power of a singular matrix to be the identity, but takes it as undefined (like $0^0$), unlike, though, what is the custom practice (for matrices). See this discussion, from which we borrow the fix:

Unprotect[MatrixPower]
MatrixPower[m_?SquareMatrixQ, 0] := IdentityMatrix[Length[m]]
Protect[MatrixPower]

We define a commutator for brevity (as long as we will feed matrices, that is okay since their matrix product (the dot) is non-commutative):

Com[A_, B_] := A . B - B . A

The following identity:

$$[\ud{\sigma}\sigma,\ud{\sigma}^\mu\sigma^\nu]=(\mu-\nu)\ud{\sigma}^\mu\sigma^\nu$$

is thus checked by:

Table[Com[\[Sigma]d . \[Sigma], 
   MatrixPower[\[Sigma]d, \[Mu]] . 
    MatrixPower[\[Sigma], \[Nu]]] == (\[Mu] - \[Nu]) MatrixPower[\
\[Sigma]d, \[Mu]] . MatrixPower[\[Sigma], \[Nu]], {\[Mu], 0, 
  1}, {\[Nu], 0, 1}]

That returns:

{{True, True}, {True, True}}

To make sure, it is better to append a //Flatten//Union to get a simple:

{True}

Since we are checking a list, and that the code itself is not particularly readable, the code is written in a way that the identities are numbered and kept in the same order as the list above. So (note to self): if I add another identity, anywhere in the list, please make sure to retain the good order between this page, the footnotes of Electrodynamics and the Mathematica notebook, which is attached at the end of the page.

Material