20. One-dimensional Ising model. Let there be $n$ particles located at points $1, \ldots, n$.

Suppose each particle belongs to one of two types, with $n_{1}$ particles of the first type and $-n_{2}\left(n_{1}+n_{2}=n\right)$ of the second type. We will assume that all $n!$ arrangements of the particles are equally likely.

Construct the corresponding probabilistic model and find the probability of the event $A_{n}\left(m_{11}, m_{12}, m_{21}, m_{22}\right)=\left\{\nu_{11}=m_{11}, \ldots, \nu_{22}=m_{22}\right\}$, where $\nu_{i j}$ is the number of particles of type $i$ following particles of type $j(i, j=1,2)$.
Solution. Each sequence of particle types of length $n$ can be uniquely associated with a sequence of letters $A, B, a, b$ of length $n-1$. The letter $A$ at the $i$-th position means that the particle at the $i$-th position is of the first type, and the particle at the $(i+1)$-th position is of the second type, and vice versa if the letter $B$ is at the $i$-th position. The letter $a$ at the $i$-th position means that the particles at the $i$-th and $(i+1)$-th positions are of the first type; the letter $b$ at the $i$-th position means that the particles at the $i$-th and $(i+1)$-th positions are of the second type.

Notice that we are only interested in "correct" sequences of letters, i.e., after $A$ can only come $B$ or $b$, after $B$ can only come $A$ or $a$, after $a$ can only come $A$ or $a$, and after $b$ can only come $B$ or $b$.

If we remove all capital letters from a "correct" sequence of letters, we get a "correct" sequence (let's call it the skeleton of the original). In the skeleton, the letters must always alternate, meaning that $\left|m_{12}-m_{21}\right| \leqslant 1$.

Let's count the number of such "correct" sequences of letters, where there are $A-m_{12}$, $B-m_{21}$, $a-m_{11}$, and $b-m_{22}$ letters.

Suppose $m_{12}>m_{21}$. The skeleton is uniquely determined; $m_{22}$ letters $b$ can be placed in any number after the letters $A$, which corresponds to the problem of placing $m_{22}$ indistinguishable pebbles into $m_{12}$ distinguishable cells. By problem I.1.6(c), this can be done in $C_{m_{22}+m_{12}-1}^{m_{22}}$ ways.

Similarly, $m_{11}$ letters $a$ can be placed in $C_{m_{11}+m_{12}-1}^{m_{11}}$ ways in any number before the letters $A$.

Notice that in the case where $m_{12}>m_{21}$, the equalities $n_{1}=m_{12}+m_{11}$ and $n_{2}=m_{12}+m_{22}$ hold, so the number of "correct" sequences is $C_{m_{22}+m_{12}-1}^{m_{22}} C_{m_{11}+m_{12}-1}^{m_{11}}=C_{n_{1}-1}^{m_{22}} C_{n_{2}-1}^{m_{11}}$.

When $m_{21}>m_{12}$, the reasoning is identical with the replacement of $A$ by $B$. The answer is the same.

When $m_{21}=m_{12}$, there are two options for the skeleton: the first letter is $A$ or $B$. If the skeleton starts with $A$, then

$$
n_{1}=m_{11}+m_{12}+1, \quad n_{2}=m_{22}+m_{12}.
$$

If the skeleton starts with $B$, then

$$
n_{1}=m_{11}+m_{12}, \quad n_{2}=m_{22}+m_{12}+1.
$$

Conducting reasoning similar to the previous cases, in each case we get that the number of "correct" sequences is $C_{n_{1}-1}^{m_{22}} C_{n_{2}-1}^{m_{11}}$.

Since particles of the same type are distinguishable, the number of sequences of $n$ different particles is $C_{n_{1}-1}^{m_{22}} C_{n_{2}-1}^{m_{11}} n_{1}!n_{2}!$, and the desired probability is

$$
\mathrm{P}\left(A_{n}\left(m_{11}, m_{12}, m_{21}, m_{22}\right)\right)=\frac{C_{n_{1}-1}^{m_{22}} C_{n_{2}-1}^{m_{11}} n_{1}!n_{2}!}{n!}=\frac{C_{n_{1}-1}^{m_{22}} C_{n_{2}-1}^{m_{11}}}{C_{n}^{n_{1}}}
$$