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.


Solution 1:

(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$.

Solution 2:

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$$