Q:

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.

