Symmetry is a beautiful thing. Doesn’t matter if it is art, nature on just numbers. Symmetry brings a certain degree of order, to otherwise chaotic and random world. The most symmetrical equation I ever observed was the simple equality  2^4=4^2 .

Such beautiful equation cannot be random, there must be a reason behind such order. This post is about figuring out why  2^4=4^2 and finding other numbers that might satisfy the same equation, or proving that 2 and 4 are the only unique solutions.

More precisely, we want to show that the pair {2, 4} are the only distinct natural solutions to the equation  x^y = y^x .

Consider the following function:

 f(x) = \exp(\frac{\log(x)}{x}) = x^{\frac{1}{x}} .

This function is of special interest to us, because the solutions to the equation  x^{\frac{1}{x}} == y^{\frac{1}{y}} are the same as function  f . If we plot the  f over domain of [1, \infty), we observe that

  •  f is increasing from  x=1 to  e=2.718
  •  f peaks at  e
  •  f is decreasing from  e to  \infty

f-plot

The global maximum of this function is at e=2.718, In order to show that is the only maximum, we need to compute the derivates of f, which is  \frac{d}{dx} f(x) = -x^(1/x - 2)*(log(x) - 1)=0 . This function has only one solution (x=e, causing the log(x)-1 to be zero). Therefore f has only one global maxima. Figure below shows the derivative plot of f.

diff-f-plot

The beauty of the function f is that it kind of compresses the whole domain (e, \infty) to (1, e). Now we know for every real number from (e, \infty), we have precisely one real number on (1, e) such that x^y=y^x. For example, we have infinite number of real pairs such as {8, 1.45}, {3, 2.5}, … . However, the only natural number in range (1, e) is 2. Hence the pair {2, 4} is the only natural solution to equation x^y=y^x.

f-plot

P.S. All of the above computations are performed using MATLAB symbolic library. Here is the code I used:

symb x;
f = x^(1/x);
g=simplify(diff(f))
ezplot(f, [1, 10]);
ezplot(g, [1, 10]);