# Derivative of $x^{x^x}$

I need to compute the derivative of $$z=x^{x^x}$$

$$y=x^x$$ so $$z=y^x$$ then $$\ln(z)=x\ln(y)$$ taking derivative from both sides: $$\frac{z'}{z}=\ln(y)+x\left(\frac{1}{y}\right)y'$$ I know that $$(x^x)'=x^x(1+\ln(x))$$ So : $$z'=z*(\ln(x^x)+x*\left(\frac{1}{x^x}\right)*(x^x)'))=x^{x^x}(x\ln(x)+x\ln(x)+x)=x^{x^x}\left(2x\ln(x)+x\right)$$ I know I did something wrong. Where is my Mistake??

Thanks alot!

• $\ln(z)=y\ln x$ not $\ln(z)\neq x\ln y$ Feb 12, 2017 at 21:21
• This is a nice one with the multivariate chain rule Feb 12, 2017 at 21:22
• Ok Ive edited $$z=y^x$$ => $$ln(z)=xln(y)$$ Feb 12, 2017 at 21:33
• A key error, which Daniel Nieuwerf points out in his answer, but which may not be clear is that if $y = x^x$, then $z = x^y \ne y ^x$. Indeed $y^x = (x^x)^x = x^{x\cdot x} = x^{(x^2)}$.Not the same thing at all, except when $x = 2$ (or $1$ or $0$, but for other reasons).. Feb 13, 2017 at 2:19

What if you represented your function as

$f(x) = x^{x^x} = \exp(x^x \cdot \ln x) = \exp(\,\exp(x\ln(x)) \cdot \ln x \, )$

Then you can apply the chain rule with the product rule.

• Definitely how you should do it. Feb 12, 2017 at 22:53

It's $z=x^y$ not $z = y^x$ so $z= y\ln x$ not $z = x\ln y$

Here is the fancy way you would do it with multi-variate chain rule:

Let

$u=x\\v=x\\w=x\\y=u^v\\z=w^y$

We then have

\begin{align}\frac d{dx}z&=\frac{\partial z}{\partial w}\frac{dw}{dx}+\frac{\partial z}{\partial y}\frac{dy}{dx}\\&=yw^{y-1}+\ln(w)w^y\left(\frac{\partial y}{\partial u}\frac{du}{dx}+\frac{\partial y}{\partial v}\frac{dv}{dx}\right)\\&=x^x+\ln(x)x^x\left(vu^{v-1}+\ln(u)u^v\right)\\&=x^x+x^{2x}\ln(x)(1+\ln(x))\end{align}

I think your confusion stems from what you think $x^{x^x}$ means.

$x^{x^x}$ means taking $x$ to the power of $x^x$ which is distinctly different from taking $x^x$ to the power of $x$.

As an example, $3^{3^3} = 3^{(3^3)} = 3^{27}$.

$3^{3^3} \neq (3^3)^3=27^3$.

So $z \neq y^x$. Instead, $z = x^y$.

Your only mistake is that $x^{x^x}=x^{(x^x)}\ne (x^x)^x=x^{x^2}$.

As to the derivative, it's simply the chain rule and product rule. First let's do

$$\frac{dx^x}{dx} = \frac{de^{x\ln x}}{dx} = x^x \left(x \frac{d\ln x}{dx} + \ln x\right) = x^x(1 + \ln x).$$

Then we can do the rest:

$$\frac{d x^{x^x}}{dx} = \frac{de^{x^x\ln x}}{dx} = x^{x^x}\left(x^x \frac{d\ln x}{dx} + \ln x \frac{d x^x}{dx}\right) = x^{x^x} \left[x^{x-1} + x^x(\ln x+\ln^2 x)\right].$$

Here is how I did it:

$f(x)=x^{x^x}$

$\ln f(x)=x^x\ln x$

$\ln \ln f(x)=\ln{x^x \ln x}=x\ln x+\ln \ln x$

Now I derive both sides:

$\frac{(\ln f(x))'}{\ln f(x)}=\ln x +1+\frac{(\ln x)'}{\ln x}$

using the fact that $(\ln f(x))'=\frac{f'(x)}{f(x)}$, we get:

$\frac{\frac{f'(x)}{f(x)}}{\ln f(x)}=\ln x +1 +\frac{1}{x\ln x}$, and equivalently:

$\frac{f'(x)}{f(x)\ln f(x)}=\ln x +1 +\frac{1}{x\ln x}$. Multiplying by $f(x)\ln f(x)$ both sides and using the fact that $f(x)=x^{x^x}$, we get that:

$f'(x)=x^{x^x}\ln x^{x^x}(\ln x+1+\frac{1}{x\ln x})=x^x x^{x^x}\ln x(\ln x +1 + \frac{1}{x\ln x})$. Taking $x\ln x$ into the parentheses gives

$f'(x)=x^{x-1}x^{x^x}(x\ln x +x\ln^2 x+1)=x^{x^x+x-1}(x\ln x +x\ln^2 x+1)$

Let us first establish the derivative of $x^{f(x)}$ in general.

$$\left(x^{f(x)}\right)'=\left(e^{\ln x f(x)}\right)'=\left(\frac{f(x)}x+\ln x f'(x)\right)x^{f(x)}.$$

Then

$$(x^x)'=\color{blue}{\left(1+\ln x\right)x^{x}}$$

and

$$\left(x^{x^x}\right)'=\left(\frac{x^x}x+\ln x \color{blue}{\left(1+\ln x\right)x^{x}}\right)x^{{x^x}}=\color{green}{\left(\frac1x+\ln x+\ln^2x\right)x^xx^{x^x}}.$$

While we are at it:

$$\left(x^{x^{x^x}}\right)'=\left(\frac{x^{x^x}}x+\ln x \color{green}{\left(\frac1x+\ln x+\ln^2x\right)x^xx^{x^x}}\right)x^{x^{x^x}}.$$