What is the fastest way to check if $x^y > y^x$ if I were writing a computer program to do that?
The issue is that $x$ and $y$ can be very large.
What is the fastest way to check if $x^y > y^x$ if I were writing a computer program to do that?
The issue is that $x$ and $y$ can be very large.
If both $x$ and $y$ are positive then you can just check: $$ \frac{\log(x)}{x} \gt \frac{\log(y)}{y}$$ so if both $x$ and $y$ are greater than $e \approx 2.7183$ then you can just check: $$x \lt y$$
You might get by testing whether $y \log x > x \log y$, especially if the numbers are only moderately large.
We reduce the question to: is the quotient $\frac{x^y} {y^x}$ less or greater than $1$.
Noticing that $x > 0, y > 0,$ we take the xy-th root of the quotient:
Is the ratio $(x^y)^{\frac1{xy}} / (y^x)^{\frac1{xy}}$ less or greater than $1^{\frac1{xy}}$.
We reduce the complicated powers, the power of base 1 is 1:
is the ratio $x^{\frac1x} / y^{\frac1y}$ less or greater than 1.
is the function $f(x) = x^{\frac1x}$ increasing or decreasing at the interval $[x,y]$?
· If already known, via the derivate, that the function $f(x) = x^{\frac1x}$ has only one maximum, so an absolute maximum for $x = e$ , the point $(e, e^{\frac1e})$,
Consider that a) for $x > e$ and $y > e$ , the function $f$ is decreasing, which means
• if $e < x < y => f(x) > f(y)$. [both x and y are greater than e, the greater exponent wins.]
and b) for $x < e$ and $y < e$ the function $f$ is increasing, which means
• if $0 < x < y < e => f(x) < f(y)$. [both x and y are less than e, the greater base wins.]
• But if $x < e < y$, the comparison is not decided through the function’s behaviour. [e is between both.] We have to calculate both powers to compare the outcomes.
So there are pairs of $x,y$ existing for which $x^y = y^x$, with $x < e < y$.
For example, $x = √(√5)$ and y = √(√(5^5)) = √(√3125)
both x^y and y^x come out on ≈ 20,25372598…
Many pairs are findable, e.g. by setting y = a·x and resolving the equation (x^y) = (y^x), or
f(x) = f(y).