Comparing ##a^b## and ##b^a##

  • Context: Undergrad 
  • Thread starter Thread starter PeroK
  • Start date Start date
PeroK
Science Advisor
Homework Helper
Insights Author
Gold Member
2025 Award
Messages
29,575
Reaction score
21,382
I noticed the following question generated quite a lot of interest on the Internet. Which is larger ##e^{\pi}## or ##\pi^e##?

Most (if not all) solutions focus on this as a problem for these specific numbers. And, in fact, the same question was then asked for other specific pairs of numbers. Moreover, most of the solutions seemed to be quite complicated. So, I thought I would post my solution here.

First, since the natural log is an increasing function, we have for any ##a, b > 0##:
$$a^b > b^a \Leftrightarrow b\ln(a) > a\ln(b) \Leftrightarrow \frac{\ln(a)}a > \frac{\ln(b)}b$$We look at the function ##f(x) = \frac{\ln(x)}x## and note that:
$$f'(x) = \frac 1 {x^2}(1 - \ln(x))$$We see that the function is increasing for ##x < e##, has a maximum at ##x=e##, and is decreasing for ##x > e##. In particular, we can see that:

If ##e \le a < b##, then ##a^b > b^a##. (That answers the question for ##e## and ##\pi##)

If ##a < b \le e##, then ##a^b < b^a##.
 
  • Like
  • Informative
Likes   Reactions: dextercioby, bob012345, pines-demon and 7 others
Mathematics news on Phys.org
Here is a plot of the region where ##a^b>b^a##
1771855668364.webp

