12.17. Find all solutions to the equation $x^{y}=y^{x}$:

a) in natural numbers;

b) in rational numbers.

## 12.3. Finding some solutions
12.17. There is always an obvious solution $x=y$, so it is sufficient to consider the case when $x>y$ (the case $x<y$ is analogous). Let $x = ky$ where $k>1$ is a rational number. Then $(ky)^y = (y^k)^y$, so $ky = y^k$, which means $y = k^{\frac{1}{k-1}}$. Let $\frac{1}{k-1} = \frac{p}{q}$ be an irreducible fraction. Then $y = \left(\frac{p+q}{p}\right)^{\frac{p}{q}}$ and $x = \left(\frac{p+q}{p}\right)^{\frac{p+q}{q}}$. The numbers $p$ and $p+q$ are coprime, so $y$ can be rational only if $p = a^q$ and $p+q = b^q$ for some natural numbers $a$ and $b$. Suppose $q \geq 2$. Then $a^q < p+q \leq a^q + qa^{q-1} < (a+1)^q$. This leads to a contradiction, as there cannot be a number $b^q = p+q$ between $a^q$ and $(a+1)^q$. Therefore, $q=1$. For any natural number $p$, the numbers $x = (1 + 1/p)^{p+1}$ and $y = (1 + 1/p)^p$ are rational and are solutions to the equation $x^y = y^x$. These numbers will be integers only when $p=1$. In this case, $x=4$ and $y=2$.