# Finding the derivative of $x^x$

I am having trouble finding the derivative of the following:

$$y = x^x+x^3+3^x+3^3$$

$$\frac{dy}{dx}= x \times x^{(x-1)}+3x^2+3^x\ln3+0$$

I think the $x^x$ part is wrong. Any help would be appreciated.

-
Hint on how to compute the derivative of $x^x$: think of it as $e^{x\ln x}$. –  froggie May 17 '12 at 21:52
froggie gives probably the simplest way. If you know of the chain rule of functions of two variables, you can also do it as $y=u^v$, where $u(x)=x$ and $v(x)=x$. Use $$\frac{dy}{dx}=\frac{\partial y}{\partial u}\,\frac{du}{dx}+\frac{\partial y}{\partial v}\,\frac{dv}{dx}.$$ –  Jyrki Lahtonen May 17 '12 at 21:56

The $x^x$ part is indeed wrong: when you have the independent variable in both the base and the exponent, you can use logarithmic differentiation. Let $y=x^x$; then $\ln y=\ln(x^x)=x\ln x$. Now differentiate both sides with respect to $x$: $$\frac{d}{dx}(\ln y)=\frac1y\cdot\frac{dy}{dx}\;,$$ and $$\frac{d}{dx}(x\ln x)=x\cdot\frac1x+1\cdot\ln x=1+\ln x\;,$$ so $$\frac1y\cdot\frac{dy}{dx}=1+\ln x\;.$$ Now just solve this for $dy/dx$, replace $y$ by its value $x^x$, and you’ll have the derivative of $x^x$.

This if of course equivalent to rewriting $x^x$ as $e^{\ln(x^x)}=e^{x\ln x}$ and differentiating it as a composition of exponential and product; either method works fine, so take your pick.

-
thank you, I think it would just be x^x(1+lnx) –  dave5678 May 17 '12 at 22:13
@dave5678: Yes, that’s correct. –  Brian M. Scott May 17 '12 at 22:16

Because the exponential and logarithmic functions (with the same base) are inverse functions, $$x^x=e^{\ln(x^x)}$$ and using the log of a power property, $$x^x=e^{\ln(x^x)}=e^{x\cdot\ln x}.$$

So, you can find the derivative of $x^x$ by finding the derivative of $e^{x\cdot\ln x}$.

-
I'm thinking I should use logarithmic differentiation. –  dave5678 May 17 '12 at 22:02
@dave5678: You definitely could—that's what's in Brian's answer, I think. I tend to think of this method before logarithmic differentiation, but I don't think there's any particular advantage to this method. –  Isaac May 17 '12 at 22:03
Well you are almost right but for a term. When you wrote $\dfrac{d x^x}{dx} = x \times x^{x-1}$, you treated that the $x$ occurring in the exponent as a constant. However, since it is a variable, you need to add another term treating the other $x$ in $x^x$ as a constant. Hence, you need to add the term $x^x \ln(x)$ since $\dfrac{d a^x}{dx} = a^x \ln(a)$. In general, $$\dfrac{d \left(u(x)^{v(x)} \right)}{dx} = \underbrace{v(x) \times u(x)^{v(x)-1}}_{\text{treating } v(x) \text{ constant}} + \underbrace{u(x)^{v(x)} \log(u(x))}_{\text{treating } u(x) \text{ constant}}$$ The above follows from the chain rule. $$\left. \dfrac{d \left(u(x)^{v(x)} \right)}{dx} = \frac{\partial \left(u(x)^{v(x)} \right)}{\partial u} \frac{du}{dx} \right \rvert_{v(x)- \text{costant}} + \left. \frac{\partial \left(u(x)^{v(x)} \right)}{\partial v} \frac{dv}{dx} \right \rvert_{u(x)- \text{costant}}$$ A clear approach would be to write $x^x = e^{x \ln (x)}$, (as other have already stated) and work out the derivative.