# Why does the chain be at equilibrium in the MH algorithm?

I'm implementing the Metropolis algorithm to solve the 2D Ising model. I've understood how to implement it and now I'm trying to understand a bit of how the algorithm works. In the site I'm reading it says

Consider a long chain of $$N_{configs}$$ configurations, in which the probability of a configuration appearing is given by the Boltzmann distribution. The chain must be “at equilibrium” in that $$number\,of\,transitions\,(C_a\rightarrow C_b)=number\,of\,transitions\,(C_b\rightarrow C_a)$$

The problem is with the "at equilibrium" part. I don't understand why this is the case and I need an intuitive explanation for it since I don't know anything about Markov chains. I think that the probability of going from $$C_a$$ to $$C_b$$ must be different than that of going in the opposite way, then why is the number of transitions equal?

• Yeah kind of but it's still not enough "introductory-level" to me. I was looking for something really ground-to-earth and intuitive to put in my paper to justify this "equilibrium" thing. Jan 4, 2022 at 21:02

I would say that in order to understand the Metropolis algorithm, you should know:

1. The propose: This algorithm allows to sample configurations according to an equilibrium distribution. This is, you have an energy that depends on the configuration of your system $$E(C)$$ and configurations have a probability $$P_{eq}(C)\propto e^{-\beta E(C)}$$ to appear. The Markov chain is built so the random walk in configuration space respects the equilibrium distribution.

2. Detailed balance: Since you are interested in equilibrium states, you can exploit that equilibrium distributions must fulfill detailed balance: $$P_{eq}({C_a})P(C_a\rightarrow C_b)=P_{eq}({C_b})P(C_b\rightarrow C_a)$$.

I think that the probability of going from Ca to Cb must be different than that of going in the opposite way, then why is the number of transitions equal?

This is correct, the probability of going from $$C_a$$ to $$C_b$$ is different, in general, to the probability of going in the opposite way. This is:

$$P(C_a\rightarrow C_b) \ne P(C_b\rightarrow C_a)$$.

However, the average number of transitions from $$C_a$$ to $$C_b$$ must be equal to the average number of transitions from $$C_b$$ to $$C_a$$. This is exactly the detailed balance condition since $$P_{eq}({C_a})P(C_a\rightarrow C_b)$$ is the probability flux from $$C_a$$ to $$C_b$$, that can be interpreted as the average number of transitions from $$C_a$$ to $$C_b$$.

Think on it with an axample: say that $$P_{eq}({C_a})\approx 1$$ and $$P_{eq}({C_b})\approx 0$$. With this setting, your metropolis algorithm will sample much more times the configuration $${C_a}$$ than the configuration $$C_b$$. Since $$C_b$$ is very unlikely, the probability of going from $$C_a$$ to $$C_b$$ must be low. Contrary, the probability of going from $$C_b$$ to $$C_a$$ must be very high. These quantities are related through detailed balance, if detailed balance is not fulfilled, then you are not sampling according to an equilibrium distribution. In particular:

$$\frac{P(C_a)}{P(C_b)}=\frac{P(C_b\rightarrow C_a)}{P(C_a\rightarrow C_b)}$$