Analysis

Two to the four is four to the two

Exponentiation does not commute — 2³ is 8 and 3² is 9 — but 2⁴ and 4² are both 16. Every unequal pair with x^y = y^x lies on one curve, which crosses the diagonal at (e, e) and is traced by the two compound-interest approximations to e, one from below and one from above. Its rational points are exactly the whole values of the parameter, so 2 and 4 are the only whole numbers that commute, and the hump of ln t / t settles e^π against π^e in one line.
27 min read 6 figures The same thing twiceSmall cases lie

Worth reading first: The curve that is its own slope · Root two, raised to itself for ever.

Addition and multiplication do not care about order: 2+4=4+22 + 4 = 4 + 2 and 2×4=4×22 \times 4 = 4 \times 2. Exponentiation does. Two cubed is 8 and three squared is 9; two to the fifth is 32 and five squared is 25; ten cubed is a thousand and three to the tenth is 59,049. Swapping base and exponent almost always changes the answer, and usually by a great deal. And then there is 24=16=422^4 = 16 = 4^2.

Daniel Bernoulli remarked in a letter to Christian Goldbach in 1728 that 2 and 4 are the only unequal whole numbers with this property, and Leonhard Euler later found every solution of xy=yxx^y = y^x in positive real numbers. The answer is one curve, and it is a remarkable one. It crosses the diagonal x=yx = y exactly at (e,e)(e, e). Its two coordinates, written in terms of a single parameter, are the two most familiar approximations to ee — the amount a unit grows to under compound interest, one from below and one from above. And its rational points are exactly the points where that parameter is a whole number, which proves Bernoulli’s remark and says what the curve’s other fractions are.

Everything here is computed: the curve, the comparison of aba^b with bab^a for whole numbers in exact integer arithmetic, and a search for rational solutions in which every candidate is confirmed or refused by comparing two whole numbers.

One curve beside the diagonal

Every pair with x to the y equal to y to the x. curve through (e,e) slope -1.000; rational t=1,2,3: 2.0000/4.0000 2.2500/3.3750 2.3704/3.1605
Fig. 1 Every pair of positive numbers with xy=yxx^y = y^x: the diagonal, and one other curve symmetric about it, crossing it at (e, e) with slope −1. Its rational points, in red, include (2, 4), (9/4, 27/8) and (64/27, 256/81).

Every pair x=yx = y satisfies the equation trivially, and the diagonal is drawn faint for that reason. The interesting solutions are the others, and the figure shows that they form a single curve, symmetric about the diagonal — since swapping xx and yy swaps the two sides of the equation — and crossing it at one point, (e,e)(e, e), where its slope is −1-1. Far out along the curve, one coordinate grows without bound while the other sinks towards 1, because 1y=1=y11^y = 1 = y^1 only in the limit: the curve is asymptotic to the lines x=1x = 1 and y=1y = 1 without reaching them.

The whole-number point (2,4)(2, 4) is on it, of course, together with its mirror image (4,2)(4, 2). So are some less familiar fractions. Take x=94x = \tfrac94 and y=278y = \tfrac{27}{8}: then xy=(32)2⋅27/8=(32)27/4x^y = (\tfrac32)^{2 \cdot 27/8} = (\tfrac32)^{27/4} and yx=(32)3⋅9/4=(32)27/4y^x = (\tfrac32)^{3 \cdot 9/4} = (\tfrac32)^{27/4}. Both are 32\tfrac32 to the same power, and the two sides agree exactly. The pair 6427\tfrac{64}{27} and 25681\tfrac{256}{81} works the same way, with base 43\tfrac43. The red dots mark these three pairs and their reflections, and the rest of the essay is about why these, and only these kinds of fractions, appear.

The point (e,e)(e, e) is where the two halves of the curve meet the diagonal, and the slope there is computed in the figure from two nearby points of the curve as −1.000-1.000. That is as it must be: a curve symmetric about the diagonal that crosses it transversally can only cross it at a right angle.

The hump that pairs the numbers

The hump of ln t over t. peak 1/e=0.3679; ln2/2=0.3466; e^pi 23.1407 pi^e 22.4592
Fig. 2 The function ln⁡t/t\ln t / t, which takes equal values at xx and yy exactly when xy=yxx^y = y^x. It rises to a single peak 1/e1/e at t=et = e and falls after it, so the level ln⁡2/2\ln 2 / 2 is met at 2 and at 4.

