# Derivative of $x^x$ and the chain rule

Rewriting $x^x$ as $e^{x\ln{x}}$ we can then easily calculte the ${\frac{x}{dx}}$ derivative as ${x^x}(1 + \ln{x})$. We need to use chain rule in form $\frac{de^u}{du}\frac{du}{dx}$. The question is why cannot we use the chain rule skipping the 1st step of rewriting $x^x$ as $e^{xlnx}$? The idea would be to write $\frac{u^x}{du}\frac{du}{dx}$ which simply would be $x^x\ln{x} \cdot 1$? The answer is incorrect, here we are missing the $+x^x$ term.

• $\frac{d (a^x)}{dx}=a^x\ln a$ is true only for constant $a\gt0$ – GoodDeeds Apr 23 '16 at 12:43
• So the answer is I can use the chain rule but there is no "elementary derivative" to use? Ok, thank you. If you put the answer in the answers I'll be able to accept it. – askingonly Apr 23 '16 at 12:47
• Using the rule for $(x^n)'$ we achieve $x\cdot x^{x-1}$, using the rule for $(a^x)'$ we get $x^x\cdot\ln(x)$. Adding both gives the derivative of $x^x$ correctly. Bummer. – Michael Hoppe Apr 23 '16 at 13:11
• @MichaelHoppe Is there a reason for that or is it a coincidence? – GoodDeeds Apr 23 '16 at 13:16
• Happenstance (like the "Sophomore's Dream"): for the "generalized exponential" of a function to the power of a function, we have $$[ \ u^v \ ] ' \ = \ (u^v) \ \left[ \ \frac{v}{u} \cdot u' \ + \ v' \cdot \ln u \ \right] \ \ .$$ from logarithmic differentiation. This collapses to $$[ \ x^x \ ]' \ \ = \ \ x^x \ \left[ \ \frac{x}{x} \cdot 1 \ + \ 1 \cdot \ln x \ \right] \ \ ,$$ but won't be quite so simple otherwise. – colormegone Apr 24 '16 at 5:24

## 2 Answers

$$\frac{d(a^x)}{dx}=a^x\ln a$$ is true only for constant $a\gt0$.

Note that in getting the above result, the steps followed are similar to the steps for getting the derivative of $x^x$.

Let $f(x)=a^x$, $a\gt0$. Then, $$f(x)=e^{x\ln a}$$ $$f'(x)=\frac{d(e^{x\ln a})}{d(x\ln a)}\cdot\frac{d(x\ln a)}{dx}=e^{x\ln a}\cdot\ln a=a^x\ln a$$

whereas, for $f(x)=x^x$, $x\gt0$, $$f(x)=e^{x\ln x}$$ $$f'(x)=\frac{d(e^{x\ln x})}{d(x\ln x)}\cdot\frac{d(x\ln x)}{dx}=e^{x\ln x}\cdot(\ln x+1)=x^x(\ln x+1)$$

There is a "generalized" power rule I always taught. You can memorize it or not, but it is easy to derive if needed. If $f$ and $g$ are functions of $x$, then

$$\left(f^g\right)' = gf^{g-1}\cdot f' + f^g\log f\cdot g'$$

(To help remember this, notice that the first term is like the power rule with constant exponent, and the second term is like the power rule with constant base.)

Note that if $g$ is constant, then $g'\equiv 0$ and this reduces to the familiar rule $$\left(u^n\right)'=nu^{n-1}\cdot u'$$ and if $f$ is constant then this reduces to the familiar rule $$\left(a^u\right)'=a^u\log a\cdot u'$$

In your case, $f(x)=g(x)=x$ and we have $$\left(x^x\right)'=xx^{x-1}\cdot 1 + x^x\log x\cdot 1 = x^x(1+\log x)$$