How to solve $x^2 = e^x$

The question is to find $x$ in:

\begin{equation*} x^2=e^x \end{equation*}

I know Newton's method and hence could find the approx as $x\approx -0.7034674225$ from

\begin{equation*} x_{n+1} = x_n - \dfrac{x_n^2-e^{x_n}}{2x_n-e^{x_n}} \end{equation*}

According to WolframAlpha: They also say that $x=-2W(\dfrac{1}{2})$ which shows that it can be solved using some Lambert-W function...Can anyone tell me how to do this?

Thanks a lot!

P.S. - I studied a li'l bit of Lambert-W ... So i guess a detailed explanation would not be needed ... just the initial steps!

• I edited the equation in order to have $x_n$ everywhere in the rhs. I hope you don't mind. – Claude Leibovici May 7 '15 at 10:11
• @ClaudeLeibovici Haha...Thanks! Forgot it! – NeilRoy May 7 '15 at 10:12

$$x^2=e^x\implies x/2=\pm\tfrac12e^{x/2}\implies-x/2\,e^{-x/2}=\pm\tfrac12$$ Therefore, $$x=-2\mathrm{W}\!\left(\pm\tfrac12\right)$$ Since $\mathrm{W}(x)$ is real only for $x\ge-\frac1e$, we only have one real solution: $$x=-2\mathrm{W}\!\left(\tfrac12\right)=-0.70346742249839165205$$
• How did you know that $-2W(\dfrac{1}{2})$ approximates to $-0.703467...$? – NeilRoy May 7 '15 at 14:45
• Mathematica has the LambertW function. I have also detailed an algorithm to compute $\mathrm{W}(x)$ in this answer. Five iterations of that algorithm give over $12$ places of accuracy. – robjohn May 7 '15 at 14:51
Write the equation as $x^2e^{-x} = 1$. Then $x^2e^{-x} = 4\left(\left(-\frac{x}{2}\right)e^{-\frac{x}{2}}\right)^2$.
The Lambert W function is the inverse of $xe^x$. We want to find the inverse of $e^x x^{-2}$, dividing by $x^2$.
Now we have y=1, so $x=-2W(-0.5)$ or $x=-2W(0.5)$. The first one is complex, so only the second one remains as real solution.