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

• Is $x^x=y$ solvable for $x$?

#### Solutions Collecting From Web of "$x^x=y$. How to solve for $x$?"

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.

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).

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)}$$