4

What is the best approach for solving the equations of the form

$p^x = x^q$ ; where $p$ and $q$ are some constants.

Basically, I wanted to solve $2^x = x^2$ to analyze algorithms with respective growth functions.

John Doe
  • 1,257

1 Answers1

5

Such equations can be solved using the Lambert W function, defined to be an inverse function of $f(x)=xe^x$. Because $f$ is not injective, the Lambert W function is in fact a multifunction. It can be evaluated numerically, however there is a closed form for some values of $x$.

Now let us solve your equation: $$p^x=x^q \\ p^xx^{-q}=1$$

using the properties of $e$ and natural logarithms $$e^{x\ln p}x^{-q}=1 \\ e^{-\frac{x\ln p}{q}}x=1$$

Now we multiply by $-\frac{\ln p}{q}$ in order to use the definition of $W(x)$: $$-\frac{x\ln p}{q}\cdot e^{-\frac{x\ln p}{q}} =-\frac{\ln p}{q} \\ -\frac{x\ln p}{q}=W\left(-\frac{\ln p}{q} \right)$$

Finally, after some transformations we see that $$\boxed{x=-\dfrac{q\, W\left( -\frac{\ln p}{q}\right)}{\ln p}}$$ And that's the closest you can get to a closed form.

John Doe
  • 1,257
  • 1
    (+1) it is worth being careful with this, however: it looks like the argument to $W$, $\frac{- \ln p}{q}$, is negative. That means $W$ is multivalued, so there are two solutions! And if $\frac{- \ln p}{q} < \frac{-1}{e}$, then there are no solutions. – Caleb Stanford Sep 19 '16 at 20:24