I'm trying to find $\int x^x \, dx$, but the only thing I know how to do is this:

Let $u=x^x$.

$$\begin{align} \int x^x \, dx&=\int u \, du\\[6pt] &=\frac{u^2}{2}\\[6pt] &=\dfrac{\left(x^x\right)^2}{2}\\[6pt] &=\frac{x^{2x}}{2} \end{align}$$

But it's certain that this isn't the correct way to evaluate that, and the answer must be wrong.

  • 58
    $\begingroup$ If $u=x^x$, then $du$ is not equal to $dx$, and there lies your mistake. $\endgroup$ Commented May 5, 2012 at 11:47
  • 5
    $\begingroup$ You forgot to compute $du$ in terms of $dx$. Further, after solving an indefinite integral, it's ofter good idea to check it, deriving. $\endgroup$
    – leonbloy
    Commented May 5, 2012 at 11:47
  • 2
    $\begingroup$ When you do a variable substitution, you also need to find the relationship between $dx$ and $du$. You can't simply replace one with another. As for this integral, it doesn't have a solution in terms of elementary functions. $\endgroup$ Commented May 5, 2012 at 11:51
  • 3
    $\begingroup$ A related question. $\endgroup$ Commented May 5, 2012 at 12:15
  • 27
    $\begingroup$ "Solve" in the title is the wrong word. That mistake is almost universal in this forum. One solves equations; one solves problems. One evaluates or finds expressions. $\endgroup$ Commented May 5, 2012 at 16:47

8 Answers 8


As noted in the comments, your derivation contains a mistake.

To answer the question, this function can not be integrated in terms of elementary functions. So there is no "simple" answer to your question, unless you are willing to consider a series approximation, obtained by expanding the exponential as a series:

$$\int{x^xdx} = \int{e^{\ln x^x}dx} = \int{\sum_{k=0}^{\infty}\frac{x^k\ln^k x}{k!}}dx$$

  • 1
    $\begingroup$ I'm not as advanced as you. How did you know that series is the one for that problem? $\endgroup$
    – yiyi
    Commented May 8, 2012 at 2:09
  • 18
    $\begingroup$ Just use the series for $e^x$, and substitute. $\endgroup$ Commented May 8, 2012 at 3:51
  • 1
    $\begingroup$ I think i will search more on this site careful first. $\endgroup$
    – yiyi
    Commented May 8, 2012 at 11:44
  • 3
    $\begingroup$ Isn't the last summation to start from $k=0$? $\endgroup$
    – snoram
    Commented Jul 12, 2016 at 20:04
  • 2
    $\begingroup$ @Vedvart1 It's an infinity sum. Splitting it up could lead to trouble. $\endgroup$
    – Olba12
    Commented Sep 11, 2017 at 14:15

