# Solution of $x^2e^x = y$

The other day, I came across the problem (or something that reduced to the problem):

Solve for $x$ in terms of $y$ and $e$: $$x^2e^x=y$$

I tried for a while to solve it with logarithms, roots, and the like, but simply couldn't get $x$ onto one side by itself without having $x$ on the other side too.

So, how can I solve this, step-by-step?

More generally, how can I solve equations that involve both polynomials (e.g. $x^2$, $x^3$) and exponentials (e.g. $e^x$,$10^x$)?

EDIT - I now remember why I this question came up. I was reading something about complexity theory (the basics: P, NP, NP-hard, etc.), and I got to a part that talked about how polynomial time is more efficient than exponential time. So, I decided to take a very large polynomial function and a very small exponential function and see where they met. Hence, I had to solve an equation with both polynomials and exponentials, which I figured could reduce to $x^2e^x=y$.

• If this equation can be solved without numerical methods, then only with the Lambert-W-Function, not sure if this works. The Lambert-W-function is the inverse function of $f(x)=xe^x$ Apr 25 '16 at 20:50
• @Peter, sorry, I haven't heard of the Lambert-W-Function. I would accept an answer that used that function if you explained what it is and how it works. Apr 25 '16 at 20:52
• The same can be said about every equation $p(x)e^x=y$, where $p(x)$ is a non-constant polynomial. It can be solved with Lambert-W-function perhaps, otherwise you will need numerical methods. Apr 25 '16 at 20:52
• @Peter Are there any good resources about the Lambert-W-Function that aren't too verbose/scholarly? (The Wikipedia article is beyond my understanding) Apr 25 '16 at 20:54
• Since the Lambert-W-Function cannot be calculated explicit, there is no point to use it for the concrete calculation of solutions. It was just invented to allow to formulate some inverse functions. Better try newton method or regula falsi. With such methods, you can calculate the solutions easy and as precise as you want. Apr 25 '16 at 20:58

Solution with Lambert W: $$x^2 e^x=y \\ x e^{x/2} = \sqrt{y} \\ \frac{x}{2}\;e^{x/2} = \frac{\sqrt{y}}{2} \\ \frac{x}{2} = W\left(\frac{\sqrt{y}}{2}\right) \\ x = 2\;W\left(\frac{\sqrt{y}}{2}\right)$$ One solution for each branch of the W function.
Other solutions by taking the other square-root: $$x = 2\;W\left(\frac{-\sqrt{y}}{2}\right)$$