Why can't $y=xe^x$ be solved for $x$?

You can use the Lambert-$W$ function to solve it symbolically.

$y = xe^x$ gives $x = W(y)$.

You may run solve(x*exp(x)-y,x) on SymPy Live as an alternative to SageMath.

screenshot of sympy


It can be solved by inventing new functions, but it cannot be solved in closed form using trigonometric, logarithmic or exponential etc. Read this: Chow, Timothy Y. (May 1999), "What is a Closed-Form Number?"


As indicated in the comments and in another answer, there is a special function that has been defined which can serve as an inverse here. However, this doesn't address your basic question, which is: why is this necessary?

Before I talk about that, let me say something about $\ln x$ and $e^x$. Those are both transcendental functions, and they're inverses of each other, but neither is really defined simply to be the inverse of the other. Both of these functions arise very naturally, each on their own. The natural log function is the integral of $x^{-1}$, for a suitably defined integral, and the exponential function is the solution of a differential equation modeling the simplest kind of constant relative growth. They end up being inverses of each other, and that's a cool set of facts to understand and wonder at.

Anyway, you can't use elementary functions to invert lots of things, such as $f(x)=xe^x$. This often happens when we mix different types of functions together. The functions $g(x)=x$ and $h(x)=e^x$ are perfectly invertible, and they are, respectively, polynomial and exponential. The function $f=gh$, on the other hand, is the product of a polynomial function with an exponential function. We expect that to be more complicated. It's not solvable, with the usual algebraic methods, because whatever technique we apply to simplify $e^x$ messes up the polynomial part. Similarly, if you try to solve $e^x(x^2-x)=k$, anything you do to simplify the polynomial part will just make an exponential mess.

It's the blending of different types of functions, which are amenable to transforming with completely different tools, that makes such functions complicated. Other notorious examples include $\frac{\sin x}{x}$, and $e^{x^2}$. It's not always that they're hard to invert, but try doing integral calculus with such functions!