$x^y = y^x$ for integers $x$ and $y$ 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$?
 A: 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.
A: 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$.
A: Say $x^y = y^x$, and $x > y > 0$. Taking logs, $y \log x = x \log y$; rearranging, $(\log x)/x = (\log y)/y$. Let $f(x) = (\log x)/x$; then this is $f(x) = f(y)$.
Now, $f^\prime(x) = (1-\log x)/x^2$, so $f$ is increasing for $x<e$ and decreasing for $x>e$. So if $x^y = y^x$ has a solution, then $x > e > y$.  So $y$ must be $1$ or $2$. But $y = 1$ doesn't work. $y=2$ gives $x=4$.
(I've always thought of this as the ``standard'' solution to this problem and I'm a bit surprised nobody has posted it yet.)
If $x > 0 > y$, then $0 < x^y < 1$ and $y^x$ is an integer, so there are no such solutions.
If $0 > x > y$, then $x^y = y^x$ implies $x$ and $y$ must have the same parity. Also, taking reciprocals, $x^{-y} = y^{-x}$. Then $(-x)^{-y} = (-y)^{-x}$ since $x$ and $y$ have the same parity. (The number of factors of $-1$ we introduced to each side differs by $x-y$, which is even.) So solving the problem where $x$ and $y$ are negative reduces to solving it when $x$ and $y$ are positive.
A: Although this thing has already been answered, here a shorter proof
Because $x^y = y^x $ is symmetric we first demand that $x>y$
Then we proceed simply this way:

$ x^y = y^x $       
$ x = y^{\frac x y } $         
$ \frac x y = y^{\frac x y -1} $       
$ \frac x y -1 = y^{\frac x y -1} - 1 $       

Now we expand the rhs into its well-known exponential-series      

