When deriving $x^x$, why can't you choose $u$ to be $x$, and find $\dfrac{d(x^u)}{du} \dfrac{du}{dx} = x^x$? Or you could go the other way and find $\dfrac{d(u^x)}{du}\dfrac{du}{dx}$, giving $\ln(x)\cdot{x^x}$? Both methods seem to be equally wrong.

  • 7
    $\begingroup$ Short answer: both wrong. If you have two instances of the same variable you can not substitute just one of the out and then the other. You must substitute them both out simultaneously. $\endgroup$ – fleablood May 25 '16 at 5:47
  • 4
    $\begingroup$ So suing x for u means you must derive $\dfrac {d u^u}{d u}\dfrac {du}{dx} $ which helps you not one #@%&ing bit. $\endgroup$ – fleablood May 25 '16 at 5:50
  • 4
    $\begingroup$ $\dfrac {x^u}{du} =\ln x x^u$ implies the base $x$ is a constant with respect to $u $. As $x=u $ this is not the case. $\endgroup$ – fleablood May 25 '16 at 5:57
  • 6
    $\begingroup$ @fleablood And that's why we don't take math variables to court. $\endgroup$ – MKII May 25 '16 at 9:54
  • $\begingroup$ Coz there's an interplay between the two "x", you can't simply separate them up. $\endgroup$ – Vim May 26 '16 at 2:50

Both methods are wrong, but the fix is easy: the solution is the sum of the two proposals, and this is not by coincidence !

Naturally, turning a single instance of $x$ to a constant cannot be the way as that is not symmetric. The correct way is by differentiating on every instance in turn, and is justified by the chain rule with partial derivatives:

$$\frac{df(u,v)}{dx}=\frac{\partial f(u,v)}{\partial u}\frac{du}{dx}+\frac{\partial f(u,v)}{\partial v}\frac{dv}{dx}.$$ In other words, you keep one instance variable while the other remains constant and sum the two cases.

Here, $f(u,v)=u^v$ with $u=v=x$, and

$$\frac{dx^x}{dx}=\frac{du^v}{dx}=vu^{v-1}\cdot1+\ln(u)u^v\cdot1=x^x+\ln(x)x^x,$$ or with a more intuitive notation$$\frac{dx^x}{dx}=\frac{dx^v}{dx}\cdot1+\frac{du^x}{dx}\cdot1=vx^{v-1}+\ln(u)u^x=x^x+\ln(x)x^x.$$

This works with as many instances of $x$ as you like. For instance $x^{x+x^2}$ seen as $u^{v+w^2}$ yields

  • varying the first instance, $(v+w^2)x^{v+w^2-1}$;

  • varying the second instance, $\ln(u)u^{x+w^2}$;

  • varying the third instance, $\ln(u)u^{v+x^2}2x$.

Then globally


  • 1
    $\begingroup$ While your answer gives a very good strategy, it does use a complex tool (theory of functions of multiple real variables) to solve a reasonably simpler problem and it does not really help OP in alleviating the confusion about chain rule. $\endgroup$ – Paramanand Singh May 27 '16 at 16:56

If you work with the formal definition of the chain rule, you'll see how what you're trying to do makes no sense.

But if you want to stick with the abuse of notation $\frac{dz}{dx}=\frac{dz}{dy}\frac{dy}{dx}$, I'd say that the heart of the problem is in your claim that $\frac{d(x^u)}{du}=x^u\log x$. This is only valid if $x$ is constant, and doesn't apply if $x$ is a function of $u$ (in our case, $x=u$).

That's the difference between a total derivative $\frac{d}{dt}$ and a partial derivative $\frac{\partial}{\partial t}$. The latter, $\frac{\partial f(s,t)}{\partial s}$, means, "change in $f$ when $s$ changes and nothing else does". Whereas $\frac{df(s,t)}{ds}$ means "change in $f$ when $s$ changes, and everything else changes accordingly". So you can't have $u$ depend on $x$ and calculate a total derivative in a way that assumes $x$ is constant.


Both are wrong, since in spite of choosing $u=x$, you are replacing only one variable $x$ by $u$ while leaving the other $x$ intact. And then again, you decide to differentiate with respect to $u$ by chain rule, initially treating $x$ as a constant in $x^u$ and in $u^x$, which again is wrong.

What you should do is:

Write $x^x$ as $e^{\ln x^x}=e^{x\ln x}$ and then you should differentiate with respect to $x$ using chain rule.

  • 1
    $\begingroup$ With dependent variables, you don't have to substitute all occurrences of one variable with the other; in fact it is often convenient not to do so and write expressions that use both variables. $\endgroup$ – Hurkyl May 25 '16 at 17:11

Other answers answer this question well and, but I guess another way to find the error might be helpful to some. When you know you've done something wrong but don't know what it is, it's often a good idea to try to use the same method with simpler, even ridiculously simple, examples, and see where it goes wrong. At least I've used this approach with success.

Let's try. What about differentiating $x$? That's probably not instructive because you don't have two separate $x$s there so you really can't apply your idea. But let's "cheat" a bit by defining $f$ to be a constant function, say $f(y)=1$ for all $y$, and differentiating $x f(x)$ (which equals $x$ of course). $$ \frac{dx}{dx} = \frac{d(xf(x))}{dx} = \frac{d(xf(u))}{du}\frac{du}{dx} = x \frac{df(u)}{du} \times 1 = 0. $$ But because $f(u)$ is a constant $1$, this would be equivalent to writing $$ \frac{dx}{dx} = \frac{d(x\times 1)}{dx} = \frac{d(x\times 1)}{du} \frac{du}{dx} = 0 \times 1, $$ or to simplify even more, $$ \frac{dx}{dx} = \frac{dx}{du} \frac{du}{dx} = 0 \times 1, $$

