The Metropolis algorithm

The dynamical equation for \( {\cal P}_i^{(n)} \) can be written directly from the description above. The probability of being in the state \( i \) at step \( n \) is given by the probability of being in any state \( j \) at the previous step, and making an accepted transition to \( i \) added to the probability of being in the state \( i \), making a transition to any state \( j \) and rejecting the move: $$ {\cal P}^{(n)}_i = \sum_j \left [ {\cal P}^{(n-1)}_jT_{j\rightarrow i} A_{j\rightarrow i} +{\cal P}^{(n-1)}_iT_{i\rightarrow j}\left ( 1- A_{i\rightarrow j} \right) \right ] \,. $$ Since the probability of making some transition must be 1, \( \sum_j T_{i\rightarrow j} = 1 \), and the above equation becomes $$ {\cal P}^{(n)}_i = {\cal P}^{(n-1)}_i + \sum_j \left [ {\cal P}^{(n-1)}_jT_{j\rightarrow i} A_{j\rightarrow i} -{\cal P}^{(n-1)}_iT_{i\rightarrow j}A_{i\rightarrow j} \right ] \,. $$