Differentiate $y=x^x$

How do you differentiate $$\large{f(x) = x^x}$$

The working I got was $$\ln f(x) = x \ln x$$

which I am pretty fine...but I do not know how it advances to

$$\frac{f'(x)}{f(x)} = x\begin{pmatrix} \frac 1 x\end{pmatrix} + \ln x$$

although the final answer can be, by multiplying $f(x)$ on both sides of the equation,

$${f'(x)} = x^x\begin{bmatrix}x\begin{pmatrix} \frac 1 x\end{pmatrix} + \ln x\end{bmatrix}$$

UPDATE : SOLVED

Indeed, $$\ln f(x) = x \ln x$$ Differentiate both sides of the equation w.r.t $x$ $$\frac{f'(x)}{f(x)} = x\begin{pmatrix} \frac 1 x\end{pmatrix} + \ln x = 1 + \ln x$$ Bring the $f(x)$ over and you'll finally get

$$f'(x) = x^x\begin {pmatrix} 1 + \ln x\end{pmatrix}$$

-
Yes............but why won't you better write $\,x\frac{1}{x}=1\,$ ...? –  DonAntonio Feb 3 '13 at 12:55
It was directly lifted off from the textbook. I know what you meant, but perhaps some help to get there before I change it back to $1 + \ln x$ –  bryansis2010 Feb 3 '13 at 12:57
Some help...where? What you did is correct! –  DonAntonio Feb 3 '13 at 12:58
If you have any function to a variable exponent in a calculus problem, say $f(x)^{g(x)}$ I find it almost always pays to replace it by $e^{f(x)g(x)}$. Example: ${d\over dx}2^x={d\over dx}e^{x\ln2}=(\ln 2)e^x$ and $\int 2^x dx=\int e^{x\ \ln 2}dx=e^{x \ln 2}+C$ by an elementary substitution which is much better than memorizing where that $\ln 2$ goes and then putting it in the wrong place. –  Barbara Osofsky Feb 3 '13 at 14:22

3 Answers

By the chain rule

$$\frac{d}{dx} \ln{f(x)} = \frac{1}{f(x)} f'(x)$$

-

Another way (You already used the chain rule and $[\ln f(x)]'$: $$x^x=e^{x\ln x}$$

-

The following came from a mathoverflow answer (I cannot recall the question):

A student was asked to differentiate $y=x^x$. Not remembering how to do logarithmic differentiation the student reasoned as follows: "well, I do not know how to differntiate $x^x$, but I do know how $x^r$. This is $rx^{r-1}$. But this is not right since the exponent is $x$. But I also know the derivative of $r^x$. This is $ln(r)r^x$. This is not right either for the same reason. So I'll split the difference and add them together and get $rx^{r-1}+ln(r)r^x$. But that $r$ is actually $x$ so the answer must be $x^x+ln(x)x^x$

The funny thing is that the result is right, but the reasoning is incomplete. What you need is multivariable chain rule for a composite of the form, $$\mathbb{R}\to\mathbb{R}^2\to\mathbb{R}$$, where the first map is the diagonal, and the second will be called $f$. The answer that you get in the case is $$\frac{df(x,x)}{dx}=\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y}_{x=y}$$
Where $\frac{\partial f}{\partial y}_{x=y}$ is the composite $\frac{\partial f}{\partial y}(\iota)$, where $\iota(y)=x$.

-
You would not necessarily see this type of solution in a first calculus course. –  Baby Dragon Feb 3 '13 at 14:29