So what went wrong here and why? Ah! $\frac{dx}{du}$ probably shouldn't equal $0$ when we have defined $u=x$. So (as others have pointed out) in the original problem the corresponding place is when we calculate $\frac{d(x^u)}{du}$ as if $x$ were a constant.

  • $\begingroup$ Downvoter: What would you improve in this answer? $\endgroup$ – JiK Aug 25 '16 at 12:04

Your approach is fine, but your execution fails — you didn't post the calculation so I'm guessing, but it looks like you did two things wrong:

  • You assumed $x$ is constant with respect to $u$ and vice versa, which is clearly false if $x=u$
  • You mixed up the rules for $z^{(\text{constant})}$ and $(\text{constant})^z$.

What we do have is that

$$ \mathrm{d}(x^u) = u x^{u-1} \mathrm{d}x + \ln(x) x^u \mathrm{d} u $$

or equivalently

$$ \mathrm{d}(u^x) = x u^{x-1} \mathrm{d}u + \ln(u) u^x \mathrm{d} x $$

The nice thing about differentials is that equations like this remain true no matter how $u$ and $x$ are related. One method to derive such equations is that the coefficients can be viewed as partial derivatives; basically the same as the method described at this other answer.

If $x$ and $u$ are independent, it doesn't make sense to ask for things like $\frac{\mathrm{d}(x^u)}{\mathrm{d}u}$, because $\mathrm{d}(x^u)$ simply isn't a multiple of $\mathrm{d}u$. But if they are (sufficiently smoothly) related, it does make sense (because $\mathrm{d}x$ will be a multiple of $\mathrm{d}u$).

The other nice thing about differentials is that if we do something like impose the relationship $x=u$, then the differential of this equation is also true: in this case $\mathrm{d}x = \mathrm{d}u$.

Applied to the first equation, we'd get

$$ \mathrm{d}(x^x) = x x^{x-1} \mathrm{d}x + \ln(x) x^x \mathrm{d} x $$ or equivalently, $$ \mathrm{d}(x^x) = x^x (1 + \ln(x)) \mathrm{d}x $$

which indeed leads to the correct formula for the derivative.

  • $\begingroup$ Aside: it's interesting to think of this calculation as differentiating $x^x$ with respect to one $x$ and then with respect to the other $x$. I wonder if that is the reason for the name "partial differentiation"? $\endgroup$ – Hurkyl May 25 '16 at 17:19
  • $\begingroup$ @WillNess: Thanks: fixed. $\endgroup$ – Hurkyl Sep 6 '18 at 20:54

There is an easier method.I tried this out.

$u=x^x,$ (taking log on both sides) $\log u=x\log(x)$,

$\frac{d(\log u)}{dx}=\frac{d(x\log(x))}{dx}$,


so, $\frac{du}{dx}=u(\log(x)+1)$,

i.e. $\frac{d(x^x)}{dx}=x^x(\log(x)+1)$

The entire reason for substitution is always to make the differentiable item to be less complex. As you asked if you take both ways putting u as x for the exponent or base, the substitution doesnt make the work easier for us. But taking a log and then differentiating makes things far more easier.

  • 1
    $\begingroup$ How does this answer the question? $\endgroup$ – JiK May 25 '16 at 12:21
  • $\begingroup$ @JiK : This answer is useful because it shows what to substitute as u. See, as far as I know we substitute complex variables only to make our job easier else these substitutions hold no purpose. So basically we need to know what to substitute and I think thats was misleading the guy. If he gets to know what to substitute and what not to and why we need to substitute things would be more easier I suppose. $\endgroup$ – Akash Raveendran May 25 '16 at 13:35

I have mentioned in one of my answers about identifying the building blocks of a composite function in order to correctly apply chain rule. In the current problem where $f(x) = x^{x}$ you should ask the question: How do I get from $x$ to $f(x) = x^{x}$ in a step by step manner?

Your restriction is that each step must be a simple function which is not itself a composite function (i.e it can be a function like $x^{n}, \log x, e^{x}$ or direct or inverse trigonometric function of $x$ or a combination of such functions via arithmetic operators $+,-, \times, /$, idea is that each step must be a function whose derivative you know beforehand). The answer to the question in previous paragraph is not that I put $x$ as the base and also as exponent and get $x^{x}$. You need to apply the basic functions listed previously on $x$ in step by step manner. The only way out is to realize that the function $f(x) = x^{x}$ is defined as $f(x) = \exp(x\log x)$.

Then we see that we first apply $\log$ on $x$ and multiply it with $x$ to get $x\log x$ and then apply $\exp$ on this result. We thus have $f(x) = g(h(x))$ where $h(x) = x\log x$ and $g(x) = \exp(x)$. Applying chain rule is now easy and left to the reader.

It appears (from the downvote) that someone is not really satisfied with the answer. I add some details on exactly why replacing one of the occurrences of $x$ by $u$ in $f(x) = x^{x}$ is a wrong application of chain rule. Replacing one of $x$ by $u$ we either get $x^{u}$ or $u^{x}$. Unfortunately we don't know how to differentiate any of these functions unless we are given that $u$ is a constant (remember that we are given differentiation formulas only for functions $x^{n}$ or $a^{x}$ which assume that either base or exponent must be constant). Working in this manner does not really express $f(x)$ as a composite function i.e. it does not express $f(x)$ as some function of $u$ (whose derivative we already know) where $u$ is another function of $x$ (whose derivative we already know).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.