I am trying to rewrite the following Hamiltonian in the matrix form, but I get different results. In this article, the Hamiltonian that represents a three-qubit Heisenberg spin chain


and its matrix form:

Hamiltonian matrix form


definitions of sigma j

are the Pauli operators that can be calculated from the relation:

definition of Pauli operators

where $I$ is the 2×2 identity matrix. I wrote and used the following code:

σx = PauliMatrix[1]; 
σy = PauliMatrix[2];    
σz = PauliMatrix[3];  
σI = IdentityMatrix[2];

σ1x = KroneckerProduct[σx, σI, σI];
σ2x = KroneckerProduct[σI, σx, σI];
σ3x = KroneckerProduct[σI, σI, σx];
σ1y = KroneckerProduct[σy, σI, σI];
σ2y = KroneckerProduct[σI, σy, σI];
σ3y = KroneckerProduct[σI, σI, σy];
σ1z = KroneckerProduct[σz, σI, σI];
σ2z = KroneckerProduct[σI, σz, σI];
σ3z = KroneckerProduct[σI, σI, σz];

H = J σ1x.σ2x + J σ1y.σ2y + b σ1z + J σ2x.σ3x + J σ2y.σ3y + b σ2z +
    J σ3x.σ1x + J σ3y.σ1y + b σ3z + d (σ1x.σ2y - σ1y.σ2x) + 
    d (σ2x.σ3y - σ2y.σ3x) + d (σ3x.σ1y - σ3y.σ1x);


But the matrix I got is differing from that mentioned in the article. I make sure that the relations of Pauli Matrices are correct more than once, but I don't know exactly where the error is. Is there an error in my code?

  • 2
    $\begingroup$ Without looking too carefully at the result of your calculation, it looks to me like both results are correct. You have just chosen a different order for your basis elements, and so your matrix elements are in different place. You should try to sort things so that you get the block-diagonal form shown. $\endgroup$
    – march
    Commented Feb 5, 2020 at 16:42
  • $\begingroup$ Many thanks for the response. Can you please explain more? $\endgroup$
    – Bekaso
    Commented Feb 5, 2020 at 16:50
  • $\begingroup$ To check if @march is correct, just diagonalize both Hamiltonians using Eigenvalues[ ], and if the eigenvalues are the same then the basis vectors are chosen differently in both forms. $\endgroup$ Commented Feb 5, 2020 at 16:56
  • $\begingroup$ @Michael Weyrauch, I think Eigenvalues[ ] of both matrices are not the same. There is a multiplying by 2 in some terms appearing in my results. $\endgroup$
    – Bekaso
    Commented Feb 5, 2020 at 17:06
  • $\begingroup$ I take back my previous comment. Note that if you take $d\to d/2$ and $J\to J/2$, the Hamiltonian you've shown is obtained (except for re-ordering within subspaces) with your code, after applying the transformation in my answer. So either the paper is missing the those factors of 1/2 accidentally, or you didn't read it right. Either way, it's not a problem, because it's just a re-scaling of some of the parameters. $\endgroup$
    – march
    Commented Feb 5, 2020 at 17:19

1 Answer 1


Consider the operator $$ \sigma_z=\sum_{i=1}^3\sigma_{i,z}, $$ which is

σ1z + σ2z + σ3z // MatrixForm

enter image description here

This operator commutes with the Hamiltonian:

#.H - H.# &@(σ1z + σ2z + σ3z) // Abs // Total // Total
(* 0 *)

Thus, the Hamiltonian can be block-diagonalized according to different eigen-subspaces of $\sigma_z$. To do this, we pick out the ordering of the eigenvalues on the diagonal of $\sigma_z$ (since it's already diagonal), and change basis to the re-ordered basis:

order = σ1z + σ2z + σ3z // Diagonal // Ordering
H[[order, order]] // MatrixForm
(* {8, 7, 6, 5, 4, 3, 2, 1} *)

enter image description here

Apart from those factors of 2 and re-ordering of the basis elements within the subspaces, these matrices are the same.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.