Solving for y in the equation $y^x$ = $x^y$ Once upon a time as a high school freshman I stumped all the math teachers and tutors by asking them to solve for y in the in the equation $y^x = x^y$. I asked Wolfram alpha to solve for y and it returns $$y = \frac{xW(-\frac{\log{x}}{x})}{\log{x}}$$ which is completely non intuitive. By the way, W(x) is the  solution, y, to the equation $ye^y=x$, also known as the Lambert W function. I haven't been able to find much online about deriving this equation and was wondering if anyone could derive this for me? I'm a calculus student so I would appreciate it if the explanation could be in terms simple enough for me to understand.
 A: 
$$y^x = x^y$$

I will assume $x>0$ and $y>0$ the first is what the formula suggests.
First start by taking logarithms on both sides,
$$x \ln y=y \ln x$$
This gives,
$$\frac{\ln y}{y}=\frac{\ln x}{x}$$
Now using $\ln (y^{-1})=-\ln y$ we have,
$$\frac{1}{y} (-\ln y)=-\frac{\ln x}{x}$$
$$\frac{1}{y}\ln (\frac{1}{y})=-\frac{\ln x}{x}$$
$$e^{\ln (\frac{1}{y})} \ln (\frac{1}{y})=-\frac{\ln x}{x}$$
Then let $u=\ln (\frac{1}{y})$
Then we have,
$$ue^u=-\frac{\ln x}{x}$$
$$u=W(-\frac{\ln x}{x})$$
$$\ln (\frac{1}{y})=W(-\frac{\ln x}{x})$$
From which you find,
$$\frac{1}{y}=e^{W(-\frac{\ln x}{x})}$$
$$=\frac{-\frac{\ln x}{x}}{W(-\frac{\ln x}{x})}$$
And your formula falls out by inverting both sides. (Note: your formula is off by a negative sign, as expected by the derivation). To be precise we must assume $x \neq 1$, otherwise at the very last step we would be dividing by $0$. In the case $x=1$, $y=1$ is trivial.


The last step holds by the definition. Note for $W(x) \neq 0$:

$$W(x)e^{W(x)}=x \implies e^{W(x)}=\frac{x}{W(x)}$$
