# Extracting solutions from the two-variable exponential equation $x^y=y^x$ using the Lambert W function

Wolfram Alpha gives the solutions to $x^y=y^x$, where $W$ is the Lambert $W$ function:

$$x=-\frac{yW\left(-\frac{\log(y)}{y}\right)}{\log(y)}$$

I'm not very familiar with how to manipulate the Lambert $W$ function, so I am a little lost when it comes to deriving the solutions that Wolfram Alpha came up with.

Here is my attempt:

$x^y=y^x$

$\log(x^y)=\log(y^x)$

$y\log(x)=x\log(y)$

$\frac{\log(x)}{x}=\frac{\log(y)}{y}$

$x=\frac{y\log(x)}{\log(y)}$

Substituting $x=\frac{y\log(x)}{\log(y)}$ for $\log(x)$ gives an equation that reduces to $x=x$. I understand that if I can get a expression of the form $f(x)e^{f(x)}$, $W(f(x))$ becomes a solution for $f(x)$ (ick, that's the wrong way to phrase it), but I'm just not sure how to get such an expression.

• "that reduces to x=x" ? Isn't there a typo ? – Peter Sep 13 '17 at 19:12

## 3 Answers

Let's continue from the fourth equation of your attempt: $$\frac{\log(x)}{x}=\frac{\log(y)}{y}$$

Based on the form of the left hand side, it is convenient to substitute $x=e^{-u}$. Then, we obtain for the LHS: $$\frac{\log(x)}{x}=\frac{-u}{e^{-u}}=-ue^u$$ As a consequence of our substitution, it is easy to see that we can just simply apply the definition of the Lambert W function. This gives us: $$u=W\left(-\frac{\log(y)}{y}\right)$$

Note that if you just simply substitute back to obtain $x$, you will obtain the following: $$x=e^{-W\left(-\frac{\log(y)}{y}\right)}$$ This is an acceptable solution, but note that you can make use of the identity $e^{-W(z)}=\dfrac{W(z)}{z}$ (a specific case of the more general identity $e^{nW(z)}=z^n W(z)^{-n}, n\in \mathbb{Z}$) to obtain the solution in the same form as Wolfram Alpha.

Write $$x=y^{x/y}=e^{x\ln y/y}.$$

Then with $x\ln y/y=-t$,

$$-t\frac y{\ln y}=e^{-t},$$

$$te^t=-\frac{\ln y}y.$$

Hint : Substituting $\log(x)=u$ transforms $\frac{\log(x)}{x}$ into $\frac{u}{e^u}=ue^{-u}=-(-ue^{-u})$

• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review – mlc Sep 13 '17 at 19:32
• I do not agree. The substitution leads to an expression of the form $ye^y$ so that the Lambert-W-function can be applied. And the question above whether "x=x" is a typo has nothing to do with my answer. – Peter Sep 13 '17 at 19:37