Main content

## Differential Calculus

### Course: Differential Calculus > Unit 3

Lesson 11: Logarithmic differentiation# Composite exponential function differentiation

Sal finds the derivatives of xˣ and x^(xˣ). They are surprisingly fun to do! Created by Sal Khan.

## Want to join the conversation?

- Why do you take the natural log of both sides at about "0:45", instead of the regular log? Just wondering.(10 votes)
- I think there's some confusion here. log{to the base ten}(x) is actually just ln(x)/ln(10), where ln(x) is, of course, the natural log, i.e., to the base 'e', of x. I guess Sal has a video explaining that somewhere.

Anyway, ln(10) is just a constant. So it's very easy to see the proof:

d/dx{log(x)}

= d/dx{ln(x)/ln(10)}

= [d/dx{ln(x)}]/ln(10)

= 1/{x*ln(10)}

which is NOT the same thing as 1/{x*log(10)} , because ln(10) and log(10) are indeed different; log(10), in our context, being simply 1.

The key thing is the difference in the bases of the logarithms. 'e' happens to be an insanely cool number, which is why d/dx{ln(x)} = 1/x, while 10 isn't quite as cool, and thus d/dx{log(x)} = 1/{x*ln(10)}.(27 votes)

- In the second problem, how would you know the derivative of x^(x) without having done the first problem?(3 votes)
- I am a bit rusty, but I believe you could have taken the natural log of both sides again, or you could have just went through the product rule and then done the derivative of x^x as part of that.(9 votes)

- at0:45Sal call taking the 'x' from the power as a product of ln(x) like: x*ln(x). that is straight out of the logarithm properties, isn't it?!(7 votes)
- You are correct sir. Basic logarithm properties.

log (a^b) = b * log (a)(7 votes)

- Does dy/dx = d/dx? If not, why?(6 votes)
- dy/dx means d/dx * (y). For most linear equations in the form y=f(x), this translates to d/dx * f(x). If y = f(x) + g(x) then dy/dx = d/dx * (y) = d/dx * f(x) + d/dx * g(x).(6 votes)

- Can you differentiate this by using just the chain rule if you say that f(x)= x and g(x)= f(x)^x so it is a composite function?(5 votes)
- Great question! At first it seems like "of course you can!" But there is a big problem trying to use the chain rule on x^x to find the derivative of x^(x^x). Did you try it?

Think about how the chain rule usually works:

Given that`d/dx(sin(x)) = cos(x)`

, I can say`d/dx(sin(u)) = cos(u)(du/dx)`

, and in general:

Given that`d/dx(f(x)) = f'(x)`

, I can say`d/dx(f(g(x))) = f'(g(x))g'(x)`

But when we start with`f(x) = x^x`

, and`d/dx(f(x)) = f'(x) = x^x(ln(x) + 1)`

