I am reading this book about numerical methods in physics. It has the following question:

Consider the Ising Hamiltonian defined as following $$H=-\sum_ {i=1}^{N-1} \sigma_i^x \sigma_ {i+1} ^x + h \sum_ {i=1} ^N \sigma_i^z$$

Write a program that computes the $2^N \times 2^N$ matrix for different $N$

From quantum mechanics, I know that any operator can be expressed in matrix form as follows $$H_{rs}\dot{=}\langle r |H|s\rangle$$ where $|i\rangle$ are any basis.

My question is what basis can I take for this Hamiltonian? Is there any other way to write this Hamiltonian in matrix form?

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – rob
    Commented Dec 30, 2018 at 14:15

2 Answers 2


For completeness I'll summarize the answer here. After a fun conversation in the comments, we saw that it will be more illuminating to write

$$H=-\sum_ {i=1}^{N-1} \sigma_i^x \sigma_ {i+1} ^x + h \sum_ {i=1} ^N \sigma_i^z $$


$$ H=-\sum_ {i=1}^{N-1} \sigma_i^x \sigma_ {i+1} ^x + h\left( \sum_ {i=1} ^{N-1} 1_1 \otimes \cdots 1_{i-1} \otimes \sigma_i^z \otimes 1_{i+1} \otimes \cdots \otimes 1_{N-1} \right) + h ( 1_1 \otimes \cdots \otimes 1_{N-1} \otimes \sigma^z_N) $$

where it is understood that (to prevent clutter)

$$ \sigma_i^x \sigma_{i+1}^x = 1_1 \otimes \cdots\otimes 1_{i-1} \otimes \sigma^x_i \otimes \sigma^x_{i+1} \otimes 1_{i+2} \otimes \cdots \otimes 1_{N} $$

and the subscripts are there to denote nothing more than the position of insertion (i.e. they are all $2\times 2$ identity)

We then create a matrix from the direct product of matrices $A,B$ where $[A] = m \times n$ and $[B] = p \times q$ matrices

$$ \mathbf {A} \otimes \mathbf {B} ={\begin{bmatrix}a_{11}\mathbf {B} &\cdots &a_{1n}\mathbf {B} \\\vdots &\ddots &\vdots \\a_{m1}\mathbf {B} &\cdots &a_{mn}\mathbf {B} \end{bmatrix}}. $$

We apply this to the $i^{th}$ term and then loop over all $i$ to achieve the desired matrix.

  • $\begingroup$ Your tensor product notation doesn't make sense: $\sigma_N^z$ is $\sigma^z$ acting on site $N$. You can't tensor this with $I_N$, which is $I$ acting on site $N$. You want to rather tensor it with $I$ on all other sites -- that's the definition of $\sigma_N^z$. $\endgroup$ Commented Dec 29, 2018 at 22:59
  • $\begingroup$ You're right. Thank you. I've made an edit but the notation is a bit sloppy still. $\endgroup$ Commented Dec 29, 2018 at 23:13
  • $\begingroup$ Much better, but for consistency you should also add the identities in the first term! $\endgroup$ Commented Dec 29, 2018 at 23:13
  • $\begingroup$ Will do, gonna do that now $\endgroup$ Commented Dec 29, 2018 at 23:14
  • 1
    $\begingroup$ I see. Yes, that would screw up things dimensionally. Thanks a lot for clearing everything up. $\endgroup$ Commented Dec 29, 2018 at 23:31

$\textbf{Quick hint :}$

Interpret spin operators (for chain of length-N) this way (spin operators act on tensor product space) : $$\sigma_{i}^{\alpha} \rightarrow\underset{N_{}^{\text{th}}\text{order direct/kronecker product of identity and pauli matrices}}{\mathbb{I}_{}^{}\otimes\cdots\otimes\underset{i_{}^{\text{th}} \text{position}}{\sigma_{}^{\alpha}}\otimes\cdots\otimes\mathbb{I}_{}^{}}$$ which makes (for $i < j$):

$$\sigma_{i}^{\alpha}\sigma_{j}^{\beta} \stackrel{i < j}{\rightarrow} \mathbb{I}_{}^{}\otimes\cdots\otimes\underset{i_{}^{\text{th}} \text{position}}{\sigma_{}^{\alpha}}\otimes\cdots\otimes\underset{j_{}^{\text{th}} \text{position}}{\sigma_{}^{\beta}}\otimes \cdots\otimes\mathbb{I}_{}^{}$$ with standard definition of direct/Kronecker product of matrices

Note also that Kronecker product is associative.

$\mathbb{I}$ is $2 \times 2$ identity matrix and $\sigma_{}^{}$'s are standard Pauli matrices.


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.