Main content

## Logarithmic differentiation

# Composite exponential function differentiation

## 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.