I think your rule covers the upper right and lower left quadrants. (the quadrant lines are ##a=e## and ##b=e##)
 
Last edited:
  • Like
  • Informative
Likes   Reactions: dextercioby, OmCheeto, bob012345 and 3 others
Dale said:
Here is a plot of the region where
Cool plot! How did you generate it?
 
berkeman said:
Cool plot! How did you generate it?
Mathematica has a function called "RegionPlot" that makes them very easy. Without the "pretty" options for the labels and the gridlines this figure is:
Code:
RegionPlot[a^b > b^a, {a, 0, 6}, {b, 0, 6}]
 
  • Informative
  • Like
Likes   Reactions: mad mathematician, AlexB23, PeroK and 1 other person
My high school friend in the 1960s played with this problem for a long time. I never understood what he was trying to determine. He was an MAA champion and was on the team that went to England to compete with the English and Russians. The US team came in last because they were used to multiple-choice tests, while the English and Russians were trained on fill-in-the-blank tests, which is how the competition test was constructed.

My recollection was the famous exact solution of ##2^4 = 4^2##

I guess he wanted to find algebraically the point where the a and b were equal inflection point, which I think is ##e^e##
 
  • Like
Likes   Reactions: OmCheeto and Dale
jedishrfu said:
My high school friend in the 1960s played with this problem for a long time. I never understood what he was trying to determine. He was an MAA champion and was on the team that went to England to compete with the English and Russians. The US team came in last because they were used to multiple-choice tests, while the English and Russians were trained on fill-in-the-blank tests, which is how the competition test was constructed.

My recollection was the famous exact solution of ##2^4 = 4^2##

I guess he wanted to find algebraically the point where the a and b were equal inflection point, which I think is ##e^e##
The general solution must be transcendental, similar to the Lambert W-function.
 
  • Like
Likes   Reactions: Dale
If I use Mathematica to solve ##a^b=b^a## for ##b## as a function of ##a## then I get $$b=-\frac{a \ W_0\left(-\frac{\ln(a)}{a} \right)}{\ln(a)}$$ where ##W_0## is the principal branch of the Lambert W product log function. I am not at all familiar with this function, but the result looks correct:
1771867175783.webp
 
  • Like
Likes   Reactions: PeroK
PeroK said:
The general solution must be transcendental, similar to the Lambert W-function.
Yes, good call. I am not familiar with it but you appear to be exactly right.
 
Last edited:
I love threads like this. Thank-you, @PeroK !
 
  • Like
Likes   Reactions: PeroK
  • #10
With no loss of generality a<b
$$f:=\ln \frac{b^a}{a^b}=ab(\frac{\ln b}{b}-\frac{\ln a}{a})$$
Sign of f decides which is larger.

The remaining case to investigate from OP is a<e<b.
1771890884278.webp

For a<1, f>0 obviously.

Some cases
$$2^2=2^2$$
$$2^3<3^2$$
$$2^4=4^2$$
$$2^5>5^2$$

We can get two roots of the equation
$$\frac{\ln x}{x}=c < \frac{1}{e}$$
$$e^{cx}=x$$
by the graphs.
1771895652106.webp

This is the graph for c=1/3

[EDIT]
According to the wikipedia article : https://en.wikipedia.org/wiki/Lambert_W_function#Generalizations the solutions of
$$x=e^{cx}$$
is
$$x=-\frac{1}{c}W(-c)=x_1(c),x_2(c)$$
where W is Lambert function of branch 0 and -1. Thus with parameter 0<c<1/e
$$x_1^{x_2}=x_2^{x_1}$$

As a layman I should appreciate any suggestion/correction.
 
Last edited:
  • #11
As you might know there's something like this also for matrices.
I mean in Lie theory we have exponent of a square matrix, so just like ##A^B=e^{B\ln(A)}##, where ##ln(A)## is well defined (as a series in powers of ##A##); so we can define a similar bracket like ##[A,B]=AB-BA##, but this time for ##A^B-B^A##.
Well as I think of it we can also define just like in Poisson brackets instead of derivatives, integrals. (and one can also define instead of '-' to substitue it with '+', what is usually called anti-commutator).

When you think of it, there are endless possible definitions for such differences or additions; and I guess you can also use these definitions in theoretical physics.
But nice analasys for the case of numbers.

As for a similar case for matrices, I guess one needs an inner product to define positive definiteness, and then we can do a similar analysis for ##A^B## and ##B^A##; I would think Hessians will appear.. (haven't done the analysis myself it's just a hunch). ::oldsurprised:
 
  • #12
Moved to other thread.
 
Last edited:
  • #13
Moved to other thread.
 
Last edited:
  • #14
The plot can also be generated easily on Desmos.
IMG_4974.webp
 
  • Like
Likes   Reactions: OmCheeto and AlexB23
  • #15
bob012345 said:
The plot can also be generated easily on Desmos.
View attachment 369809
Demos is the greatest of all time calculator. Used it a bit in high school over a decade ago, and it helped me visualize math concepts.
 
  • Like
Likes   Reactions: bob012345
  • #16
bob012345 said:
The plot can also be generated easily on Desmos.

Apple's 'grapher' application also generates it.

1771969255768.webp


Though, it appears to develop brain flatulence if the numbers get too large.

1771973000132.webp
 
  • Like
Likes   Reactions: AlexB23
  • #17
OmCheeto said:
Apple's 'grapher' application also generates it.

View attachment 369812

Though, it appears to develop brain flatulence if the numbers get too large.

View attachment 369813
The aliasing is real. What is with the pixelated graph?
 
  • #18
One can take the log of both side of the inequality and plot that. That plot looks identical but goes on exponentially further. The purple is blue overlapping red and boundary between blue and purple is where it’s failing due to large exponents.

IMG_4977.webp


Also, it’s obvious but if you look at the regions where a^b >b^a vs <, they are symmetric about the a=b axis so exactly half the quadrant is greater and half is lesser.

IMG_4980.webp
 
  • Like
  • Informative
Likes   Reactions: OmCheeto, Dale and AlexB23

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
921
  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 5 ·
Replies
5
Views
1K
Replies
4
Views
2K
Replies
12
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
3K