TITLE: Finding the derivative of $x^x$
QUESTION [5 upvotes]: 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.

REPLY [8 votes]: 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.

REPLY [2 votes]: 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.