If you are willing to put bounds on your integral, it is possible to compute that $$\int_0^1 x^x\,dx = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n^n}.$$ Indeed, if you start like nbubis suggests, and make the substitution $u = -\log x$, you get that $$\int_0^1 x^x\,dx = \sum_{k=0}^\infty \frac{1}{k!}\int_0^1x^k(\log x)^k\,dx = \sum_{k=0}^\infty \frac{(-1)^k}{k!}\int_0^\infty e^{u(k+1)}u^k\,du$$$$ = \sum_{k=0}^\infty \frac{(-1)^k}{k!}\frac{1}{(k+1)^k}\int_0^\infty e^{u(k+1)}[(k+1)u]^k\,du.$$ If you then make the substitution $t = (k+1)u$ this becomes $$\sum_{k=0}^\infty \frac{(-1)^k}{k!}\frac{1}{(k+1)^k}\int_0^\infty e^tt^k\,dt = \sum_{k=0}^\infty \frac{(-1)^k}{(k+1)!}\frac{1}{(k+1)^k}\Gamma(k+1),$$ where $\Gamma$ is the usual Gamma function. Since $\Gamma(k+1) = k!$, the final expression is $$ \sum_{k=0}^\infty \frac{(-1)^k}{(k+1)^{k+1}} = \sum_{n=1}^\infty \frac{(-1)^{n-1}}{n^n}.$$ Similarly you can derive $\int_0^1 x^{-x}\,dx = \sum_{n=1}^\infty n^{-n}$. In don't think any further simplification is possible.

  • 1
    $\begingroup$ This is nice. I like these kinds of answers. This gives, essentially, $$\int_0^1 x^{-zx}\,dx = \sum_{n=1}^{\infty} \frac{z^{n-1}}{n^n}.$$ $\endgroup$ Commented May 9, 2012 at 6:51
  • 7
    $\begingroup$ And slightly more generally, $\int_0^1 x^{r-zx}\ dx = \sum_{n=1}^\infty \dfrac{z^{n-1}}{(r+n)^n}$ for $r > -1$. $\endgroup$ Commented May 9, 2012 at 7:59
  • 7
    $\begingroup$ These identities for $\int_0^1 x^{-x}\ dx$ and $\int_0^1 x^x\ dx$ are sometimes called the "sophomore's dream". Look that up on Wikipedia. $\endgroup$ Commented May 9, 2012 at 8:04
  • $\begingroup$ How do you know it's legal to switch the summation and the integral? I know you can do it with finite sums but I thought there were certain conditions under which it invalid to switch them. $\endgroup$
    – sam-pyt
    Commented Nov 20, 2019 at 13:00
  • $\begingroup$ @sam-pyt late reply but you determine if they are switchable by testing if they satisfy Fubini's theorem and/or the dominated convergence theorem $\endgroup$
    – Max0815
    Commented Nov 29, 2021 at 14:28

let ${x}^{x} = {\left({e}^{\ln {x}} \right)}^{x} = {e}^{x \ln {x}}. $

By the series expansion of ${e}^{x}$: $${e}^{x \ln {x}} = \sum _{ n=0 }^{ \infty }{ \frac { { \left( x \ln{x} \right) }^{ n } }{ n! } }$$

Thus $$\int _{ 0 }^{ 1 }{ { x }^{ x } } dx=\sum _{ n=0 }^{ \infty }{ \int _{ 0 }^{ 1 }{ \frac { { { x }^{ n }\left( \ln {x} \right) }^{ n } }{ n! } } }=\sum _{ n=0 }^{ \infty }{ \frac { 1 }{ n! } \int _{ 0 }^{ 1 }{ { x }^{ n } } { \left( \ln { x } \right) }^{ n }dx }$$

Let $u = {\left(\ln {x} \right)}^{n} $, $dv = {x}^{n} dx $, $du = \frac{{n \left(\ln {x} \right)}^{n-1}}{x} dx$ and $v=\frac{{x}^{n+1}}{n+1}$, then using integration by parts, we arrive at

$$\lim _{ a\rightarrow 0 }{ \int _{ a }^{ 1 }{ { x }^{ n } } { \left( \ln { x } \right) }^{ n }dx } =\lim _{ a\rightarrow 0 }{ { \left[ \frac { { x }^{ n+1 } }{ n+1 } { \left( \ln { x } \right) }^{ n } \right] }_{ a }^{ 1 } } -\lim _{ a\rightarrow 0 }{ \int _{ a }^{ 1 }{ { \frac { n }{ n+1 } x }^{ n } } { \left( \ln { x } \right) }^{ n-1 } } dx$$

which becomes $$\lim _{ a\rightarrow 0 }{ \int _{ a }^{ 1 }{ { x }^{ n } } { \left( \ln { x } \right) }^{ n }dx } =-\int _{ 0 }^{ 1 }{ { \frac { n }{ n+1 } x }^{ n } } { \left( \ln { x } \right) }^{ n-1 }dx = \frac{{(-1)}^{n}n!}{{(n+1)}^{n+1}}$$

Therefore $$\int _{ 0 }^{ 1 }{ { x }^{ x } } dx=\sum _{ n=1 }^{ \infty }{ \frac { { \left( -1 \right) }^{ n-1 } }{ { n }^{ n } } }$$

  • 3
    $\begingroup$ As to the content, you didn't answer the question, for it was asking about the indefinite, not the definite, integral. $\endgroup$
    – Lord_Farin
    Commented Jan 3, 2015 at 10:09