Take logarithms. For positive xx and yy, xy=yxx^y = y^x says yln⁡x=xln⁡yy \ln x = x \ln y, which is

ln⁡xx=ln⁡yy.\frac{\ln x}{x} = \frac{\ln y}{y}.

So the question is when the function ln⁡t/t\ln t / t takes the same value at two different places, and the figure draws it. Its derivative is (1−ln⁡t)/t2(1 - \ln t)/t^2, positive below ee and negative above it, so the function climbs from −∞-\infty near 0, crosses zero at t=1t = 1, reaches its only peak, 1/e1/e, at t=et = e, and then falls back towards zero for ever without reaching it.

Everything about the curve of solutions can be read from this hump. A horizontal line at a level between 0 and 1/e1/e meets the graph exactly twice, once at some xx between 1 and ee and once at some yy beyond ee; that pair is a solution, and every solution arises this way. The level ln⁡2/2=0.3466\ln 2/2 = 0.3466 is met at 2 and at 4, because ln⁡4/4=2ln⁡2/4\ln 4 / 4 = 2\ln 2/4. Levels at or below zero are met only once, so no number at most 1 has a partner, and the level 1/e1/e is met only at ee itself, where the two halves of the curve join. The same function is what the infinite tower of a base turns on: its peak at ee is why 31/33^{1/3} is the largest of the numbers n1/nn^{1/n}.

The hump also settles a well-known comparison in a line. Since ee is the peak, ln⁡e/e>ln⁡π/π\ln e / e > \ln \pi / \pi, that is πln⁡e>eln⁡π\pi \ln e > e \ln \pi, and exponentiating gives eπ>πee^\pi > \pi^e. The figure marks π\pi just past the peak, at 0.3644 against 0.3679: the two values are close, and so are the two powers, eπ=23.1407e^\pi = 23.1407 against πe=22.4592\pi^e = 22.4592.

Which power wins among whole numbers

Which of a to the b and b to the a is larger. N=10: a^b>b^a 44, <44, = 2
Fig. 3 Every pair of whole numbers from 1 to 10, coloured by which of aba^b and bab^a is larger, computed exactly, with the curve xy=yxx^y = y^x drawn over the grid. Only the 2 cells (2, 4) and (4, 2) tie, and from 3 onwards the smaller base always wins.

For whole numbers the hump gives a complete rule, and the figure checks it against exact integer powers for every pair from 1 to 10. When both numbers are at least 3, both lie on the falling side of the hump, so the smaller one has the larger value of ln⁡t/t\ln t/t and the smaller base wins: 310=59,0493^{10} = 59{,}049 beats 103=1,00010^3 = 1{,}000, and 565^6 beats 656^5. The colours in the upper right of the grid are therefore a clean staircase, divided along the diagonal.

The number 2 sits on the rising side of the hump, below ee, and is the only whole number that can be paired with one on the other side. Its value, ln⁡2/2=0.3466\ln 2 / 2 = 0.3466, lies above the value at 5 and every later number, below the value at 3, and exactly equal to the value at 4. So 23<322^3 < 3^2, 24=422^4 = 4^2, and 2b>b22^b > b^2 for every bb from 5 on — the familiar fact that 2b2^b eventually outruns b2b^2, here seen to happen at the first possible moment. The number 1 loses to everything, since 1b=11^b = 1.

The curve drawn over the grid is the border between the colours, as it must be, and it passes through the centre of a square at exactly two places. That is the figure’s version of Bernoulli’s remark, and it can be proved without the curve at all. If ab=baa^b = b^a with a<ba < b, the two numbers have the same prime factors, and unique factorisation says that each prime’s exponent in bb is b/ab/a times its exponent in aa, so aa divides bb. Writing b=kab = ka turns the equation into ak=kaa^k = ka, that is ak−1=ka^{k-1} = k, and since a≥2a \ge 2 forces 2k−1≤k2^{k-1} \le k, the only possibility is k=2k = 2 and a=2a = 2.

Compound interest from both sides

