# How to find $\int x^{1/x}\mathrm dx$

EDIT: The full answer has been posted by myself. Feel free to check the logic within.

How does one indefinitely integrate a function in the form of $$f(x)=x^{1/x}$$ Looking at all the things that I know there is nothing about exponents with variables. So how does one find: $$\int x^{1/x}\;\mathrm dx?$$ I am more interested in the technique for doing so rather than the solution as it is of no real significance but merely a curiosity.

-
Wolfram alpha says it can't be done in terms of elementary functions. –  AWertheim Aug 3 '13 at 23:04
@AWertheim: And, as far as Wolfram's system can tell, none in terms of any other functions it recognizes either. –  mike4ty4 Aug 3 '13 at 23:05
A series expansion can be used, however, despite there being no finite formula. –  mike4ty4 Aug 3 '13 at 23:06
Everything looks good through the fourth line of the long equality. How do you get to the fifth line? That is, $$\sum_{n=0}^\infty\frac{2F_n}{n!x^n}+C$$ –  robjohn Oct 28 '13 at 16:43
@robjohn I think that is where my mistake lies –  Alizter Oct 28 '13 at 17:12

(I included a more general intro in the first version of this answer, but then I noticed the question has been updated to include a beginning of the series derivation)

For the infinite series approach:

As you mention,

$$x^{1/x} = \sum_{n=0}^{\infty} \frac{\log(x)^n}{x^n n!}.$$

To integrate the terms, we can apply integration by parts. Take

$$\int \frac{\log(x)^m}{x^n} dx.$$

The reason that we have two separate exponents $m$ and $n$ will be clear soon. Let $u = \log(x)^m$, $dv = \frac{1}{x^n} dx$, so that $v = \frac{1}{(1-n) x^{n-1}}$ and $du = \frac{m \log(x)^{m-1}}{x}$. Then,

\begin{align}\int \frac{\log(x)^m}{x^n} dx &= uv - \int v\ du \\ &= \frac{\log(x)^m}{(1 - n) x^{n-1}} - \int \frac{m \log(x)^{m-1}}{x (1-n) x^{n-1}} dx \\ &= \frac{\log(x)^m}{(1 - n) x^{n-1}} - \frac{m}{1-n} \int \frac{\log(x)^{m-1}}{x^n} dx. \end{align}

Let $I_{m,n} = \int \frac{\log(x)^m}{x^n} dx$. Then the above can be written as a recurrence relation

$$I_{m,n} = \frac{\log(x)^m}{(1 - n)x^{n-1}} - \frac{m}{1-n} I_{m-1,n}$$

with $I_{0,n} = \frac{1}{(1-n) x^{n-1}}$ for $n \ne 1$, and $I_{0,1} = \log(x)$. Note that to express the integral in this recurrent form required us to have a separate $m$-exponent.

The solution to a recurrence of the form

$$a_m = r_m a_{m-1} + s_m$$

with $a_0 = s_0$, is given by

$$a_m = \sum_{l=0}^{m} s_{l} \left(\prod_{k=l+1}^{m} r_k\right).$$

(This can be obtained by pattern recognition and proven by substitution into the original recurrence.)

Let $r_m = -\frac{m}{1 - n}$ and $s_m = \frac{\log(x)^m}{(1 - n) x^{n-1}}$ to get

\begin{align}I_{m,n} &= \sum_{l=0}^{m} \frac{\log(x)^l}{(1 - n) x^{n-1}} \left(\prod_{k=l+1}^{m} -\frac{k}{1 - n}\right) \\ &= \sum_{l=0}^{m} \frac{\log(x)^l}{(1 - n) x^{n-1}} \left((-1)^{m-l} \frac{m!}{l! (1-n)^{m-l}}\right) \\ &= \frac{1}{x^{n-1}} \sum_{l=0}^{m} (-1)^{m-l} \frac{m! \log(x)^l}{l! (1-n)^{m-l+1}}\end{align}

for $n \ne 1$. We are only interested in $I_{n,n}$, so for $n = 1$, we take

$$I_{1,1} = \frac{\log(x)^2}{2}$$

and

$$I_{0,0} = x$$ $$I_{n,n} = \frac{1}{x^{n-1}} \sum_{l=0}^{n} (-1)^{n-l} \frac{n! \log(x)^l}{l! (1-n)^{n-l+1}},\ n > 1.$$

Then,

\begin{align} \int x^{1/x} dx &= C + \sum_{n=0}^{\infty} \frac{I_{n,n}}{n!} \\ &= C + x + \frac{\log(x)^2}{2} + \sum_{n=2}^{\infty} \left(\frac{1}{x^{n-1}} \sum_{l=0}^{n} (-1)^{n-l} \frac{\log(x)^l}{l! (1-n)^{n-l+1}}\right)\end{align}

is the infinite series expansion of the original integral. This series should converge for all $x > 0$, though doesn't work so well near $0$.

-
Thanks! Glad to help. –  mike4ty4 Aug 5 '13 at 22:28
Nice answer............ –  juantheron Oct 31 '13 at 3:36
@mike4ty4 I would like to compare our answers. As far as I can tell they are the same. Would you be as kind to double check? Thanks. –  Alizter Dec 1 '13 at 13:43
@Alitzer Hmmm... I tried calculating in your formula with $z = 2$ and $z = 1$ to get the integral from 1 to 2 and got ~0.20068, while it should be ~1.27706. So there seems to be something wrong with your formula. –  mike4ty4 Dec 2 '13 at 9:53
See the comments left on your formula. –  mike4ty4 Dec 2 '13 at 10:17