On can find a compendium of properties of the special function : $$\text{Sphd}(\alpha\:;\:x)=\int_0^x t^{\alpha\:t}dt$$ and the particular case : $$\int x^x dx = \text{Sphd}(1\:;\:x) +\text{constant}$$ in https://fr.scribd.com/doc/34977341/Sophomore-s-Dream-Function


The integral $\int{x^x}{dx}$ can be expressed as a double series. I asked about this series form here and the answers there show it is correct and my own answer there shows you can differentiate this back to get a power series for $x^x$: $$ \int{x^x}{dx}=\sum _{n=1}^{\infty } \sum _{k=0}^{n-1} \frac{x^n \log ^k(x) (-1)^{1+n+k}}{n^{n-k}\ k!} $$

  • $\begingroup$ Note this is valid for $x>0 \land x\neq1$. The antiderivative $\int{x^{-x}dx}$ is very similar: $$\int{x^{-x}}{dx}=\sum _{n=1}^{\infty } \sum _{k=0}^{n-1} \frac{x^n \log ^k(x) (-1)^{k}}{n^{n-k}\ k!}$$ $\endgroup$
    – flinty
    Commented Oct 10, 2020 at 15:21

Many people have pointed out that the integral you are looking for is equivalent to,

$$\sum_{n}^{\infty} \frac{1}{n!} \int_{0}^{x}x^{n}\ln(x)^ndx$$

But the integral within this equation can be simplified to

$$ \int_0^x x^n \ln(x)^ndx = (-1)^n (n+1)^{-1-n} \Gamma \left(n+1,(n+1)\ln \left(\frac{1}{x}\right)\right) $$


$$ \Gamma \left(n+1,\left(n+1\right)\ln \left(\frac{1}{x}\right)\right) = n! e^{(n+1)\ln(x)} \sum_{k=0}^{n} \frac{(n+1)^k \ln \left(\frac{1}{x}\right)^k}{k!} $$

Is the incomplete Gamma function. Simplify the first equation, and you will get,

$$ \int_0^x x^x dx = \sum_{n=0}^\infty \frac{(-1)^n \Gamma \left(n+1,-(n+1) \ln({x})\right)} {n!(n+1)^{n+1}} $$

A demonstration of this function may be found on the desmos graphing calculator: https://www.desmos.com/calculator/2nfxrv0iba

  • $\begingroup$ this is very ambiguous notation in the latter line when you integrate x^x with bounds 0 and x $\endgroup$ Commented Nov 4, 2022 at 11:30

I will prove that $x^x$ has no elementary antiderivative, as many have claimed. I will use Risch's decision semi-algorithm for exponential polynomials in trascendental exponential extensions. Note that $g=x^x=\exp(x\log(x))$. We can then express our integrand as an element of the differential field $$\mathbb{Q}(x,\log(x),g)=\mathbb{Q}(x,\log(x))(g),$$ where we take $g$ as the last extension. This is, as we call it, a field of trascendental elementary functions. Then, $g$ can also be seen as a polynomial in $\mathbb{Q}(x,\log(x))[g]$, and if $g$ has an elementary antiderivative, then it has the form $\int g=q_1g$, where $q_1\in \mathbb{Q}(x,\log(x))$, and $q_1$ satisfies the Risch differential equation $$q_1'+(1+\log(x))q_1=1.$$ In this equation, $1+\log(x)$ is the derivative of the function inside the exponential $g=\exp(x\log(x))$, and the 1 on the right is the coefficient of our "monomial" $g$. To solve this equation, due to $\log(x)$ being trascendental over $\mathbb{Q}(x)$, we can equate coefficients over the polynomial ring $\mathbb{Q}(x)[\log(x)]$. Doing this we obtain $q_1'+q_1=1$ for degree 0 and $q_1=0$ for degree 1 in $\log(x)$. This is impossible, as $q_1=0$ implies $q_1'+q_1=0$. This means that $\int x^x dx$ has no elementary antiderivative.

