# Differentiating $y=x^x$ with the formal definition of a derivative

A friend and I were messing around with derivatives, and while we both know the procedure for finding the derivative of $$y=x^x$$ with logarithmic differentiation, i.e.

$$y=x^x\\ \ln(y)=x\ln(x)\\ \dfrac{\mathrm{d}y}{\mathrm{d}x}\dfrac{1}{y}=1+\ln(x) \\ \dfrac{\mathrm{d}y}{\mathrm{d}x}=y(1+\ln(x))\\ \dfrac{\mathrm{d}y}{\mathrm{d}x}=x^x(1+\ln(x))$$

when we tried to do it with the formal definition of the derivative, we got this

$$\lim_{h \to 0}\frac{f(x+h)-f(x)}{h}\\ \lim_{h \to 0}\frac{x^{x+h}-x^x}{h}\\ \lim_{h \to 0}\frac{x^xx^h-x^x}{h}\\ \lim_{h \to 0}\frac{x^x(x^h-1)}{h}$$ then we pulled out the $$x^x$$ $$x^x\lim_{h \to 0}\frac{x^h-1}{h}$$

Then, using l'Hopital's rule, we differentiated with respect to $$h$$, like this

$$\lim_{h \to 0} \frac{x^h-1}{h}\\ \lim_{h \to 0} \frac{x^h\ln(x)}{1}$$

and since $$x^h$$ approaches zero, we get $$\ln(x)$$ for the limit

Putting that together, we have

$$\dfrac{\mathrm{d}y}{\mathrm{d}x}=x^x \ln(x)$$

and somewhere in between, we lost an $$x^x$$. Where did I go wrong here? Am I not allowed to take the derivative with only respect to $$h$$?

• $f(x+h)=(x+h)^{x+h}$, not $x^{x+h}$.
– anon
Mar 2, 2014 at 10:31
• @seaturtles ohhhh. That would make sense Mar 2, 2014 at 10:33
• See this question. Jul 29, 2020 at 2:19

Here are the steps $$\frac{d}{dx}x^x=\lim_{h\to 0} \frac{(x+h)^{x+h}-x^x}{h} =\lim_{h\to 0} \frac{\frac{d}{dh}(x+h)^{x+h}-\frac{d}{dh}x^x}{\frac{d}{dh}h} =\lim_{h\to 0} \frac{\frac{d}{dh}e^{\ln(x+h)^{x+h}}-0}{1} = \lim_{h\to 0} \frac{d}{dh}e^{(x+h)\ln(x+h)}=\lim_{h\to 0} e^{(x+h)\ln(x+h)}\frac{d}{dh}[(x+h)\ln(x+h)]= \lim_{h\to 0} (x+h)^{x+h}\left((x+h)\frac{d}{dh}\ln(x+h)+\ln(x+h)\frac{d}{dh}(x+h)\right) = \lim_{h\to 0} (x+h)^{x+h}\left(\frac{x+h}{x+h}+\ln(x+h)\right) = \lim_{h\to 0} (x+h)^{x+h}\left(1+\ln(x+h)\right)= x^x(1+\ln x)$$
If $$h\to 0$$ then $$x^h\to 1$$, but not zero, making 1+ $$\ln(x)$$ for the limit.