Evaluate $\int_0^e{W(x)}\,\mathrm{d}x$ 
The function $W(x)$ satisfies $W(x)e^{W(x)}=x$ for all $x$. Evaluate $$\int_0^e{W(x)}\,\mathrm{d}x$$

I tried integrating $xe^{-W(x)}$ but can't see how to do it. 
 A: Integrate by parts with $u=W(x)$ and $\mathrm{d}v=\mathrm{d}x$
$$\int{W(x)}\,\mathrm{d}x=xW(x) - \int xW'(x)\,\mathrm{d}x=xW(x)-\int W(x)W'(x)e^{W(x)}\,\mathrm{d}x$$
Integrate by parts again with $u = W(x)$ and $\mathrm{d}v=W'(x)e^{W(x)}\,\mathrm{d}x$
$$\int W(x)W'(x)e^{W(x)}\,\mathrm{d}x=W(x)e^{W(x)} - \int W'(x)e^{W(x)}\,\mathrm{d}x=W(x)e^{W(x)}-e^{W(x)}$$
So $$\int{W(x)}\,\mathrm{d}x=xW(x) -W(x)e^{W(x)}+e^{W(x)}=x\left(W(x)-1+\frac{1}{W(x)}\right)$$
Note that $W(e) = 1$ and $W(0)=0$ and $\displaystyle{\lim_{x\to 0}\frac{x}{W(x)}=1}$ 
$$\left|x\left(W(x)-1+\frac{1}{W(x)}\right)\right|_0^e=e\left(W(e)-1+\frac{1}{W(e)}\right) - \left(\lim_{x\to 0}\frac{x}{W(x)}\right) = e-1$$
A: Let $u = \mbox{W}(x)$. Then the defining equation $\mbox{W}(x) e^{\mbox{W}(x)} = x$ becomes $u e^u = x$ so that $dx = (u + 1)e^u \, du$. 
For the limits of integration, when $x = 0, u= \mbox{W}(0)$. From the defining equation we have $\mbox{W}(0) e^{\mbox{W}(0)} = 0 \Rightarrow x = 0$. Also, when $x = e, u = \mbox{W}(e)$ and from the defining equation we have $\mbox{W}(e) e^{\mbox{W}(e)} = e \Rightarrow \mbox{W}(e) = 1$. Thus
\begin{align*}
\int^e_1 \mbox{W}(x) \, dx &= \int^1_0 u (u + 1) e^u \, du\\
&= \big{[} e^u (u^2 - u + 1) \big{]}^1_0 \quad \mbox{(by parts)}\\
&= e - 1
\end{align*}
Comment: The function $\mbox{W}(x)$ is nothing more than the principal branch of the Lambert W function, $\mbox{W}_0 (x)$. 
A: The relation $W(x) e^{W(x)}=x$ means you want to manipulate the integrand in a way which makes an "x" term pop up, which you can then replace with the more complicated expression.  You then want this to open up a substitution which gives you a standard integral to evaluate.
An integration by parts is in order.