The specific reason to take $\mathbb{Q}(x,\log(x))(g)$ as our differential field is that it is a field of trascendental elementary functions. A field of trascendental elementary functions takes as its base a field of rational functions, which could be $\mathbb{Q}(x)$, $\mathbb{R}(x)$ or $\mathbb{C}(x)$, for example. Then, we can attach a new function to this field, and if it is trascendental logarithmic or exponential over $\mathbb{Q}(x)$, it is said to be a trascendental elementary extension. For Risch's decision algorithm to work in a trascendental extension, we need that every extension of the base field be trascendental (exponential or logarithmic). As a note, the other type of elementary extension that could be presented is the algebraic extension (which is the opposite of a trascendental extension, and includes functions such as radicals).

In general, an elementary function is any function that can be seen as an element of a field of elementary functions. That is, an extension field with finite new functions over $\mathbb{Q}(x)$ such that each extension is exponential, logarithmic or algebraic over it.

  • A function $g$ is logarithmic over $F$ if there exists $f\in F$ such that $g'=f'/f$. Notation: $g=\log(f)$.
  • A function $g$ is exponential over $F$ if there exists $f\in F$ such that $g'=gf'$. Notation: $g=\exp(f)$.
  • A function $g$ is algebraic over $F$ if there exists a polynomial $p(z)\in F[z]$ such that $p(g)=0$. For example, $g=\sqrt{x}$ is algebraic over $\mathbb{Q}(x)$ because the polynomial $p(z)=z^2-x\in\mathbb{Q}(x)[z]$ is such that $p(g)=0$.

What we really proved is that $\int x^x dx$ can never be represented as a member of any field of elementary functions. Thus, it cannot be integrated in finite elementary symbols, which is why any answer to the integral requires infinitely many symbols, or a new notation. However, I obviously used some heavy results. If you want to see the proof of these results, I recommend researching differential algebra. There is a book by the name of "Algorithms for Computer Algebra" by Keith Geddes, which is very complete in regards to integration of trascendental elementary functions, and presents the proof in a very comprehensible level. Most of it is in chapters 11 and 12, but other important notions can be found in previous chapters.

  • $\begingroup$ Why should $\int g=q_1g$? This seems like a statement requiring more work to show. Note that $\exp(\cdots)$ is not a polynomial, so, there are many aspects of your answer that are unclear to me $\endgroup$
    – FShrike
    Commented Oct 20, 2023 at 0:01
  • 1
    $\begingroup$ @FShrike $\exp(x\log(x))$ is not a polynomial in $\mathbb{Q}[x]$, which means that it is not a polynomial over the variable $x$. It is, however, a polynomial over the variable $g$. The reason why $\int g=q_1g$ is a result of the way "polynomials" in an exponential variable behave, which is in turn a consequence of a big result called "Liouville's principle". As I mentioned at the end of my answer, there are a lot of details that I left out because a whole book is needed to explain them. That is the reason why it's hard to come across of a proof that an integral is non-elementary. $\endgroup$ Commented Oct 20, 2023 at 0:17

Start from the opposite task.

If $\displaystyle \int x^x \, dx=F(x)$ then $\displaystyle F'(x)=x^x$

First we need to find asymptotic evaluation of the integral. Let us take it in the form


So it has to be:


From there it is sufficient to take $g(x) \sim \frac{1}{1+\ln(x)}$

So we can start our journey:


If you calculate the derivative of this you have


For the purpose of cancellation if it best to take




Now we continue using the steps that are revealing the integral structure.


Take derivative once more and you have got $$f(x\ln(x))=\frac{1}{x(1+\ln(x))^3}-f'(x\ln(x))$$ or $$F(x)=x^x(\frac{1}{\ln(x)+1}+\frac{1}{x(\ln(x)+1)^3}-f'(x\ln(x)))$$

We can then write:



$$\displaystyle f_{n}=-\frac{f_{n-1}'}{1+\ln(x)},\,f_0=\frac{1}{1+\ln(x)}$$

From $x=0$ to $1$ you can use probably more suitably $F(x)=xg(\ln(x))$

The derivation is similar to the one given above.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .