# Which is greater, $e^{\pi}$ or $\pi^e$? [duplicate]

I'm familiar with a simple method of demonstrating that $e^\pi$ is greater:

$f(x) = \ln|x|/x$

$f'(x) = (1 - (\ln|x|))/(x^2)$ so f's max is at $(e, 1/e)$ so $1/e > \ln(\pi)/\pi$ and $e^{\pi} > \pi^e$

My question is simply, how does one come up with this "$\ln|x|/x$" function?

I've tried working backwards, but there doesn't seem any real clear way of coming up with this magic function that gives such an elegant solution to this problem.

## marked as duplicate by mesel, egreg, Antonio Vargas, colormegone, Daniel Robert-NicoudJun 18 '14 at 23:28

• Why do I have the feeling that this question has been asked at least many times before? – Asaf Karagila Jun 18 '14 at 20:08
• A long time ago in a math department far far away, someone studying $\ln|x| / x$ noticed this and said "Hah! This'll keep them on their toes!" – Lee Mosher Jun 18 '14 at 20:10
• probably one of the most duplicated questions on the site, among which: math.stackexchange.com/questions/7892/comparing-pie-and-e-pi math.stackexchange.com/questions/337565/… – colormegone Jun 18 '14 at 20:22
• @Asaf Karagila, I think the topic title question has been asked, but I was more specifically asking how people find that clever ln|x|/x. If that too has been covered, I wasn't able to find it via search and apologize for double posting – David Bandel Jun 18 '14 at 20:51
• @RecklessReckoner, neither of those posts was asking my question actually. I wasn't asking which was larger or how to prove one was larger. Was asking where the clever ln|x|/x comes from. I wasn't sure of a good way to ask that in a brief topic title though. But I did ask it clearly in the body of my question – David Bandel Jun 18 '14 at 20:52

Take logarithms.

$$e^\pi > \pi^e \Rightarrow \pi \log{e} > e\log{\pi} \Rightarrow \frac{\log e}{e} > \frac{\log \pi}{\pi }$$

This motivates us to consider the extrema of the function $f(x) = \frac{\log{x}}{x}$.

• exactly what I was looking for. definitely a facepalm moment. thanks for the help – David Bandel Jun 18 '14 at 20:53
• Thanks that's actually a method for proving the inequality using Lagrange sentence. – Dor Feb 3 '15 at 14:28

$e^\pi > \pi^e \iff e^{1/e} > \pi^{1/\pi}$

So the function you are actually considering is $x^{1/x}$.

$x^{1/x} = e^{\ln x/x}$

• ahh i see. that's a more direct way of looking at it. thanks for your help – David Bandel Jun 18 '14 at 20:54