, we run into a major problem that**we don't actually know "which 'x' ", the base x or the exponent x, is where**in the`f'(x) = x^x(ln(x) + 1)`

. So you really need to do a bit more work if you want to use the chain rule. Basically, you need to start over, and find the derivative of f(x) = x^u, where u is some function of x, and you will find`d/dx(x^u) = x^u(ln(x)(du/dx) + u/x)`

. So you find out, shockingly, that the 1 in the derivative was not really a 1! It was (exponent/base) which only becomes 1 when the exponent and base are both x! Armed with`d/dx(x^u) = x^u(ln(x)(du/dx) + u/x)`

, you can now use the chain rule to find`d/dx(x^(x^x))`

.(4 votes)

- Could you have started by redefining y = x^(x^x) as y = x^(x^2) ? Seems like it would be easier, but I haven't tried so...(5 votes)
- I think he meant the property about powers. When you are given
`(x^a)^b`

, then it is equal to`x^(a.b)`

. So why not`x^(x^x) = x^(x.x) = x^(x^2)`

? The answer is the use of parentheses.(4 votes)

- What if the crazy problem gets crazier with the scaling of powers going on infinitely? I have come across a problem like that but with square roots.(4 votes)
- I am sorry but I hardly understand your explanation although the graph is very fascinating.(1 vote)

- so the power rule doesn't work if the exponent is a variable like 'x' right!

example: x^5 will work but not x^x at least not by the power rule.(3 votes)- Correct. The power rule only works for constant exponents.(2 votes)

- I don't get how to get the derivative of x^x. I came up with the answer of (ln x)x^x, but the answer is (lnx +1)x^x. How do you get that answer？ And how does x^x convert into e^(x lnx). Thanks to whomever can help me.(2 votes)
- Let y = x^x. Then, taking the natural logarithm of both sides, ln(y) = ln(x^x). Using the power property of logarithms, ln(y) = x ln(x). Taking the derivative of both sides uses the chain rule on the left side and the product rule on the right: 1/y dy/dx = x*1/x + 1*ln(x). Multiplying both sides by y and simplifying the right gives dy/dx = (1 + ln(x))*y. Finally, making a substitution for y based upon the original definition for y yields d/dx [x^x] = (1 + ln(x))*x^x.(4 votes)

- For the second problem he skipped showing up how he could just substitute in x^x with the first problem. If I'm understanding this he's saying we can just pull a part of the equation out and solve it separately and plug it back in when we need it?(3 votes)
- Exactly. We already know dy/dx of x^x. For a corollary, if we knew that some variable n were 15, then anywhere we were to see n we could replace it with 15. Thus, everywhere we see x^x we can replace it with its equivalent.(1 vote)

## Video transcript

A bit of a classic implicit
differentiation problem is the problem y is
equal to x to the x. And then to find out what
the derivative of y is with respect to x. And people look at that, oh you
know, I don't have just a constant exponent here, so I
can't just use the power rules, how do you do it. And the trick here is really
just to take the natural log of both sides of this equation. And this is going to build
up to what we're going to do later in this video. So If you take the natural log
on both sides of this equation, you get the natural log of y is
equal to the natural log of x to the x. Now our power rules, or I guess
our natural log rules, say look, if I'm taking the natural
log of something to the something, this is equivalent
to, I can rewrite the natural log of x to the x as being
equal to x times the natural log of x. So let me rewrite
everything again. If I take the natural log of
both sides of that equation, I get the natural log of y is
equal to x times the natural log of x. And now we can take the
derivative of both sides of this with respect to x. So the derivative with respect
to x of that, and then the derivative with
respect to x of that. Now we're going to apply a
little bit of the chain rule. So the chain rule. What's the derivative of
this with respect to x? What's the derivative of
our inner expression with respect to x? It's a little implicit
differentiation, so it's dy with respect to x times the
derivative of this whole thing with respect to
this inner function. So the derivative of
natural log of x is 1/x. So the derivative of
natural log of y with respect to y is 1/y. So times 1/y. And the derivative of this--
this is just the product rule, and I'll arbitrarily switch
colors here-- is the derivative of the first term, which is 1,
times the second term, so times the natural log of x plus the
derivative of the second term, which is 1/x times
the first term. So times x. And so we get dy/dx times 1/y
is equal to natural log of x plus-- this just turns out to
be 1-- x divided by x, and then you multiply both
sides of this by y. You get dy/dx is equal
to y times the natural log of x plus 1. And if you don't like this y
sitting here, you could just make the substitution. y is equal to x to the x. So you could say that the
derivative of y with respect to x is equal to x to the x times
the natural log of x plus 1. And that's a fun problem, and
this is often kind of given as a trick problem, or sometimes
even a bonus problem if people don't know to take the natural
log of both sides of that. But I was given an even more
difficult problem, and that's what we're going
to tackle in this. But it's good to see this
problem done first because it gives us the basic tools. So the more difficult
problem we're going to deal with is this one. Let me write it down. So the problem is y is equal
to x to the-- and here's the twist-- x to the x to the x. And we want to find out dy/dx. We want to find out
the derivative of y with respect to x. So to solve this problem we
essentially use the same tools. We use the natural log to
essentially breakdown this exponent and get it into
terms that we can deal with. So we can use the product rule. So let's take the natural log
of both sides of this equation like we did last time. You get the natural log of y
is equal to the natural log of x to the x to the x. And this is just the
exponent on this. So we can rewrite this as x to
the x times the natural log times the natural log of x. So now our expression our
equation is simplified to the natural log of y is equal to x
to the x times the natural log of x. But we still have this
nasty x to the x here. We know no easy way to take the
derivative there, although I've actually just shown you what
the derivative of this is, so we could actually just
apply it right now. I was going to take the natural
log again and it would turn into this big, messy, confusing
thing but I realized that earlier in this video I
just solved for what the derivative of x to the x is. It's this thing right here. It's this crazy
expression right here. So we just have to remember
that and then apply and then do our problem. So let's do our problem. And if we hadn't solved this
ahead of time, it was kind of an unexpected benefit of doing
the simpler version of the problem, you could just keep
taking the natural log of this, but it'll just get a
little bit messier. But since we already know what
the derivative of x to the x is, let's just apply it. So we're going to take
the derivative of both sides of the equation. Derivative of this is equal
to the derivative of this. We'll ignore this for now. Derivative of this with respect
to x is the derivative of the natural log of y
with respect to y. So that's 1/y times
the derivative of y with respect to x. That's just the chain rule. We learned that in
implicit differentiation. And so this is equal to the
derivative of the first term times the second term, and I'm
going to write it out here just because I don't want to skip
steps and confuse people. So this is equal to the
derivative with respect to x of x to the x times the natural
log of x plus the derivative with respect to x of
the natural log of x times x to the x. So let's focus on the right
hand side of this equation. What is the derivative of x
to the x with respect to x? Well we just solved that
problem right here. It's x to the x natural
log of x plus 1. So this piece right there--
I already forgot what it was-- it was x to the x
natural log of x plus 1. That is x to the x times the
natural log of x plus 1. And then we're going to
multiply that times the natural log of x. And then we're going to add
that to, plus the derivative of the natural log of x. That's fairly straightforward,
that's 1/x times x to the x. And of course the left
hand side of the equation was just 1/y dy/dx. And we can multiply both sides
of this now by y, and we get dy/dx is equal to y times all
of this crazy stuff-- x to the x times the natural log of x
plus 1 times the natural log of x plus 1/x times x to the x. That's x to the negative 1. We could rewrite this as x
to the minus 1, and then you add the exponents. You could write this as x
to the x minus 1 power. And if we don't like this
y here, we can just substitute it back. y was equal to this, this
crazy thing right there. So our final answer for this
seemingly-- well on one level looks like a very simple
problem, but on another level when you appreciate what it's
saying, it's like oh there's a very complicated problem-- you
get the derivative of y with respect to x is equal
to y, which is this. So that's x to the x to the x
times all of this stuff-- times x to the x natural log of x
plus 1 times the natural log of x, and then all of that
plus x to the x minus 1. So who would have thought. Sometimes math is elegant. You take the derivative of
something like this and you get something neat. For example, when you take
the derivative of natural log of x you get 1/x. That's very simple and elegant,
and it's nice that math worked out that way. But sometimes you do something,
you take an operation on something that looks pretty
simple and elegant, and you get something that's hairy and not
that pleasant to look at, but is a pretty
interesting problem. And there you go.