Example 27 ([38.5]) Find all positive integer pairs $\{a, b\}$, satisfying the equation
$$a^{b^{2}}=b^{a}.$$
(i) Discuss the simplest case. If $a=b$, then $a=1$; if $a=1$, then $b=1$; if $b=1$, then $a=1$. Therefore, we only need to consider
$$a \neq b, \quad a \geqslant 2, \quad b \geqslant 2$$
(ii) Discuss the relationship between $a$ and $b$. First, prove that it is impossible to have $b > a \geqslant 2$. It is easy to prove that $2^{b} > b$ (using the principle of the smallest natural number, left to the reader). Therefore, when $a \geqslant 2$, we must have
$$a^{b^{2}} \geqslant 2^{b^{2}} > b^{b}$$

Thus, for equation (1) to hold, we must have $a > b$, and therefore
$$a > b \geqslant 2$$

From the above and equation (1), we have
$$b^{a} = a^{b^{2}} > b^{b^{2}}$$

So, $a > b^{2}$. Using equation (1) again, we get
$$b^{a} = a^{b^{2}} > b^{2b^{2}}$$

Therefore, $a$ and $b$ must satisfy the condition
$$a > 2b^{2}, \quad b \geqslant 2$$
(iii) It is evident that $a$ and $b$ must have the same prime factors (why). Let $p$ be a prime. If $p^{s} \| a$ and $p^{t} \| b$, then from equation (1) we have
$$s b^{2} = t a$$

From this and equation (2), we get $s > 2t$, so $b^{2}$ must divide $a$. Therefore, we have (why)
$$a = k b^{2}, \quad k > 2, \quad b \geqslant 2,$$

and thus $s = k t$. Therefore, we have (why)
$$a = b^{k}, \quad k > 2, \quad b \geqslant 2$$
(iv) From equations (4) and (5), we get
$$k = b^{k-2}, \quad k > 2, \quad b \geqslant 2$$

If $b=2$, then $k=4$, $a=16$; if $b=3$, then $k=3$, $a=27$.
Finally, we prove that when $b \geqslant 4$, equation (6) has no solution: when $k > 2$, we have
$$b^{k-2} \geqslant (1+3)^{k-2} \geqslant 1 + 3(k-2) > k$$

The middle inequality can be proven using the principle of the smallest natural number.
(v) In summary, the complete solutions are $\{a, b\} = \{1,1\}, \{16,2\}, \{27,3\}$.