TITLE: In a naive attempt to calculate the derivative of $x^x$
QUESTION [7 upvotes]: Consider the function $f(x)=x^x$ with $x>0$. One has the following derivatives
$$
(x^n)'=nx^{n-1},\quad (a^x)'=a^x\ln a\;.
$$
Neither of these applies to the function $f$. In other words, it is neither
$
f'(x)=xx^{x-1}
$
nor
$
f'(x)=x^x\ln x.
$
But if we naively just add them together, we get
$$
f'(x)=xx^{x-1}+x^x\ln x\tag{1}
$$
By definition, $f(x)=\exp(x\ln x)$ and thus by the chain rule:
$$
f'(x) = f(x)\cdot (x\ln x)' = x^x (\ln x+x\cdot \frac{1}{x})=x^x(\ln x+1)\tag{2}
$$
One can see that (1) and (2) are the SAME. Is this a coincidence? Is there any underlying math to reveal the coincidence?

REPLY [11 votes]: I just find that I can never come up with an explanation restricting myself in 1D. However, if I have one more dimension, I have the following explanation.
If we let $g(u,v)=u^v$, then $f(x) = g(x,x)$. By the chain rule in multivariable calculus, we get
$$
f'(x) = g_u\cdot \frac{\partial u}{\partial x}+g_v\cdot \frac{\partial v}{\partial x}
$$
where $u(x) = v(x)= x$ and $g_u = vu^{v-1}$ and $g_v=u^v\ln u$. Combining everything together one justifies the "naive" attemp (1).
This is one answer I can come up with explaining the coincidence. It seems that there is no hope to work it out without using multivariable calculus. (I would be glad to be proved wrong and see other answers.)