# $x^x=y$. How to solve for $x$?

I tried looking for ways to solve this equation and came across something like Lambert's W function, which, by the way, I did not understand a bit, because I've never learned it nor do I have a decent mathematical background. I also came across one more method called the Newton's method, but never used it either. Can the procedure to solve this equation be made a little bit clearer? I just plugged in the value on my calculator and it solved it for me, I guess it must have used some trial and error. Please advise.

-
possible duplicate of Is $x^x=y$ solvable for $x$? – J. M. Apr 17 '12 at 18:34

Please excuse me if I go back too far in not assuming things which you already understand very well.

You first have to clarify what $x^x$ really means. In general, $a^x$ is defined as $e^{x \log a}$ for positive $a$. So for positive $x$, we define $x^x$ as $e^{xlog x}$. If you want to use Newton's method, it's a bit easier to take (natural) logarithms at this point. Solving $x^x = c$ for some number $c$ is then equivalent to solving $x \log x = d$ where $d = \log c$, so let's concentrate on solving $x \log x = d$. We are then trying to solve $f(x) = 0$ where $f(x) = x \log x -d$. Notice that the derivative $f^{\prime}(x) = 1 +\log x$.

Newton's method tries to solve $f(x) = 0$ by picking a starting approximation to a solution $x_0$, and then by generating new approximations via the formula $x_{n+1} = x_n - \frac{f(x_n)}{f^{\prime}(x_n)}.$ This is justified by the heuristic that $f(x + h)$ is close to $f(x) + hf^{\prime}(x)$ when $h$ is small, so if we take $h = \frac{-f(x)}{f^{\prime}(x)}$, we should get something close to zero. Newton's method doesn't always converge to a solution, and analysing under which conditions it does is quite complicated.

Anyway, for this choice of $f$, Newton's method tells us to set $x_{n+1} = x_{n} - \frac{x_n \log(x_n) - d}{1+\log x_n}$, which we can rewrite as $x_{n+1} = \frac{x_n + d}{1 + \log x_n}$. This, or something like it, may be how your calculator found a solution.

-
Theorem : If $f$ is increasing and convex (then $f$ has a unique zero) and if $x_0$ is greater than the zero of $f$, then Newton's method converges (geometricaly, with explicit bounds). Proof : Just notice that in these conditions, the sequence is decreasing and bounded from below by the zero. – user10676 Jul 8 '11 at 17:22
Thanks. That's helpful for this example, but generally speaking it's not always so easy to know how Newton's method behaves (things like Lipschitz conditions can sometimes be used). – Geoff Robinson Jul 8 '11 at 19:17
@GeoffRobinson Why $e^{xlogx}$ ? If we use e it should be $e^{xlnx}$ right? – Geo Papas Aug 27 '13 at 15:48
Log to an unspecified base means that natural log by most conventions. – Geoff Robinson Aug 27 '13 at 20:16

You want to solve $x^x = c$, for some number $c$. The answer $x$ cannot be expressed in terms of the common functions — polynomials, trigonometric functions, exponential, etc. — but you can express it in terms of another function that has been studied and given a name. Specifically, the Lambert W function is defined as the answer to a related question:

If $x = W(z)$, then $xe^x = z$.

The relation is that \begin{align}x^x &= c \\ x\ln x &= \ln c \qquad\qquad \text{ taking logarithms}\\ (\ln x)e^{(\ln x)} &= \ln c \qquad\qquad \text{ writing }x=e^{(\ln x)}\\ \ln x &= W(\ln c) \qquad \text{by definition of }W \\ x &= e^{W(\ln c)} \end{align}

So the Lambert W function gives a name for what you want. To find the value numerically, you can use something like Newton's method, which is a very general method. For your problem, the method is something like the following (according to Wikipedia):

• Pick some value $w_0$ as your initial guess.

• If you know some value $w_j$ (where $j = 0, 1 \dots$ is an index), find the next value $w_{j+1}$ as $$w_{j+1}=w_j-\frac{w_j e^{w_j}-\ln c}{e^{w_j}+w_j e^{w_j}}.$$

• At each stage (for each $j$), $e^{w_j}$ is an approximation to the true value $x$ you want, and this approximation gets better as $j$ increases (as you perform more steps).

-
I must confess I don't have a very good understanding of the conditions under which Newton's method converges fast and correctly. For instance, applying Newton's method directly to $f(x) = x^x - c$ gives the iteration $\displaystyle x_{j+1} = x_j - \frac{x_j^{x_j} - c}{x_j^{x_j}(1 + \ln x_j)}$ while applying it to $f(x) = x\ln x - \ln c$ gives the iteration $\displaystyle x_{j+1} = x_j - \frac{x_j\ln x_j - \ln c}{1 + \ln x_j} = \frac{x_j + \ln c}{1 + \ln x_j}$. Both of these look simpler than what I quoted from Wikipedia in the answer above, but I don't know if they're "better". – ShreevatsaR Jul 8 '11 at 14:05

None of the "elementary functions" from basic mathematics solves this. A "new" function, the Lambert W function, can be introduced, which solves many things not solvable in elementary functions. Including this equation.

Solve $x^x=y$ for $x$ and get: $$x = \frac{\operatorname{ln} (y)}{\mathrm W \bigl(\operatorname{ln} (y)\bigr)}$$

-
Why not take the logarithm to the basis $x$? – Rudy the Reindeer Jul 8 '11 at 13:44
@Matt: $x\log_x x = \log_x y$ so then $x = \log_x y$, but (since $x$ is on both sides) not yet solved for $x$. – GEdgar Jul 8 '11 at 13:47
@Matt: How do you propose to take logarithm to base $x$ without knowing the value of $x$? – ShreevatsaR Jul 8 '11 at 13:52
@ShreevatsaR: that might indeed be a problem! : ) – Rudy the Reindeer Jul 8 '11 at 19:56
@Gedgar If I want to find the value, how do I go about it? What is W(ln(y))? – Ragavan N Jul 11 '11 at 12:22