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,565
Reaction score
21,367
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})$$
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
 
Last edited:
  • #11
The Lambert function comes up in a lot of math videos. Here's one such video:

 
  • Informative
Likes   Reactions: Dale
  • #12
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:
 
  • #13
jedishrfu said:
The Lambert function comes up in a lot of math videos. Here's one such video:


In school, they never taught "proof by inspection" either!
 
  • Like
Likes   Reactions: Dale
  • #14
jedishrfu said:
The Lambert function comes up in a lot of math videos. Here's one such video:


Since ##4^x + x## is monotonically increasing, I would recommend that students make a rough estimation; they would then find that ##4^x + x=4^4+4##
 
  • Like
Likes   Reactions: jedishrfu
  • #15
But the point of the video is to teach us how to use the lambert function to solve a problem not how to intelligently guess the answer.

In the case of the original expression here, students might guess similarly setting a=b and yet miss 2^4-4^2 solution.
 
  • #16
jedishrfu said:
But the point of the video is to teach us how to use the lambert function to solve a problem not how to intelligently guess the answer.
After all the complications with applying the W-function, the solution still hinges on noticing that ##4^4 = 256##. You might as well notice that right up front.
 
  • #17
PeroK said:
After all the complications with applying the W-function, the solution still hinges on noticing that ##4^4 = 256##. You might as well notice that right up front.
Here's what really going on. We start with a more general equation:
$$a^x + x = b$$$$(b - x)a^{-x} = 1$$$$(b-x)a^{b-x} = a^b$$We want to use the W-function on the left-hand side, so we use that ##y = e^{\ln y}## and multiply both sides by ##\ln a##:
$$(b-x)(\ln a)e^{(b-x)\ln a} = a^b \ln a$$Now, by the definition of the W-function:
$$(b-x)\ln a = W(a^b \ln a)$$And, we have the general solution:
$$x = b - \frac{W(a^b \ln a)}{\ln a}$$To get rid of the W-function, we need to factorise ##a^b = a^aa^{b-a}## and use the trick that ##y = e^{\ln y}## again:
$$x = b - \frac{W((a^a \ln a)e^{(b-a)\ln a})}{\ln a}$$So, in the special case that ##a^a = (b - a)##, we have:
$$x = b - (b-a) = a$$
 
  • #18
Here's the irony. Let's go back to the general solution:
$$x = b - \frac{W(a^b \ln a)}{\ln a}$$We try to get rid of the W-function by factorising ##a^b = a^{\alpha}a^{b-\alpha}## to give:
$$x = b - \frac{W((a^\alpha \ln a)e^{(b - \alpha)\ln a})}{\ln a}$$Then, in order to simplify we need to solve:
$$a^\alpha = b - \alpha$$Which is precisely our original equation!

So, all the shenanigans with the W-function was going round in one big circle to get us back to our original equation within the W-function argument. The only way to simplify is to spot/guess the solution to the original equation!

I had a gut feeling there was something not right about that video.
 
  • #19
The plot can also be generated easily on Desmos.
IMG_4974.webp
 
  • Like
Likes   Reactions: OmCheeto and AlexB23
  • #20
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.
 

Similar threads

  • · Replies 2 ·
Replies
2
Views
2K
  • · Replies 1 ·
Replies
1
Views
897
  • · 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