How do I solve $x^{k}=k^{x}$, given k, analytically?

65 Views Asked by At

I've tried taking the log of both sides (but am left with $k\ln{x}=x\ln{k}$).

2

There are 2 best solutions below

0
On BEST ANSWER

$$x^k=k^x$$ $$x^k=e^{x\ln(k)}$$ $$x=e^{x\ln(k)/k}$$ $$\frac1x=e^{-x\ln(k)/k}$$ $$-1=-xe^{-x\ln(k)/k}$$ $$-\frac{\ln(k)}{k}=-x\ln(k)/k\cdot e^{-x\ln(k)/k}$$ $$-x\ln(k)/k=W\left(-\frac{\ln(k)}{k}\right)$$ $$x=-\frac{kW\left(-\frac{\ln(k)}{k}\right)}{\ln(k)}$$

Where $W$ is the Lambert W function, defined as an inverse of $$f(x)=xe^x$$

0
On

This is a pure beauty $$x^k=k^x \implies x=-\frac{k}{\log (k)}W\left(-\frac{\log (k)}{k}\right)$$ where $W(z)$ is Lambert function. Just for pleasure, work around it; it is a very nice function with a lot of practical applications.

The Wikipedia page gives formulae to approximate $W(z)$. If you are not able to use it directly, Newton method (or Halley better) is the way to go (solving $k\log(x)-x\log(k)=0$).