# Derivative Chain Rule for $x$ as Exponent

Let's say I have a simple problem like this:

$$\frac{d}{dx}[2^x]$$

I would apply the exponent rule and work it like this:

$$\frac{d}{dx}[2^x]$$

$$=x\cdot 2^{x-1}$$

**I don't know how to simplify that further so I will leave it as is. If anyone knows, just comment.

But the real answer turns out to be $$\ln(2)\cdot 2x$$. How is this worked out and how can I apply this rule to complex problems like:

$$\frac{d}{dx}[(2x+4)^{x+1}]$$

I want to know the following:

• How to use this $$\ln(x)$$ rule?
• When to use this rule?
• Why you can't use the standard exponent rule?
• You are making a common (and easy to make) mistake. If consider the BASE of $x^k$ to be our variable and the exponent $k$ to be a CONSTANT, then, yes, the derivative if $k x^{k-1}$. But if it is the base that is CONSTANT and it is our EXPONENT that is $x$ then the derivative of $b^x$ is NOT $x b^{x-1}$. $b^x$ and $x^k$ are ENTIRELY different functions with entirely different behaviors and that just will not work. Commented Aug 4, 2021 at 22:50
• The reason $\frac {d x^k}{dx} = kx^{k-1}$ is because $\frac {(x+h)^k - x^k}h = \frac{[x^k + hx^{k-1} +{k\choose 2}h^2x^{k-2} ........ + kxh^{k-1}+h^k]-x^k}h= x^{k-1} + {k\choose 2}hx^{k-2} ........ + kxh^{k-2}+h^{k-1}\to x^{k-1}$. But $\frac {db^x}{dx} = \frac {b^{x+h} - b^x}h = \frac {b^xb^h - b^x}h = b^x \cdot (\frac {b^h -1}h) \to b^x \cdot \ln b$. Notice it is an entirely different type of calculation. Commented Aug 4, 2021 at 22:56
• BTW $x^b$ is consider a POWER and you use the POWER rule. $b^x$ is considered and EXPONENT and you use the EXPONENT rule. The POWER rule is $\frac {dx^k}{dx} = kx^{k-1}$. The EXPONENT rule is $\frac {db^x}{dx} = b^x\cdot \ln b$. Commented Aug 4, 2021 at 23:01

I think that you are confusing the rules. The rule you are misquoting is $$\frac{d}{dx} x^a =ax^{a-1}$$ (Note that $$x$$ is not in the exponent). To calculate the derivative of $$a^x$$ we will use the special property of $$e$$. More precisely, we have: \begin{align}\frac{d}{dx}a^x&=\frac{d}{dx} e^{x\ln a}\\[1ex]&=e^{x\ln a}\left(\dfrac{d}{dx}x\ln a\right)\\[1ex]&=e^{x\ln a}\ln a\\[1ex]&=a^x \ln a\end{align}

So for the more complex example, we have: \begin{align} \frac{d}{dx}[(2x+4)^{x+1}] &= \frac{d}{dx} e^{(x+1)\ln(2x+4)}\\[1ex]&= \left(\frac{d}{dx}((x+1)\ln(2x+4))\right)e^{(x+1)\ln(2x+4)}\\[1ex]&=\left(\ln(2x+4) +\frac{x+1}{2x+4}\right)e^{(x+1)\ln(2x+4)}\\[1ex]&=\left(\ln(2x+4)+\frac{1}{2}\frac{x+1}{x+2}\right)(2x+4)^{x+1} \end{align}

If you want a more general rule we can write: \begin{align}\frac{d}{dx} f(x)^{g(x)}&=\frac{d}{dx}e^{g(x)\ln(f(x))}\\[1ex]&=\left(g'(x)\ln(f(x))+g(x)\frac{1}{f(x)}\right)e^{g(x)\ln(f(x))}\\[1ex]&=\left(g'(x)\ln(f(x))+g(x)\frac{1}{f(x)}\right) f(x)^{g(x)}\end{align}

Hope that helps.

• Great answer but can you give me a more complex answer where this could be applied. A good example would be the second example in my question. Commented Aug 4, 2021 at 19:49
• I will add it now. Commented Aug 4, 2021 at 20:00
• @DragonflyRobotics I have added your complex example as well as a proof for a more general rule. Commented Aug 4, 2021 at 20:15

The "exponent rule" is for $$\frac{d}{dx} x^a$$ not $$\frac{d}{dx} a^x$$

To handle $$a^x$$, note $$a^x=e^{x \ln(a)}$$ and use the "chain rule" and $$\frac{d}{dx} e^x=e^x$$ so $$\frac{d}{dx} a^x = \frac{d}{dx} e^{x \ln(a)} = \ln(a) e^{x \ln(a)} =\ln(a) \,a^x$$