Okay after some work it's finished I hope it is correct: \begin{align}\int x^{1/x}dx&=\int \exp\left(\frac{\log x}x\right)dx=\int\sum_{n=0}^\infty\frac{\left(\log x/x\right)^n}{n!}dx=\sum_{n=0}^\infty\int\frac{\left(\log x/x\right)^n}{n!}dx\\ &=\sum_{n=0}^\infty\int\frac{\left(\log x/x\right)^n}{n!}dx = \sum_{n=0}^\infty\int x^{-n}n!^{-1}\log^nx\space dx=\sum_{n=0}^\infty n!^{-1}\int x^{-n}\log^nx\space dx\end{align} Let $u=\log x$ then $du=\frac1xdx\implies x\;du=dx$ $$\int x^{-n}\log^nx\;dx=\int x^{-n+1}u^n\;du=\int e^{-u(n-1)}u^n\;du$$ Let $w=u(n-1)$ then $dw=(n-1)\;du\implies \frac{1}{n-1}dw=du$ $$\int e^{-u(n-1)}u^n\;du=\frac{1}{(n-1)^{n+1}}\int e^{-w}w^ndw$$ $$\int w^ne^{-w}dw=-\sum^n_{k=0}\frac{n!\;w^{n-k}}{e^w(n-k)!}=-\sum^n_{k=0}\frac{n!\;\log^{n-k}x\;(n-1)^{n-k}}{x^{n-1}(n-k)!}$$ $$\implies\int x^{-n}\log^nx\;dx=-\frac{1}{(n-1)^{n+1}}\sum^n_{k=0}\frac{n!\;\log^{n-k}x\;(n-1)^{n-k}}{x^{n-1}(n-k)!}$$

$$=-\sum^n_{k=0}\frac{n!\;\log^{n-k}x\;(n-1)^{n-k}}{x^{n-1}(n-k)!(n-1)^{n+1}}=-\sum^n_{k=0}\frac{n!\;\log^{n-k}x\;}{x^{n-1}(n-k)!(n-1)^{k+1}}$$ $$=-\frac{n!}{x^{n-1}}\sum^n_{k=0}\frac{\log^{n-k}x\;}{(n-k)!(n-1)^{k+1}}$$ $$\implies \int x^{1/x}dx=-\sum^\infty_{n=0}\sum^n_{k=0}\frac{\log^{n-k}x\;}{x^{n-1}(n-k)!(n-1)^{k+1}}+C$$

-
@robjohn It should. At the moment I am trying to compute $[0, e]$ which is proving difficult. The series are a pain to evaluate. –  Alizter Dec 1 '13 at 17:16
@Alizter: $k$ should start at $0$ $$\int w^ne^{-w}dw=-\sum^n_{k=\color{#C00000}{0}}\frac{n!\;w^{n-k}}{e^w(n-k)!}$$ –  robjohn Dec 1 '13 at 19:57
@Alizter: the plus changed to a minus $$-\sum^n_{k=\color{#C00000}{0}} \frac{n!\;\log^{n-k}x\;(n-1)^{n-k}}{x^{n-1}(n-k)!(n-1)^{n+1}} =-\sum^n_{k=\color{#C00000}{0}} \frac{n!\;\log^{n-k}x\;}{x^{n-1}(n-k)!(n-1)^{k\color{#C00000}{+}1}}$$ –  robjohn Dec 1 '13 at 20:20
At that term, one should replace that inner sum giving the divide by zero with with $-\frac{\log(x)^2}{2}$, in addition to robjohn's modifications. Then the formula works. –  mike4ty4 Dec 2 '13 at 10:06
The final formula should therefore be $$x + \frac{\log(x)^2}{2} - \sum_{n=2}^{\infty} \sum_{k=0}^{n} \frac{\log(x)^{n-k}}{x^{n-1} (n-k)! (n-1)^{k+1}}$$. –  mike4ty4 Dec 2 '13 at 10:09

There is no actual method for determining a indefinite integral because rational combinations of the elementary functions $\{x, x^2, e^x, \log(x), \text{trig functions}, \ldots\}$ which we use normally to represent integrals aren't enough to express the integral $\int x^{1/x} \,\mathrm d x$ (which is a rather interesting concept, I find). But numerical methods such as Simpson's, Boole's, Hardy's, and/or Weddle's method can be used to approximate this integral as can they for any other.

-
It is hard to prove this, though, isn't it? Or maybe one just needs to be versant in the appropriate techniques. –  Stephen Herschkorn Aug 3 '13 at 23:38
Yes, it is hard to exhaustively prove that it cannot be expressed as an elementary function. You can use the Risch algorithm but the application of that is no simple matter and is best left to a computer. –  Jon Claus Aug 3 '13 at 23:51
Yes. Good point. Though if there exists a technique, i expect there to be some sort of connection to the inverse process of logarithmic differentiation. –  Keith Afas Aug 3 '13 at 23:54