Find the all possible real solutions of $x^y=y^x$ [duplicate]

Applying the logarithm to both sides gives $$y \log x = x \log y,$$ and rearranging gives $$\frac{\log x}{x} = \frac{\log y}{y}$$, so we get a nontrivial solution (i.e., one for which $x \neq y$) for any value assumed twice by $f(x) := \frac{\log x}{x}$. More explicitly, if $x$ and $y$ are distinct values such that $f(x) = f(y)$, then by construction we have a nontrivial solution $x^y = y^x$.

The function $f$ is obviously continuous, and

  1. has a single root at $x = 1$,
  2. is strictly increasing on $(0, e)$ and strictly decreasing on $(e, \infty)$,
  3. has a unique maximum of $\frac{1}{e}$ at $x = e$, and
  4. has limit $\lim_{x \to \infty} f = 0$.

We can thus conclude that the values $f$ takes on twice are precisely those in $(0, \frac{1}{e})$. Given such a value, it is generally difficult to find its two preimages explicitly*, but nonetheless we can parameterize the solutions as $$(x, y) = \left(\left(1 + \frac{1}{u}\right)^u , \left(1 + \frac{1}{u}\right)^{u + 1}\right).$$

See $x^y = y^x$ for integers $x$ and $y$ for much more.

*In closed form, anyway, we can write down solutions in terms of the Lambert-W function, which appears on this site much more than it does in "real life"...