Solve for $x$ in $a^x=x^b$ I was wondering if there was any way to solve the equation $a^x=x^b$ for x in terms of a and b. a and b are natural numbers.
I tried taking the log of both sides, but I didn’t see any way to get the X out of the log. I also tried taking log base a, but that didn’t seem to go very far either.
I can see that there can be an answer because when I graph the equations $2^x=y$ and $x^2=y$ and look for overlap it shows two answers. I get $x=2,-0.767$. 
 A: $$\begin{align*}
a^x &= x^b\\
e^{x\ln a} &= x^b\\
1 &= x^b e^{-x\ln a}\\
e^{k2\pi i/b} &= x e^{-(x\ln a)/b}\\
-\frac{\ln a}{b}e^{k2\pi i/b} &= -\frac{x\ln a}{b} e^{-(x\ln a)/b}\\
W\left(-\frac{\ln a}{b}e^{k2\pi i/b}\right) &= -\frac{x\ln a}{b}\\
x&= -\frac{b}{\ln a} W\left(-\frac{\ln a}{b}e^{k2\pi i/b}\right)
\end{align*}$$
where $W$ is Lambert W function, $e^{k2\pi i/b}$ is a root of unity for  $k = 0, 1, \ldots, b-1$.

edit: I had to mention the different roots of unity, because for example when $b=2$ as in OP's question, $-1$ is also a real square root of $1$, the argument of $W$ is real and positive, and that case leads to the $-0.767\ldots$ root.
A: Sure.  The solution is well-known for $a,b > 0$ and $a, b \in \mathbb{R}$:
$$x = -\frac{b W\left(-\frac{\log (a)}{b}\right)}{\log (a)}$$
where $W$ is Lambert's Polylog function.
A: Using the Lambert $W$ function, one may write
$$
x=-\frac{bW\left(-\frac{\log a}{b} \right)}{\log a}.
$$
A: For an alternate derivation,
\begin{align}
a^x &= x^b \\
a^{x/b} &= x \\
a^{1/b} &= x^{1/x} \\
\frac1b\log a &= \frac1x \log x \\
-\frac1b\log a &= \frac1x \log{\frac1x} \\
&= \log{\frac1x} e^{\log{\frac1x}} \\
W\left(-\frac1b \log a\right) &= \log{\frac1x} \\
e^{W\left(-\frac1b\log a\right)} &= \frac1x \\
x &= e^{-W\left(-\frac1b\log a\right)}
\end{align}
We have used the identities $\log{a^b} = b \log a$, $-\log x = \log{\frac1x}$, $x = e^{\log x}$, and $W(xe^x) = x$.
This is equivalent to the other answers by the identity $e^{-W(x)} = \frac{W(x)}x$.
