Prove $f(x)=\int\frac{e^x}{x}\mathrm dx$ is not an elementary function

How do I prove that the exponential integral $$f(x)=\int \frac{e^x}{x}\mathrm dx$$ is not an elementary function?

Also, what are the general methods and tricks to prove that an integral or solution to an equation is not an elementary function?


All we need for this is a theorem of Liouville (1835): Suppose that $f$ and $g$ are rational functions with $f\neq 0$ and $g$ non-constant. Then $$\int f(x) e^{g(x)} dx $$ is an elementary function if and only if there exists a rational function $r$ such that $ f=r'+g'r.$

Here we have $g(x)=x$ and $f(x) = 1/x.$ Assume there exists a rational function $r$ such that $ 1/x = r' + r \text{ } $ (1). Denote the multiplicity of the pole at $0$ by $m$ (where $m\geq 1$ so that both sides of (1) agree when $x\to 0$), so that $ \displaystyle r(x) = \frac{p(x)}{x^m Q(x)} $ where $p, Q$ are polynomials with no common factors and $Q$ is not divisible by $x.$

Substituting this form into (1) and multiplying both sides by $x^m$ yields $$ x^{m-1} = \frac{p(x)+ p'(x)}{Q(x)} - \frac{Q'(x) p(x) }{Q^2(x)} - \frac{m}{x Q(x)} .$$ Taking limits of both sides as $x\to 0$ illustrates the lunacy in our assumption that such a rational function exists, and hence $\displaystyle \int \frac{e^x}{x} dx$ is non-elementary.