I want to exactly diagonalize the following Hamiltonian for $10$ number of sites and $4$ number of spinless fermions $$H = -t\sum_i^{L-1} \big[c_i^\dagger c_{i+1} - c_i c_{i+1}^\dagger\big] + V\sum_i^{L-1} n_i n_{i+1}$$ here $L$ is total number of sites, creation ($c^\dagger$) and annihilation ($c$) operators are defined as following $$ c = \begin{bmatrix} 0&0\\1&0 \end{bmatrix} $$ and $n_i = c_i^\dagger c_i$ is number operator.

To exactly diagonalize (for simplicity let's take $L=4$ sites), one can expand $H$ as

$$H = -t\big[ c_1^\dagger \sigma_1^z \otimes c_2\otimes I_3 \otimes I_4 \\ + I_1 \otimes c_2^\dagger \sigma_2^z \otimes c_3\otimes I_4\\ + I_1 \otimes I_2 \otimes c_3^\dagger\sigma_3^z \otimes c_4 \big]+h.c.\\ +V\big[ n_1 \otimes n_2 \otimes I_3 \otimes I_4\\ +I_1 \otimes n_2 \otimes n_3 \otimes I_4\\ +I_1 \otimes I_2 \otimes n_3 \otimes n_4 \big]$$ where $\sigma^z$ (Pauli matrix) is just simple matrix multiplication for the sake of anti-commutation relation.

So far so good. (please correct me if I am doing anything wrong)!


I used the above method and numerically calculated the ground state and found that above method gives correct results for $V=0$ but when $V\ne0$ the results are wrong.

Eventually, I get to the point that I am not taking care of number of particles in the system. How do we numerically diagonalize a Hamiltonian matrix in the sector with chosen number of particles?

  • $\begingroup$ Can you show that $c_1^\dagger$ and $c_2$ anti-commute? If I follow your recipe and try to calculate the anticommutator of $c_1^\dagger = c^\dagger\sigma^z \otimes I$ and $c_2 = I \otimes \sigma^z c$ then I do not get the null matrix. $\endgroup$
    – wcc
    Jan 28, 2020 at 22:24

1 Answer 1


If you want to numerically diagonalize a Hamiltonian, it is recommended to construct nonzero elements $H_{ij} = \langle i|H|j\rangle$ instead of using the Kronecker product $\otimes$. You can follow this algorithm:

  1. Build the Wannier basis.
  2. Apply the Hamiltonian to each basis state.
  3. Utilize algebra software to solve the eigenvalue problem.

Here's an example for a system with $L = 4$ sites and $N = 2$ particles:

  1. Generate the basis, which consists of all possible states for $L$ sites with $N$ particles: ${0: |0011\rangle, 1: |0101\rangle, 2: |1010\rangle, 3: |1100\rangle, 4: |1001\rangle, 5: |0110\rangle}$. To generate and enumerate combinations, you can use combinadics.
  2. Apply the Hamiltonian:
    • The interaction term $n_i n_j$ produces diagonal elements, for example: $H_{0,0} = \langle 0011|H|0011 \rangle = V$.
    • The hopping term $c_i^\dagger c_{i+1}$ produces off-diagonal elements, for example: $H_{5,2} = \langle0110|H|1010\rangle = -t$ (Note: Fermions anticommute, so in the hopping term, one should consider fermion operator permutations. If required, multiply this term by $-1$).
  3. Use appropriate software like Matlab, Armadillo (C++), or numpy (Python) to solve the eigenvalue problem for $H_{ij}$.

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.