Skip to main content.

Solution to puzzle 48: Exponential equation

Suppose xy = yx, where x and y are positive real numbers, with x < y.  Show that x = 2, y = 4 is the only integer solution.  Are there further rational solutions?  (That is, with x and y rational.)  For what values of x do real solutions exist?

We have xy = yx, with 0 < x < y.

Let y = rx, where r > 1.
Then xrx = (rx)x.
Taking the natural logarithm of both sides, rx ln x = x (ln r + ln x).
Dividing by x, and rearranging, (r−1) ln x = ln r.
(Notice that r = 1 would be a solution, from which y = x.)
With r > 1, ln x = (ln r) / (r−1).
Taking exponentials, x = e(ln r) / (r−1) = (eln r)1/(r−1).
Therefore we have the parametric solution, x = r1/(r−1), y = rx = rr/(r−1).

If we set r = 1 + 1/k, where k > 0, we have x = (1 + 1/k)k, y = (1 + 1/k)k+1.
It is a well known result that, as k tends to infinity (equivalently, r tends to 1), the expression for x tends to e from below, and that for y tends to e from above.

Since r > 1, 1/(r−1) is positive, and so x > 1, and therefore y > 1.
(Notice that, if we allow 0 < r < 1, 1/(r−1) and r/(r−1) are negative, and so again x and y are greater than 1.  Of course, this must be the case, because r = a and r = 1/a yield essentially the same solution, with x and y swapped.)

The table below shows some typical solutions.  If r is slightly greater than 1, we get solutions with x just less than e, and y just greater than e.  On the other hand, if r is large, we get x slightly greater than 1, and y slightly greater than r.

Solutions to xy = yx

Rational solutions

Seeking solutions in rational x, y, note that r = y/x must also be rational.  If we set r = 1 + 1/k, then k must be rational.
If k is rational, then x = (1 + 1/k)k is rational if, and only if, k is an integer.  A proof follows.

Let k = a/b, a fraction in its lowest terms; that is, a and b are relatively prime.
Then (1 + 1/k)k = [(a + b)/a]a/b, which is clearly rational if b = 1.

If b > 1, then, since a and b are relatively prime, a + b and a are also relatively prime.
Therefore, for [(a + b)/a]a/b to be rational, both a + b and a must be perfect bth powers of integers.
However, this is impossible.
For example, if b = 2, a + 2 and a cannot both be perfect squares, for the difference between two positive perfect squares is at least 3.

More generally, if u, v, and c are positive integers, with c > 1, using the binomial theorem, (u + v)c − uc = cuc−1v + ... + vc > c.
Hence two distinct perfect bth powers cannot differ by b.
Therefore (1 + 1/k)k = [(a + b)/a]a/b cannot be rational if b > 1.

So (1 + 1/k)k is rational if, and only if, k is a positive integer.
Therefore all rational solutions are of the form x = (1 + 1/n)n, y = (1 + 1/n)n+1, where n = 1, 2, ... .

Notice that, for any rational solution, 2 less than or equal to x < e < y less than or equal to 4.  There is a countable infinity of rational solutions, and an uncountable infinity of real solutions.

Integer solutions

We have shown that, for a rational solution, k is an integer; that is x = [(a + 1)/a]a.
If a > 1, a and a + 1 are relatively prime, and so [(a + 1)/a]a is a fraction in its lowest terms, with denominator > 1, and therefore not an integer.
So the only integer solution is x = 2, y = 4.

Complex solutions

Notice that nowhere in the derivation of the parametric solution, above, did we assume that x, y, and r are real.
Setting r = −1, we get perhaps the simplest complex solution: x = −i, y = i.
Euler's formula states that eit = cos t + i sin t, where t is any real number.
Setting t = pi/2, we have ei*pi/2 = i.
Hence the principal value of i−i = (ei*pi/2)−i = e−i*i*pi/2 = epi/2 is approximately equal to 4.8104773809653516554730356667.

Sketching the graph

The graph below is a representation of xy = yx, for positive x and y.  The blue part of the graph corresponds to the portion for which x = y; the red parts are those for which x not equal to y.  The two red halves of the graph approach the point (e, e), and approach the asymptotic lines x = 1 and y = 1.  The graph is symmetrical about the line x = y.

Graph of x^y = y^x, for positive x and y

What is the slope of the graph, at the point (a, b) ?

Taking the natural logarithm of both sides of the equation, we get y ln x = x ln y.  Using implicit differentiation:

y/x + y' ln x = ln y + xy'/y.
Grouping terms containing y', we have y' (x/y − ln x) = y/x − ln y, from which we get the pleasantly symmetrical formula:
y' = (y/x − ln y) / (x/y − ln x).

Multiplying numerator and denominator by xy, we have y' = (y2 − y ln yx) / (x2 − x ln xy).
Since xy = yx, we get an alternative formula y' = y2(1 − ln x) / x2(1 − ln y).

When x = y = a, we get y' = 1, except when a = e, in which case the derivative is undefined.  This reflects the fact there is no unique tangent line at the point (e, e).  In fact, the derivative exists at every point on the graph except for (e, e).
The slope of the tangent at the point (2, 4), for example, is 4 (1 − ln 2) / (1 − 2 ln 2) is approximately equal to −3.1774.
When x not equal to y, we have x < e and y > e, or x > e and y < e.
Therefore, 1 − ln x and 1 − ln y have opposite signs, and so the slope is always negative.


Robin Hankin wrote to point out that this problem is solved formally by Lambert's W function, which will yield complex solutions.  See the references below for further details.

All rational solutions to the equation are given by x = A000169(n+1)/A000312(n), y = A000312(n+1)/A007778(n), where n = 1, 2, 3, ... .  For instance, n = 2 yields the solution (9/4)27/8 = (27/8)9/4.

Further reading

  1. xy = yx
  2. Lambert W-Function
  3. Why W?
  4. The Lambert W function (poster)

Source: Inspired by An Exponential Equality, in Mathematical Bafflers, edited by Angela Dunn

Back to top