We know that $2^4 = 4^2$ and $(-2)^{-4} = (-4)^{-2}$. Is there another pair of integers $x, y$ ($x\neq y$) which satisfies the equality $x^y = y^x$?


Solution 1:

This is a classic (and well known problem).

The general solution of $x^y = y^x$ is given by

$$\begin{align*}x &= (1+1/u)^u \\ y &= (1+1/u)^{u+1}\end{align*}$$

It can be shown that if $x$ and $y$ are rational, then $u$ must be an integer.

For more details, see this and this.

Solution 2:

For every integer $n$, $x = y = n$ is a solution. So assume $x \neq y$.

Suppose $n^m = m^n$. Then $n^{1/n} = m^{1/m}$. Now the function $x \mapsto x^{1/x}$ reaches its maximum at $e$, and is otherwise monotone. Thus (assuming $n < m$) we must have $n < e$, i.e. $n = 1$ or $n = 2$.

If $n = 1$ then $n^m = 1$ and so $m = 1$, so it's a trivial solution.

If $n = 2$ then $n^m$ is a power of $2$, and so (since $m > 0$) $m$ must also be a power of $2$, say $m = 2^k$. Then $n^m = 2^{2^k}$ and $m^n = 2^{2k}$, so that $2^k = 2k$ or $2^{k-1} = k$. Now $2^{3-1} > 3$, and so an easy induction shows that $k \leq 2$. If $k = 1$ then $n = m$, and $k = 2$ corresponds to $2^4 = 4^2$.

EDIT: Up till now we considered $n,m>0$. We now go over all other cases. The solution $n = m = 0$ is trivial (whatever value we give to $0^0$).

If $n=0$ and $m \neq 0$ then $n^m = 0$ whereas $m^n = 1$, so this is not a solution.

If $n > 0$ and $m < 0$ then $0 < n^m \leq 1$ whereas $|m^n| \geq 1$. Hence necessarily $n^m = 1$ so that $n = 1$. It follows that $m^1 = 1^m = 1$. In particular, there's no solution with opposite signs.

If $n,m < 0$ then $(-1)^m (-n)^m = n^m = m^n = (-1)^n (-m)^n$, so that $n,m$ must have the same parity. Taking inverses, we get $(-n)^{-m} = (-m)^{-n}$, so that $-n,-m$ is a solution for positive integers. The only non-trivial positive solution $2,4$ yields the only non-trivial negative solution $-2,-4$.