# Problem with derivative of $x^{x^x}$

I was recently watching blackpenredpen’s video (found here: https://m.youtube.com/watch?v=UJ3Ahpcvmf8) where he found the derivative of the the function $$y = x^{x^x}$$. Before watching the video, I decided to try it myself, and I didn’t it this way: Firstly I decided I would use the chain rule and define two functions, $$u(x)$$ and $$v(x)$$, both of which are $$x^x$$, so I could show the function as $$u(v(x))$$. Using the chain rule, the derivative would be: $$u’(v(x))\cdot v’(x)$$. We can find the derivative of $$x^x$$ (as shown on Quora here: https://www.quora.com/What-is-the-derivative-of-x-x-How-could-I-derive-it-as-well) as $$x^x\cdot(\ln x+1)$$. Now using the chain rule to get $$u’(v(x))$$ we get $${(x^x)}^{(x^x)}\cdot(\ln {x^x}+1)$$ or $$x^{x^{x+1}}\cdot(\ln {x^x}+1)$$. This wasn’t the answer that blackpenredpen arrived at though. In the video, he arrived at $$x^x\cdot x^{x^x}\left({\frac{1}{x}+\ln x+(\ln x)^2}\right)$$. I can’t see how he did it, and I’m sure that it is right. If anyone could confirm my answer or show where I went wrong it would be greatly appreciated. Thanks.

• note that $u(v(x))=v(x)^{v(x)}=(x^x)^{x^x}$, what is not the same function. Instead try the following: $x^{(x^x)}=\exp(x^x\ln x)=\exp(e^{x\ln x}\ln x)$, now use the chain rule. – Masacroso Nov 15 '18 at 6:10
• @Masacroso Are you sure? Exponentiation is left associative so $\alpha^{\alpha^\alpha}$ = $\alpha^{(\alpha^\alpha)}$. So wouldn’t ${(x^x)}^{x^x} = {(x^x)}^{(x^x)}$? – L. McDonald Nov 15 '18 at 6:19
• Yes, that is right. But the way I (tried) to find $\frac{d}{dx}\left[{x^{x^x}}\right]$ lead me to get a ${(x^x)}^{(x^x)}$ in my answer, this is probably where I’ve gone wrong. Note: this was in response to another comment, which seems to have been deleted. – L. McDonald Nov 15 '18 at 6:28

## 2 Answers

You can apply the method given on quora to your problem: $$\left(x^{x^x}\right)'=\left(e^{x^x\ln x}\right)'=e^{x^x\ln x}\cdot \left(x^x\ln x\right)'=\\ =e^{x^x\ln x}\cdot \left(e^{x\ln x}\ln x\right)'=\\ =e^{x^x\ln x}\cdot \left[\left(e^{x\ln x}\right)'\ln x+e^{x\ln x}\cdot \frac1x\right]=\\ =x^{x^x}\cdot \left[e^{x\ln x}\left(x\ln x\right)'\ln x+x^x\cdot \frac1x\right]=\\ =x^{x^x}\cdot \left[x^x\left(\ln x+1\right)\ln x+x^x\cdot \frac1x\right]=\\ =x^{x^x}\cdot x^x\left[\ln^2 x+\ln x+\frac1x\right].$$ P.S. I could not watch the referenced video on Youtube, because it is not opening here (it might be blocked).

• Sorry about the video, he did almost exactly the same thing that you did, but might I ask, would you be able to show me where I went wrong? – L. McDonald Nov 15 '18 at 7:49
• If $u(x)=x^x, v(x)=x^x$, then $u(v(x))=(x^x)^{x^x}=x^{x^{x+1}}$, which is a different function. – farruhota Nov 15 '18 at 7:54
• Oh, I see, $u(v(x))$ would have been $x^{x^x}$ of course. That’s a bit embarrassing... – L. McDonald Nov 15 '18 at 7:56

For differentiating expressions of the form $$u(x)^{v(x)},$$ I've always found it easiest to take logarithms and then differentiate implicitly. However, rather than work with the more general form $$y = u^v,$$ I'll work with $$y = x^U$$ (i.e. use $$x$$ for the base), which is sufficient to deal with $$x^{x^x}.$$

Taking the logarithm of both sides gives

$$y = x^U \;\; \implies \ln y = \ln\left(x^U \right) \;\; \implies \;\; \ln y = U \cdot \ln x$$

Now differentiate both sides with respect to $$x$$:

$$\frac{d}{dx}\left(\ln y\right) \;\; = \;\; \frac{d}{dx}\left(U \cdot \ln x \right)$$

$$\frac{y'}{y} \;\; = \;\; \frac{d}{dx}(U) \cdot \ln x \; + \; U \cdot \frac{d}{dx} (\ln x) \;\; = \;\; U'\ln x \; + \; \frac{U}{x}$$

$$y' \;\; = \;\; y \cdot \left[ U'\ln x \; + \; \frac{U}{x} \right] \;\; = \;\; x^U \cdot \left[ U'\ln x \; + \; \frac{U}{x} \right]$$

Using this result for $$U(x) = x,$$ we get

$$\left(x^x\right)' \;\; = \;\; x^x \cdot \left[ 1 \cdot \ln x \; + \; \frac{x}{x} \right] \;\; = \;\; x^x(\ln x + 1)$$

Using that same result for $$U(x) = x^x$$ along with what we just found for $$\left(x^x\right)',$$ we get

$$\left(x^{x^x}\right)' \;\; = \;\; x^{x^x} \cdot \left[ \left(x^x\right)' \cdot \ln x \; + \; \frac{x^x}{x} \right]$$

$$\left(x^{x^x}\right)' \;\; = \;\; x^{x^x} \cdot \left[ x^x(\ln x + 1) \cdot \ln x \; + \; \frac{x^x}{x} \right]$$

$$\left(x^{x^x}\right)' \;\; = \;\; x^{x^x} \cdot x^x \cdot \left[ (\ln x + 1)\ln x \; + \; \frac{1}{x} \right]$$

$$\left(x^{x^x}\right)' \;\; = \;\; x^{x^x} \cdot x^x \cdot \left[ (\ln x)^2 \; + \; \ln x \; + \; \frac{1}{x} \right]$$