The curve's two coordinates as compound interest. t=20: 2.65330 2.78596
Fig. 4 The two coordinates of a point on the curve as functions of the parameter t: the smaller, (1+1/t)t(1 + 1/t)^t, climbs to ee from below, and the larger, (1+1/t)t+1(1 + 1/t)^{t+1}, falls to ee from above. At t=20t = 20 they are 2.6533 and 2.7860.

Euler’s parametrisation comes from fixing the ratio. Write y=sxy = sx with s>1s > 1. Then xsx=(sx)xx^{sx} = (sx)^x, and taking xx-th roots, xs=sxx^s = sx, so xs−1=sx^{s-1} = s and

x=s1/(s−1),y=ss/(s−1).x = s^{1/(s-1)}, \qquad y = s^{s/(s-1)}.

Now put s=1+1/ts = 1 + 1/t, so that 1/(s−1)=t1/(s-1) = t. The pair becomes x=(1+1/t)tx = (1 + 1/t)^t and y=(1+1/t)t+1y = (1 + 1/t)^{t+1}, and these are two very familiar expressions. The first is what one unit of money grows to in a year at 100 per cent interest compounded tt times, the sequence that defines ee as the curve that is its own slope when tt grows without bound. The second is the same thing with one more factor, and it decreases to ee from above.

So the curve of commuting pairs is traced by the two compound-interest sequences side by side. The figure draws both against tt: at t=1t = 1 the pair is (2,4)(2, 4), interest compounded once; at t=2t = 2 it is (94,278)(\tfrac94, \tfrac{27}{8}); as tt grows both close in on e=2.71828e = 2.71828, which is why the curve reaches the diagonal at (e,e)(e, e). At t=20t = 20 they are 2.6533 and 2.7860, either side of ee by about e/2te/2t. The classical squeeze (1+1/t)t<e<(1+1/t)t+1(1 + 1/t)^t < e < (1 + 1/t)^{t+1}, used to pin down the number that names the area, is the statement that every point of the curve has one coordinate on each side of ee.

Small values of tt fill the other end of the curve. As tt falls towards 0, x=(1+1/t)tx = (1 + 1/t)^t falls to 1 and yy grows without limit, which is the curve’s approach to its asymptote; and every positive real tt gives exactly one pair, so the parametrisation covers the whole curve on one side of the diagonal.

The rational points

The rational points of x to the y equals y to the x. tried 840; found 2/1~4/1 9/4~27/8 64/27~256/81
Fig. 5 Every fraction p/q between 1 and e with denominator up to 40 — 840 of them — with its partner on the curve tested for being a fraction, each candidate confirmed or refused exactly. Only three pairs are rational: 2 with 4, 9/4 with 27/8, and 64/27 with 256/81.

When tt is a whole number nn, both coordinates are fractions: x=(n+1n)nx = \big(\tfrac{n+1}{n}\big)^n and y=(n+1n)n+1y = \big(\tfrac{n+1}{n}\big)^{n+1}. The converse is the real content: these are the only rational points on the curve. The argument runs through the ratio again. If xx and yy are rational, so is s=y/xs = y/x; write s−1=m/ns - 1 = m/n in lowest terms, so s=(n+m)/ns = (n + m)/n and x=sn/mx = s^{n/m}. For xx to be rational, ss must be an mm-th power of a rational number, and since n+mn + m and nn share no factor, both must be perfect mm-th powers, say umu^m and vmv^m. But two mm-th powers that differ by mm must be consecutive at least, and (v+1)m−vm≥m+1(v + 1)^m - v^m \ge m + 1 whenever m≥2m \ge 2 and v≥1v \ge 1. So m=1m = 1, s=1+1/ns = 1 + 1/n, and t=nt = n is a whole number.

The figure checks this by brute force, independently of the argument. For each of the 840 fractions p/qp/q in lowest terms between 1 and ee with denominator at most 40, it computes the partner yy on the curve to high precision, asks whether yy is close to a fraction r/sr/s with denominator under ten thousand, and then settles the question exactly: raising both sides of (p/q)r/s=(r/s)p/q(p/q)^{r/s} = (r/s)^{p/q} to the power qsqs turns it into an equality between whole numbers, prqsps=rpsqrqp^{rq} s^{ps} = r^{ps} q^{rq}, which is compared digit for digit. Three fractions pass — 2, 94\tfrac94 and 6427\tfrac{64}{27}, the values at t=1,2,3t = 1, 2, 3 — and the next, (54)4=625256(\tfrac54)^4 = \tfrac{625}{256}, has a denominator beyond the search. Rational points on a curve are a recurring subject; the rational points of the unit circle are just as completely described, by a single parameter running through the rationals, but there every rational parameter gives a rational point, and here only the whole ones do.