$ \frac x y -1 =  \ln(y)*(\frac x y -1) + \frac {((\ln(y)*(\frac x y -1))^2}{2!} + ... $       

Here by the definition x>y the lhs is positive, so if $ \ln(y) $ >=1 we had lhs $\lt$ rhs
Thus $ \ln(y) $ must be smaller than 1, and the only integer y>1 whose log is smaller than 1 is y=2, so there is the only possibility $y = 2$ and we are done.

[update] Well, after having determined $y=2$ the same procedure can be used to show, that after manyally checking $x=3$ (impossible) $x=4$ (possible) no $x>4$ can be chosen.    
We ask for $x=4^{1+\delta}   ,\delta > 0 $ inserting the value 2 for y:    

$ 4^{(1+\delta)*2}=2^{4^{(1+\delta)}} $      

Take log to base 2:    

$ (1+\delta)*4=4^{(1+\delta)} $      
$ \delta =4^{\delta} - 1 $      
$ \delta = \ln(4)*\delta  + \frac { (\ln(4)*\delta)^2 }{2!} + \ldots $      
$ 0 = (\ln(4)-1)*\delta  + \frac { (\ln(4)*\delta)^2 }{2!} + \ldots $      

Because $ \ln(4)-1 >0 $ this can only be satisfied if $ \delta =0 $    
So indeed the only solutions, assuming x>y, is $ (x,y) = (4,2)$ .
[end update]
A: I've collected some references, feel free to add more of them. (Some of them are taken from other answers. And, of course, some of them can contain further interesting references.)
Online:

*

*Nick's Mathematical Puzzles - Solution to puzzle 48: Exponential equation (Wayback Machine)


*On Torsten Sillke's page: http://www.mathematik.uni-bielefeld.de/~sillke/PUZZLES/x%5Ey-x%5Ey (Wayback Machine)


*Wikipedia: Equation $x^y=y^x$
Papers:

*

*Michael A. Bennett and Bruce Reznick: Positive Rational Solutions to $x^y = y^{mx}$ : A Number-Theoretic Excursion, The American Mathematical Monthly , Vol. 111, No. 1 (Jan., 2004), pp. 13-21; available at jstor, arxiv or at author's homepage.


*Marta Sved: On the Rational Solutions of $x^y = y^x$, Mathematics Magazine, Vol. 63, No. 1 (Feb., 1990), pp. 30-33, available at jstor. It is mentioned here, that this problem appeared in 1960 Putnam Competition (for integers)


*F. Gerrish: 76.25 $a^{b}=b^{a}$: The Positive Integer Solution, The Mathematical Gazette, Vol. 76, No. 477 (Nov., 1992), p. 403. Jstor link


*Solomon Hurwitz: On the Rational Solutions of $m^n=n^m$ with $m\ne n$, The American Mathematical Monthly, Vol. 74, No. 3 (Mar., 1967), pp. 298-300. jstor


*Joel Anderson: Iterated Exponentials, The American Mathematical Monthly , Vol. 111, No. 8 (Oct., 2004), pp. 668-679. jstor


*R. Arthur Knoebel, Exponentials Reiterated. The American Mathematical Monthly , Vol. 88, No. 4 (Apr., 1981), pp. 235-252 jstor, link
Books:

*

*Andrew M. Gleason, R. E. Greenwood, Leroy Milton Kelly: William Lowell Putnam mathematical competition problems and solutions 1938-1964, ISBN 0883854287, p.59 and p.538


*Titu Andreescu, Dorin Andrica, Ion Cucurezeanu: An Introduction to Diophantine Equations: A Problem-Based Approach, Springer, New York, 2010. Page 209
Searches:
The reason I've added this is that it can be somewhat tricky to search for a formula or an equation. So any interesting idea which could help finding interesting references may be of interest.

*

*diophantine "x^y=y^x"

*Approach0

*SearchOnMath
A: Well I finally found an answer relating to some number theory I suppose !
Assume that : $x={p_1}^{\alpha _ 1}.{p_2}^{\alpha _ 2}...{p_k}^{\alpha _ k}$ it is clear that number y prime factors are the same as number x but with different powers i.e: $y={p_1}^{\beta _ 1}.{p_2}^{\beta _ 2}...{p_k}^{\beta _ k}$ replacing the first equation we get:
${({p_1}^{\alpha _ 1}.{p_2}^{\alpha _ 2}...{p_k}^{\alpha _ k})}^y={({p_1}^{\beta _ 1}.{p_2}^{\beta _ 2}...{p_k}^{\beta _ k})}^x$ i.e: ${p_1}^{{\alpha _ 1}y}.{p_2}^{{\alpha _ 2}y}...{p_k}^{{\alpha _ k}y}={p_1}^{{\beta _ 1}x}.{p_2}^{{\beta _ 2}x}...{p_k}^{{\beta _ k}x}$
Since the the powers ought to be equal we know for each $1\le i \le k$ we have:${\alpha_i}y={\beta_i}x$ i.e: ${\alpha_i}/{\beta_i}=x/y$
Considering that the equation is symmetric we can assume that $x \le y$ but we have ${\alpha_i}/{\beta_i} = x/y \ge 1$ hence ${\alpha_i} \ge {\beta_i}$
Assume this obvious,easy-to-prove theorem:
Theorem #1
Consider $x,y \in \mathbb{N}$ such that $x={p_1}^{\alpha _ 1}.{p_2}^{\alpha _ 2}...{p_k}^{\alpha _ k}$  $y={p_1}^{\beta _ 1}.{p_2}^{\beta _ 2}...{p_k}^{\beta _ k}$ for each $1\le i \le k$ we have:
$y|x \to {\alpha_i}\ge{\beta_i}$ or vice versa

Using the Theorem #1 we can get that  $y|x$ i.e $x=yt$ replacing in the main equation we get:
$x^y=y^x \to ({yt})^y=y^{({yt})} \to yt=y^t$
Now we must find the answers to the equation $yt=y^t$ for $t=1$ it is obvious that for every  $y \in \mathbb{N}$ the equation is valid.so one answer is $x=y$
Yet again for $t=2$ we must have $2y=y^2$ i.e $y=2$ and we can conclude that $x=4$ (using the equation $x=yt$)so another answer is $x=4$ $\land$ y=2$ (or vice versa)
We show that for $t\ge3$ the equation is not valid anymore.
If $t\ge3$ then $y\gt2$ we prove that with these terms the inequality $y^t \gt yt$ stands.
$y^t={(y-1+1)}^t={(y-1)}^t+...+\binom{t}{2} {(y-1)}^2 + \binom{t}{1}(y-1) +1 \gt \binom{t}{2} {(y-1)}^2 + t(y-1) +1$
But we have $y-1\gt1$ so:
$y^t \gt \binom{t}{2} {(y-1)}^2 + t(y-1) +1= \frac {t(t-1)}{2} -t +1 +yt= \frac {(t-2)(t-1)}{2} + yt \gt yt$
So it is proved that for $t\ge3$ is not valid anymore.$\bullet$

P.S: The equation is solved for positive integers yet the solution for all the integers is quite the same!(took me an hour to write this all,hope you like my solution)
