In a first course of calculus, we have very specific rules for dealing with functions in the form of a sum, a difference, a product and a quotient. And now, we’re about to throw a curve ball at you:
What is the derivative of the function $f(x)=x^{x^x}$?
Intrigued? Well, it’s time to learn more! For we can assure you there’s a whole world that haven’t been much explored before!
Table of Contents
Review: Differentiating $\boldsymbol{x}^{\boldsymbol{x}}$
While polynomial (e.g., $x^3$) and exponential functions (e.g., $\pi^x$) both have relatively easy derivatives, such is not the case with functions such as $x^x$, where the variable occurs both in the base and in the exponent. However, there is a standard trick in these cases, which is to apply logarithm and exponentiation (of the same base, and in that order) to the original function, subsequently turning it into an equivalent function which then can be differentiated later.
In the case of $f(x)=x^x$, applying logarithm and exponentiation (with base $e$) yields the following equation:
$$x^x=e^{\ln{(x^x)}}$$
This is a valid step, and is warranted by the fact that natural logarithm and natural exponentiation are inverse operations. Note, however, that the result is only applicable insofar as $x^x>0$ (e.g., if we restrict the domain of $x^x$ to only the positive numbers).
And since $\ln{(x^x)} = x\ln{x}$ (by the power rule of logarithm), we also have that:
$$e^{\ln{(x^x)}}=e^{x\ln{x}}$$
In other words, assuming that $x>0$, the functions $x^x$ and $e^{x\ln{x}}$ can be used interchangeably, so that differentiating the former is akin to differentiating the latter, which in turn can be carried out through a combination of chain rule and product rule:
$$(e^{x\ln{x}})’=e^{x\ln{x}}(x\ln{x})’=e^{x\ln{x}}[(x)’\ln{x}+x(\ln{x})’]=e^{x\ln{x}}[\ln{x}+1]$$
And since $x^x$ and $e^{x\ln{x}}$ are equivalent functions (again, assuming that $x>0$), replacing each occurrence of $e^{x\ln{x}}$ back into $x^x$, we get:
$$(x^x)’=x^x(\ln{x}+1)$$
Moral of the story? Much like the same way differentiating $a^x$ makes an additional multiplier pop out (i.e., $\ln{a}$), differentiating $x^x$ also makes an additional term pop out (in this case, $\ln{x}+1$).
Summary
The derivative of $x^x$ is $x^x(\ln{x}+1)$, for any $x>0$.
Note that the derivative of $x^x$ can also computed (albeit in a roundabout fashion) using the so-called logarithmic differentiation, as Sal illustrated here in this video:
Alternatively, the same derivative can also be obtained using the Exponent Rule, a powerful differentiation rule for handling generalized powers.
Disambiguation: What is $\boldsymbol{x}^{\boldsymbol{x}^{\boldsymbol{x}}}$?
Before going on any further though, it’s imperative for us to determine what the expression $x^{x^x}$ actually refers to. For example, when we say $2^{1^2}$, are we talking about ${(2^1)}^2$? Or maybe $2^{(1^2)}$? To be sure, when the parentheses are on the left, we get ${(2^1)}^2$, which is equal to $2^2=4$, but when the parentheses are on the right, we get $2^{(1^2)}$, which is equal to $2^1=2$.
Oops. Not the same at all! 😳
In other words, whereas addition and multiplication are both associative (i.e., $(a+b)+c=a+(b+c), (ab)c=a(bc)$), the same is not true for exponentiation, which could result in a potential misuse of notation if we allow ourselves to be a bit sloppy:
$${(a^b)}^c \ne a^{(b^c)}$$
An immediate corollary from this would be that the parentheses constitute a necessary component in preserving the well-defineness of expressions involving several exponentiation operators. However, because humans are generally terrible in parsing symbols (and prefer to avoid them altogether if possible), there is a convention out there which stipulates that when no parenthesis is written, we may assume that they are on the right-hand side. That is:
$a^{b^c}\stackrel{def}{=}a^{(b^c)}$ ; $a^{b^{c^d}}\stackrel{def}{=}a^{({b^{({c^d})}})}$ ; $\ldots$
Translation
When the parentheses are on the left (e.g., ${(a^b)}^c$), they cannot be dropped.
There is yet another source of ambiguity that needs to be addressed. That is, what happens when $x$ is not positive (e.g., $x=-\frac{1}{2}$)? You see, the problem is that $(-\frac{1}{2})^{-\frac{1}{2}}=\frac{1}{({-\frac{1}{2}})^{\frac{1}{2}}}=\frac{1}{\sqrt{-\frac{1}{2}}}$, so it cannot be defined without throwing in some complex numbers. Let alone $(-\frac{1}{2})^{{-\frac{1}{2}}^{-\frac{1}{2}}}$…
To prevent potential complications with negative bases, it is therefore customary to restrict the domain of $x^{x^x}$ to $\mathbb{R}_+$ — the set of positive real numbers.
In fact, this will be our de-facto domain for any function of the form $x^{x^{x^x\dots}}$.
Recap
For functions such as $x^{x^{x^x\dots}}$, it’s generally assumed that $x>0$ and that parentheses are placed on the right — unless otherwise specified.
Derivative of ${(\boldsymbol{x}^{\boldsymbol{x}})}^{\boldsymbol{x}}$
Now that we have cleared out some potential roadblocks, we can proceed to differentiate ${(x^x)}^x$ — using the same technique we employed in differentiating $x^x$.
First, turning ${(x^x)}^x$ into an equivalent exponential function, we get:
$${{(x^x)}^x}=e^{\ln{[{(x^x)}^x}]}=e^{x\ln{(x^x)}}$$
Differentiating the equivalent exponential function using a combination of chain rule and product rule yields:
\begin{align*} (e^{x\ln{(x^x)}})’ & = e^{x\ln{(x^x)}}(x\ln{(x^x)})’ \\ & =e^{x\ln{(x^x)}}[\ln(x^x)+x\frac{1}{x^x}(x^x)’]\end{align*}
Since we found earlier that $(x^x)’=x^x(\ln{x}+1)$, we have:
\begin{align*} (e^{x\ln{(x^x)}})’ & = e^{x\ln{(x^x)}}[\ln(x^x)+x\frac{1}{x^x}(x^x)(\ln{x}+1)] \\ & = e^{x\ln{(x^x)}}[\ln(x^x)+x(\ln{x}+1)] \end{align*}
Finally, replacing each occurrence of $e^{ x\ln{(x^x)} }$ back into ${{(x^x)}^x}$, we get:
\begin{align*} ({{(x^x)}^x})’ & = {{(x^x)}^x}[\ln(x^x)+x(\ln{x}+1)] \\ & = {{(x^x)}^x}[x\ln{x}+x\ln{x}+x)] \end{align*}
Finally, simplifying further yields…
$$({{(x^x)}^x})’={{(x^x)}^x}x(2\ln{x}+1)$$
Neat. Moving on!
Derivative of $\boldsymbol{x}^{(\boldsymbol{x}^\boldsymbol{x})}$
Same drill. First:
$$x^{(x^x)}=e^{\ln{[x^{(x^x)}]}} = e^{(x^x)\ln{x}}$$
Second, differentiate:
\begin{align*}[e^{(x^x)\ln{x}}]’ & = [e^{(x^x)\ln{x}}]{[(x^x)\ln{x}]}’ \\ & =[e^{(x^x)\ln{x}}] [(x^x)’\ln{x}+(x^x)\frac{1}{x}] \end{align*}
Third, expand $(x^x)’$ and simpify:
\begin{align*} [e^{(x^x)\ln{x}}]’ & = [e^{(x^x)\ln{x}}] [(x^x)(\ln{x}+1)\ln{x}+\frac{x^x}{x}] \\ & =[e^{(x^x)\ln{x}}] [(x^x)(\ln{x}+1)\ln{x}+x^{x-1}] \end{align*}
Finally, replace each occurrence of $e^{(x^x)\ln{x}}$ back into $x^{(x^x)}$:
$$(x^{(x^x)})’ = (x^{(x^x)})[(x^x)(\ln{x}+1)\ln{x}+x^{x-1}]$$
Got it!
Note that alternatively, the derivative can also be computed again using logarithmic differentiation, as Sal illustrated in this video:
Summary
Given that $x>0$, the derivative of ${{(x^x)}^x}$ is ${{(x^x)}^x}x(2\ln{x}+1).$ The derivative of $x^{(x^x)}$ is a bit longer though.
Tetration and Related Concepts
So this leads us to the natural question: what about $x^{x^{x^x}}$? Or maybe ${({(x^x)}^x)}^x$? But first of all, we can’t be writing $x$ forever can’t we? And even if you can, it would be hard for us to type them out with all the coding…
With that in mind, let’s introduce a new notation — a new shorthand specifically geared towards iterated exponentiation:
$$\displaystyle ^nx \stackrel{def}{=} \underbrace{x^{x^{x^x\ldots}}}_{n \text{ times}} \quad (x>0, n \in \mathbb{N}) $$
For example. $^1x = x$, $^2\pi = \pi^\pi$, $^33.5=3.5^{3.5^{3.5}}=3.5^{(3.5^{3.5})}$, and $^4x=x^{x^{x^x}}=x^{(x^{(x^x)})}$ (remember that by convention, the parentheses are on the right by default).
The advantage of this notation, is that it comes in handy when we wish to talk about functions of the form $f(x)= {^n}x= \underbrace{x^{x^{x^x\ldots}}}_{n \text{ times}}$, which we shall henceforth refer to as hyperexponential functions. That is, they go beyond the exponential functions, and are constructed through an algebraic operation called tetration (i.e., the fourth hyperoperation — after addition, multiplication and exponentiation):
\begin{align*} x + n & \stackrel{def}{=} x + \underbrace{1 +1+\ldots +1}_{n \text{ times}}\\ x \times n & \stackrel{def}{=} \underbrace{x + x + \ldots + x}_{n \text{ times}} \\ x^n & \stackrel{def}{=} \underbrace{x \times x \times \ldots \times x}_{n \text{ times}} \end{align*}
In fact, we’ve already learnt that:
$({^1}x)’ = x’ = 1$
$({^2}x)’ = {(x^x)}’ = {^2}x(\ln{x}+1)$
$({^3}x)’ = {(x^{x^x})}’ = {^3}x[{^2}x(\ln{x}+1)\ln{x}+x^{x-1}]$
So the question becomes: is there a neat, general formula for $({^n}x)’$? Well, there is definitely one, but whether it’s neat is up for debate…
To see how, note that ${^n}x=e^{\ln{({^n}x})}=e^{({^{n-1}}x) \ln{x}}$. This means that after differentiation, we can express the derivative of ${^n}x$ is terms of the derivative of ${^{n-1}x}$. So a recursive formula for the derivative of ${^n}x$ is in order:
$$({^n}x)’={^n}x [({^{n-1}}x)’ \ln{x} + ({^{n-1}}x) \frac{1}{x}]$$
In particular, when $n=4$, we get:
$$({^4}x)’={^4}x [({^{3}}x)’ \ln{x} + ({^{3}}x) \frac{1}{x}]$$
Using the fact that $({^3}x)’ = {^3}x[{^2}x(\ln{x}+1)\ln{x}+x^{x-1}]$, we obtain a close-form expression for the derivative of ${^4}x$:
$$({^4}x)’={^4}x \{{^3}x[{^2}x(\ln{x}+1)\ln{x}+x^{x-1}] \ln{x} + ({^{3}}x) \frac{1}{x}\} $$
And this is also how we can figure out $({^5}x)’$, $({^6}x)’$ — or $({^{666}}x)’$, for that matter.
Recap
The derivative of ${^n}x$ can be determined recursively for all $n \in \mathbb{N}$, but it gets longer every time.
And of course, the show doesn’t stop here either. In fact, by iterating a series of tetrations, the fifth hyperoperation — pentation — can be developed as well, leading to even more fancy mathematical goodness!
Wow! That’s so out there that it literally blows my mind! 8)
Hope you’re still fine. Let’s just call that “derivatives gone wild.” 🙂
Thank you for this detailed post!
For the first deriv of nth tetration of x, namely in latex ${^{n}x}$,
I get:
\[(1/x) \left( \sum_{j=0}^{n-1}(\ln x)^{n-j-1} \prod_{\substack{j\le i \le n \\ x\neq 0,1}}^{n} {^{i}x} \right) \]
which can be proved by induction from the recurrence relation.
Hi Eric. Interesting insight! Thanks.