The partner written down

The parametrisation gives the pairs, but not the partner of a given xx. For that the equation has to be solved for yy, and it cannot be done with logarithms and powers alone. Put y=−x w/ln⁡xy = -x\,w/\ln x; then ln⁡y/y=ln⁡x/x\ln y/y = \ln x/x becomes, after a line of algebra, wew=−ln⁡x/xw e^w = -\ln x / x. The function that undoes w↦weww \mapsto w e^w is the Lambert W function, named for the same Johann Heinrich Lambert who built the continued fraction that proves π irrational, and so

y=−xln⁡x W ⁣(−ln⁡xx).y = -\frac{x}{\ln x}\,W\!\left(-\frac{\ln x}{x}\right).

The formula carries the whole picture in it. The equation wew=zw e^w = z has two real solutions when zz lies between −1/e-1/e and 0, because weww e^w has a single minimum, −1/e-1/e, at w=−1w = -1 — the same hump as before, turned upside down and moved. So WW has two real branches there, W0W_0 above −1-1 and W−1W_{-1} below it. For xx between 1 and ee the argument −ln⁡x/x-\ln x/x lies in exactly that range. The upper branch returns y=xy = x, the diagonal: at x=2x = 2 it gives w=−ln⁡2w = -\ln 2 and y=2y = 2. The lower branch returns the partner: at x=2x = 2 it gives w=−2ln⁡2=−1.3863w = -2\ln 2 = -1.3863 and y=4y = 4; at x=94x = \tfrac94 it gives 278\tfrac{27}{8}; at x=1.5x = 1.5 it gives 7.4088, a partner far out along the curve.

The diagonal and the curve are the two branches of one function, and the point (e,e)(e, e) is its branch point. At x=ex = e the argument is exactly −1/e-1/e, the two branches meet at w=−1w = -1, and both return y=ey = e. That is why the curve crosses the diagonal there and nowhere else: a branch point of WW is where two solutions of wew=zw e^w = z collide, and two collided solutions of ln⁡t/t=c\ln t/t = c are a pair with x=yx = y. The same function appears wherever an unknown sits both in an exponent and outside it, as in 2t=10t2^t = 10t, and its power series, −W(−z)=∑nn−1zn/n!-W(-z) = \sum n^{n-1} z^n / n!, counts rooted labelled trees — the series behind the power tower’s sum over trees. The commuting pairs are its simplest instance.

Two fixed points of one exponential

Each pair is the two fixed points of one base. sqrt2: 2,4; t=2 base 1.43392; e^(1/e)=1.44467
Fig. 6 Each pair on the curve is the two fixed points of one map t↦att \mapsto a^t with a=x1/x=y1/ya = x^{1/x} = y^{1/y}: the base 2\sqrt2 is fixed at 2 and 4, the base 1.4339 at 9/4 and 27/8, and at e1/ee^{1/e} the two fixed points merge at ee.

There is a second way to read the equation, and it ties the curve to a different question. Raise both sides of xy=yxx^y = y^x to the power 1/(xy)1/(xy): it becomes x1/x=y1/yx^{1/x} = y^{1/y}. So each pair on the curve shares a common value a=x1/xa = x^{1/x}, and xx and yy are both solutions of at=ta^t = t — the two fixed points of the exponential map t↦att \mapsto a^t. For the pair 2 and 4 the base is 21/2=41/4=22^{1/2} = 4^{1/4} = \sqrt2, and indeed 2 2=2\sqrt2^{\,2} = 2 and 2 4=4\sqrt2^{\,4} = 4. For 94\tfrac94 and 278\tfrac{27}{8} the base is 1.4339.

The figure draws the two exponentials and the diagonal, and each crosses the diagonal twice, at its pair. As the pair slides along the curve towards (e,e)(e, e), the base rises, the two crossings move together, and at a=e1/e=1.4447a = e^{1/e} = 1.4447 they merge into a single tangency at t=et = e (dashed). Above that base the exponential clears the diagonal entirely. This is exactly the threshold at which the infinite power tower of a base stops converging, and the tower of 2\sqrt2 settling at 2 rather than 4 is the statement that of the two fixed points the smaller attracts and the larger repels, as the staircase that shows the whole orbit makes visible: the slope of ata^t at the smaller crossing is below 1 and at the larger above it. The equation xy=yxx^y = y^x knows nothing of stability; it lists the pairs, and the dynamics of the tower picks one member of each.

So the curve of commuting pairs, the compound-interest squeeze on ee, and the convergence of power towers are three readings of one function, ln⁡t/t\ln t/t — its level sets, its peak, and the fixed points of the exponential whose base is ee raised to its values.

What the pictures leave out

The figures are drawn for positive real numbers, and the equation has more to say elsewhere. For negative bases, xyx^y is defined only for some exponents, and pairs such as (−2,−4)(-2, -4) satisfy (−2)−4=116=(−4)−2(-2)^{-4} = \tfrac1{16} = (-4)^{-2}; the set of solutions there is scattered rather than a curve. For complex numbers, xyx^y has infinitely many values, one for each branch of the logarithm — the same multiplicity that leaves some matrices with no logarithm at all — and the equation becomes a statement about one branch at a time. None of that is drawn.

The rational search is evidence and not proof: it examines only denominators up to 40 and partners with denominators under ten thousand, and a rational point with larger height would have escaped it. The proof that none exists is the argument about mm-th powers, which the search merely corroborates. Likewise the grid of whole numbers stops at 10, and the claim that the smaller base wins from 3 onwards rests on the hump falling, not on the grid.

Finally, the pictures do not show that the curve is smooth at (e,e)(e, e), where the parametrisation has no parameter value: t=∞t = \infty. The two halves of the curve meet there because both coordinates tend to ee, and the slope −1-1 is forced by symmetry, but that the curve has a tangent there at all is not what the usual tool says. The implicit function theorem cannot be applied to ln⁡x/x−ln⁡y/y\ln x/x - \ln y/y at (e,e)(e, e), because its gradient vanishes there; a second-order look at the function shows two smooth branches crossing — the diagonal and the curve — which is the one place on the whole picture where the easy argument gives out.

Still open: commuting towers and the other operations

The equation is solved, but its relatives are not all. Ask instead when xyzx^{y^z} is unchanged by permuting xx, yy and zz — when three numbers commute under a tower of powers — and the solution set is a surface whose rational points are not classified. Ask for whole numbers with ab=baa^b = b^a in other number systems, such as the Gaussian integers, and the unique-factorisation argument carries over, but the answer depends on units and associates in a way that needs working out case by case.

A different direction asks about the sequence of operations beyond exponentiation. Addition and multiplication commute; exponentiation commutes only on the curve drawn here; tetration — repeated exponentiation, the tower itself — has no description of its commuting pairs as clean as Euler’s, not least because extending it from whole heights to real ones can be done in several inequivalent ways. The pair 2 and 4 survives one more level, since 2↑↑42 \uparrow\uparrow 4 and 4↑↑24 \uparrow\uparrow 2 are 216=65,5362^{16} = 65{,}536 and 44=2564^4 = 256, and so it does not; for whole numbers the growth of towers makes ties hopeless, and for real numbers the question is not yet even well posed.

Bernoulli’s pair, and Euler’s curve

Apart from x=yx = y, the positive solutions of xy=yxx^y = y^x form a single curve, x=(1+1/t)tx = (1 + 1/t)^t, y=(1+1/t)t+1y = (1 + 1/t)^{t+1}, crossing the diagonal at (e,e)(e, e) with slope −1-1; its rational points are exactly the whole values of tt, so (2,4)(2, 4) is its only whole-number point. The equation is the statement that ln⁡t/t\ln t/t takes the same value twice, and that function’s single peak at ee explains the rest: every number between 1 and ee has one partner beyond ee; from 3 onwards the smaller base always wins, so 24=422^4 = 4^2 is the only tie among whole numbers; eπe^\pi beats πe\pi^e; and each pair is the two fixed points of the exponential to the base x1/xx^{1/x}, which is why the tower of 2\sqrt2 meets both 2 and 4 and settles at the smaller. The two coordinates are the compound-interest approximations to ee on either side, so the curve is the squeeze that defines ee, drawn in the plane.