• Great answer but can you give me a more complex answer where this could be applied. A good example would be the second example in my question. Commented Aug 4, 2021 at 19:49

The derivative of $$2^x$$ is $$\ln(2)2^x$$, because $$2^x$$ is an exponential function.

Now when dealing with an exponential function of the form $$y=a^x$$, you can write $$a = e^{ln(a)}$$, so we can write $$a^x = e^{x\ln(a)}$$. Then using the chain rule you get $$a^x\ln(a)$$.

$$\frac{d}{dx} (2x+4)^{x+1}$$

And from the exponent rule we know

$$e^{(x+1)\ln(2x+4)}=(2x+4)^{x+1}$$

Then apply the chain rule

$$e^{(x+1)\ln(2x+4)}\frac{d}{dx}(x+1)\ln(2x+4)$$

Using the product rule, this gives

$$e^{(x+1)\ln(2x+4)}(\ln(2x+4)+\frac{x+1}{x+2})$$

And we saw that

$$e^{(x+1)\ln(2x+4)} = (2x+4)^{x+1}$$

So this ends up in

$$(\ln(2x+4)+\frac{x+1}{x+2})(2x+4)^{x+1}$$

You often, with more complex functions, need to use several rules. Just learn all the rules by heart and the rest is just practice, practice, practice, ...

The rules for $$x^a$$ and $$a^x$$ only work when $$a$$ is NOT a function of $$x$$. If $$a$$ is a function of $$x$$, then we exponentiate, like for example in the case of $$(2x+4)^{x+1}$$:

We rewrite it as $$e^{\ln{((2x+4)^{x+1}})}=e^{(x+1)\ln(2x+4)}$$. To differentiate this, we use the rule for the exponential, so the derivative is $$e^{(x+1)\ln(2x+4)}((x+1)\ln(2x+4))\prime$$, which, by the product rule for the derivative, becomes $$e^{(x+1)\ln(2x+4)}((x+1)\prime\ln(2x+4)+(x+1)\ln(2x+4)\prime)=e^{(x+1)\ln(2x+4)}(\ln(2x+4)+(x+1)\cdot\frac{2}{2x+4})=(e^{\ln(2x+4)})^{x+1} (\ln(2x+4)+(x+1)\cdot\frac{2}{2x+4})=(2x+4)^{x+1}(\ln(2x+4)+\frac{x+1}{x+2}$$.

You seem to be confusing two different rules: if $$f(x)=x^a$$, then $$f'(x)=ax^{a-1}$$; however, if $$f(x)=a^x$$, then $$f'(x)=a^x \cdot \ln(a)$$. This is because if $$f(x)=e^x$$, then by definition, $$f'(x)=e^x$$, and if $$f(x)=a^x$$, then we can rewrite $$f(x)$$ as $$e^{x\ln(a)}$$ and use the chain rule and product rule to obtain $$f'(x)=e^{x\ln(a)} \cdot \ln(a)=a^x\cdot\ln(a)$$. You can't apply the standard exponent rule because the function $$x\mapsto 2^x$$ has a constant base and a variable exponent, not a variable base and constant exponent. Every time you have a function of the form $$x\mapsto a^x$$, you should use the "$$\ln(x)$$ rule".

If $$f(x)=g(x)^{h(x)}$$, then things become even trickier: now, both the base and the exponent are variable. To get around this, you should rewrite $$f(x)$$ as $$e^{h(x)\cdot \ln(g(x))}$$. In the rewritten form, only the exponent is variable, and so we can use the "$$\ln(x)$$ rule", along with the chain and product rule. Let $$y=e^{h(x) \cdot \ln(g(x))}$$ and $$u=h(x) \cdot \ln(g(x))$$. Then, \begin{align} \frac{dy}{dx}&=\frac{dy}{du} \cdot \frac{du}{dx} \\[5pt] &=e^u \cdot \frac{d}{dx}\bigl(h(x) \cdot \ln(g(x))\bigr) \\[5pt] &= e^{h(x)\cdot \ln(g(x))} \cdot \left(h'(x)\ln(g(x))+h(x)\frac{h'(x)}{g(x)}\right) \\[5pt] &= g(x)^{h(x)} \cdot \left(h'(x)\ln(g(x))+h(x)\frac{h'(x)}{g(x)}\right) \, . \end{align} In the case $$g(x)=2x+4$$ and $$h(x)=x+1$$, this becomes $$\frac{dy}{dx}=(2x+4)^{x+1} \cdot \left(\ln(2x+4)+\frac{x+1}{2x+4}\right)$$