# Derivative of $x^x$ using first principle

Find $f'(x)$ with $f(x)=x^x$ using first principle.

i.e. evaluate the limit $$\lim_{h\to0}\frac{{(x+h)}^{x+h}-x^x}{h}$$

EDIT: $x^x=e^{x\ln x}$ so we need to evaluate $$\lim_{h\to0}\frac{e^{{(x+h)}\ln{(x+h)}}-e^{x\ln x}}{h}$$

I know the answer is $x^x(\ln x+1)$ but how can one prove it using first principle?

• Your function is defined only for rational values? One usually only computes derivatives of functions defined over open intervals. – Mariano Suárez-Álvarez Jun 30 '13 at 18:53
• And how do you do that? How can you multiply $2$ by itself $\pi$ times? – Mariano Suárez-Álvarez Jun 30 '13 at 18:57
• $x^x$ is usually defined as $e^{x \log{x}}.$ Is this your definition? – Alex Provost Jun 30 '13 at 19:07
• I think Mariano used here in a rather interesting and educative way the maieutics method Socrates made so famous, according to Plato. Bottom line, some times one discovers one doesn't know even what one's asking about. – DonAntonio Jun 30 '13 at 19:17
• @MarianoSuárez-Alvarez I do not understand the motivation behind your questions here, which sounded to me as a sort of interrogation. The OP is clearly not aware of some of the more advanced notions you are trying to describe. What good does it make to mention "the derivatives of functions over open intervals?" Why not directly ask "Is $e^{x\log x}$ your definition, would you check your book?," or sth like that? – Lord Soth Jun 30 '13 at 19:34

First, $$\lim_{h\to0}\frac{x^h-1}{h}=y \iff x=\lim_{n\to\infty}\left(1+\frac yn\right)^n \iff x=e^y \iff y=\log(x)$$ Then, \begin{align} &\lim_{h\to0}\frac{(x+h)^{x+h}-x^x}{h}\\ &=\lim_{h\to0}\frac{(x+h)^{x+h}-(x+h)^x+(x+h)^x-x^x}{h}\\ &=\lim_{h\to0}(x+h)^x\lim_{h\to0}\frac{(x+h)^h-1}{h} +x^x\lim_{h\to0}\frac{\left(1+\frac hx\right)^x}{h}\\ &=\lim_{h\to0}(x+h)^x\lim_{h\to0}\frac{(x+h)^h-1}{h} +x^x\lim_{h\to0}\frac{\left(1+\frac hx\right)^{\large\frac xhh}-1}{h}\\[12pt] &=x^x\log(x)+x^x\cdot\log(e)\\[16pt] &=x^x\log(x)+x^x \end{align}

To calculate the desired limit, one first has to know what is the meaning of the expression $x^x$. For some type of numbers, we can assume that we know how to calculate it, for example, $2^2=2\cdot2=4$.

On the other hand, what is $\pi^\pi$? Is it the product of $\pi$ by $\pi$, $\pi$ times? So we need a definition for the expression $x^x$. As @AlexP suggested in the comments, $x^x$ can be defined by $e^{x\log{x}}$.

Let's analyze this definition. The first thing to note is that to understand the definition, you have to know how to calculate the exponential of a real number, how to calculate the log of a real number and how to calculate the product of two real numbers. If we suppose that you know how to do all of this, then you know how to calculate $x^x$. Note that $x^x$ is defined only for $x>0$ (can you say why?).

Now, let's try to calculate the desired limit by using this definition.

\begin{eqnarray} \lim_{h\to 0}\frac{(x+h)^{x+h}-x^x}{h} &=& \lim_{h\to 0}\frac{e^{(x+h)\log{(x+h)}}-e^{x\log{x}}}{h} \nonumber \\ &=& \lim_{h\to 0}e^{x\log{x}}\frac{e^{(x+h)\log{(x+h)}-x\log{x}}-1}{h} \nonumber \\ &=& \tag{1}\lim_{h\to 0}e^{x\log{x}}\frac{e^{x\log{(1+h/x)}+h\log{(x+h)}}-1}{h} \end{eqnarray}

By using the definition of $e$ given by @Charles in the comments, we have that $$\tag{2}e^{x\log{(1+h/x)}+h\log{(x+h)}}-1=x\log{(1+h/x)}+h\log{(x+h)} \\+\frac{1}{2!}(x\log{(1+h/x)}+h\log{(x+h)})^2+...$$

Now, you can check that (for the first one try to use some fundamental limit)

$$\tag{3} \lim_{h\to 0}\frac{x\log{(1+h/x)}}{h^{1/n}} = \left\{ \begin{array}{cc} x &\mbox{ if n=1} \\ 0 &\mbox{ if n>1} \end{array} \right.$$

and

$$\tag{4}\lim_{h\to 0} \frac{h\log{(x+h)}}{h^{1/n}} = \left\{ \begin{array}{cc} \log{x} &\mbox{ if n=1} \\ 0 &\mbox{ if n>1} \end{array} \right.$$

By combining $(1)-(4)$ we conclude that $$\lim_{h\to 0}\frac{(x+h)^{x+h}-x^x}{h}=x^x(\log{x}+1)$$

Remark: How to justify the interchange of limits, i.e. if $f(h)=x\log{(1+h/x)}+h\log{(x+h)}$, how to justify $$\lim_{h\to 0}\lim_{n\to\infty}\sum_{k=1}^n\frac{f(h)^k}{k!}=\lim_{n\to \infty}\lim_{n\to 0}\sum_{k=1}^n\frac{f(h)^k}{k!}$$

First note that ($n\leq m$)

\begin{eqnarray} \left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right| &=& \left|\sum_{k=n}^m\frac{f(h)^k}{k!}\right| \nonumber \\ &\leq&\tag{5} \sum_{k=n}^m\frac{|f(h)|^k}{k!} \end{eqnarray}

Fix $\epsilon>0$ and choose $\delta>0$ such that $|f(h)|=\eta<1$ (note that this choice of $\delta$ depends on $x$, however $x$ is fixed) . It follow from $(5)$

$$\left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right|\leq\sum_{k=n}^m\frac{\eta^k}{k!}$$

From the last inequality and from the fact that $|f(h)|\to 0$ if $h\to 0$, we conclude that there exist $\overline{h}$ such that for all $0<h<\overline{h}$, the sum $\left|\sum_{k=1}^n\frac{f(h)^k}{k!}-\sum_{k=1}^m\frac{f(h)^k}{k!}\right|$ does not depends on $h$, i.e. the sum converges uniformly to $0$ as $h\to 0$. This implies that we can in fact interchange the limits.

• This doesn't work as written. You are exchanging an infinite sum (effectively, a limit), and the limit as $h\to0$. In general, these two operations do not commute. – Andrés E. Caicedo Jun 30 '13 at 20:20
• In this case it commutes, so I dont see any problem to do this. @AndresCaicedo – Tomás Jun 30 '13 at 20:32
• Tomás, this being mathematics and all, we actually justify our claims. This is a proof from first principles, right? You cannot just use as a black box what could perhaps be the trickiest or most technical part of the argument. (Well, of course you can, since you did. But assuming that you actually want to answer the OP's question...) – Andrés E. Caicedo Jun 30 '13 at 20:40
• The point is that to make it work you have to explain why they commute. – Mariano Suárez-Álvarez Jun 30 '13 at 20:41
• You are right @AndresCaicedo, let me work on it. – Tomás Jun 30 '13 at 20:45