Let

\[y=a^{x},\qquad a>0.\tag{a}\]

Taking the natural logarithm (= logarithm to the base $e$) of both sides, we get
\[\ln y=x\ln a\]
or
\[\begin{aligned} x & =\frac{\ln y}{\ln a}\\
& =\frac{1}{\ln a}\ln y.
\end{aligned}\]

Differentiating with respect to \(y\), we get
\[\frac{dx}{dy}=\frac{1}{\ln a}\cdot\frac{1}{y}.\tag{b}\]
It follows from the Derivative Rule for Inverses that
\[\frac{dy}{dx}=\ln a\cdot y\] or \[\frac{dy}{dx}=\ln a\cdot a^{x}.\] Hence, \[ \bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}a^{x}=\ln a\cdot a^{x}.\tag{c}}\] When \(a=e\), \(\ln a=\ln e=1\), and the formula becomes \[ \bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}e^{x}=e^{x}.\tag{d}}\]

Now consider \(y=u^{v}\), where \(u\) and \(v\) are functions of \(x\). To find \(y’\), we take natural logarithm of both sides:

\[\ln y=v\ln u\]

Now we can use logarithmic differentiation or write the above equation as

\[y=e^{v\ln u},\]

and then apply (d) and the chain rule:

\[\begin{aligned}
\frac{dy}{dx} & =e^{v\ln u}\frac{d}{dx}(v\ln u)\\
& =u^{v}\left[\frac{dv}{dx}\cdot\ln u+v\frac{d}{dx}\ln u\right]\\
& =u^{v}\left[\frac{dv}{dx}\ln u+v\left(\frac{d}{du}\ln u\cdot\frac{du}{dx}\right)\right]\\
& =u^{v}\left[\frac{dv}{dx}\ln u+v\left(\frac{1}{u}\cdot\frac{du}{dx}\right)\right]\\
& =\ln u\cdot u^{v}\frac{dv}{dx}+v\cdot u^{v-1}\frac{du}{dx}.\end{aligned}\]

Hence, \[ \bbox[#F2F2F2,5px,border:2px solid black]{\frac{d}{dx}u^{v}=\ln u\cdot u^{v}\frac{dv}{dx}+v\cdot u^{v-1}\frac{du}{dx}\tag{e}}\]

The derivative of a function with a variable exponent is equal to the sum of the two results obtained by first differentiating, regarding the exponent as constant, and again differentiating regarding the function as constant.

Example 1
If \(y=a^{3x^{2}}\), where \(a\) is a constant, find \(dy/dx\).
Solution
Placing \(v=3x^{2}\), and using (c) and the chain rule, we have \[\begin{aligned} \frac{dy}{dx} & =\frac{dy}{dv}\frac{dv}{dx}\\ & =\ln a\cdot a^{v}\cdot\frac{dv}{dx}\\ & =\ln a\cdot a^{3x^{2}}\frac{d}{dx}(3x^{2})\\ & =6x\ln a\cdot a^{3x^{2}}.\end{aligned}\]
Example 2
Differentiate \(y=be^{c^{2}+x^{2}}\) with respect to \(x\).
Solution
Let \(v=c^{2}+x^{2}\). Using (c) and the chain rule, we have \[\begin{aligned} \frac{dy}{dx} & =\frac{dy}{dv}\frac{dv}{dx}\\ & =be^{c^{2}+x^{2}}\frac{d}{dx}(c^{2}+x^{2})\\ & =2bxe^{c^{2}+x^{2}}.\\\end{aligned}\]
Example 3
Differentiate \(y=x^{(e^{x})}\) with respect to \(x\).
Solution
Method (a): Let \(u=x\) and \(v=e^{x}\). Now using (e), we get \[\begin{aligned} \frac{dy}{dx} & =\ln x\cdot x^{\left(e^{x}\right)}\frac{d}{dx}(e^{x})+e^{x}x^{\left(e^{x}-1\right)}\frac{d}{dx}(x)\\ & =\ln x\cdot e^{x}\cdot x^{\left(e^{x}\right)}+e^{x}x^{\left(e^{x}-1\right)}\cdot1\\ & =e^{x}x^{\left(e^{x}\right)}\left(\ln x+\frac{1}{x}\right).\end{aligned}\] Method (b): Taking natural logarithm of both sides: \[\begin{aligned} \ln y & =\ln x^{(e^{x})}\\ & =e^{x}\ln x\end{aligned}\] Now we can differentiate both sides: \[\begin{aligned} \frac{1}{y}\frac{dy}{dx} & =\frac{de^{x}}{dx}\ln x+e^{x}\left(\frac{d}{dx}\ln x\right)\\ & =e^{x}\ln x+e^{x}\frac{1}{x}\end{aligned}\] [Recall that \((uv)’=u’v+uv’\) and \((\ln x)’=1/x\).] Multiplying both sides by \(y\) yields \[\begin{aligned} \frac{dy}{dx} & =\overbrace{{y}}^{=x^{(e^{x})}}\left(e^{x}\ln x+\frac{e^{x}}{x}\right)\\ & =x^{(e^{x})}e^{x}\left(\ln x+\frac{1}{x}\right).\end{aligned}\]
Example 4
Find \(dy/dx\) if \[y=\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}.\]
Solution
Method (a): We may use formula (e). Here \(u=x^{2}/\sqrt{x^{2}+1}\) and \(v=\sin x\). Therefore, \[\begin{aligned} \frac{dy}{dx} & =\left(\ln\frac{x^{2}}{\sqrt{x^{2}+1}}\right)\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\cos x\\ & \ \quad+\sin x\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x-1}\left(\frac{2x\sqrt{x^{2}+1}-\frac{x^{2}(2x)}{2\sqrt{x^{2}+1}}}{x^{2}+1}\right)\\ & =\left(\ln\frac{x^{2}}{\sqrt{x^{2}+1}}\right)\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\cos x\\ & \ \quad+\sin x\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x-1}\left(\frac{2x}{\sqrt{x^{2}+1}}-\frac{x^{3}}{(x^{2}+1)^{\frac{3}{2}}}\right).\end{aligned}\]

Method (b): Let \[y=\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}.\] Then take the natural logarithm of both sides \[\begin{aligned} \ln y & =\ln\left[\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\right]\\ & =\sin x\ln\frac{x^{2}}{\sqrt{x^{2}+1}}\\ & =\sin x\left[\ln x^{2}-\ln\sqrt{x^{2}+1}\right]\\ & =\sin x\left[2\ln x-\frac{1}{2}\ln(x^{2}+1)\right]\end{aligned}\] Now differentiate both sides \[\begin{aligned} \frac{y’}{y} & =\cos x\left[2\ln x-\frac{1}{2}\ln(x^{2}+1)\right]\\ & \qquad+\sin x\left[\frac{2}{x}-\frac{1}{2(x^{2}+1)}\frac{d}{dx}(x^{2}+1)\right]\\ & =\cos x\left[\ln\frac{x^{2}}{\sqrt{x^{2}+1}}\right]\\ & \qquad+\sin x\left[\frac{2}{x}-\frac{x}{x^{2}+1}\right].\end{aligned}\] So \[\begin{aligned} y’ & =y\left(\cos x\left[\ln\frac{x^{2}}{\sqrt{x^{2}+1}}\right]+\sin x\left[\frac{2}{x}-\frac{x}{x^{2}+1}\right]\right)\\ & =\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\cos x\ \ln\frac{x^{2}}{\sqrt{x^{2}+1}}\\ & \ \quad+\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\sin x\ \left[\frac{2}{x}-\frac{x}{x^{2}+1}\right].\end{aligned}\]

The result of the second method is actually the same as the result of the first method; we just need to notice that \[\small{\begin{aligned} \left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\sin x\ \left[\frac{2}{x}-\frac{x}{x^{2}+1}\right] & =\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x}\sin x\ \left[\frac{2}{x}-\frac{x}{x^{2}+1}\right]\left(\frac{\frac{x^{2}}{\sqrt{x^{2}+1}}}{\frac{x^{2}}{\sqrt{x^{2}+1}}}\right)\\ & =\sin x\left(\frac{x^{2}}{\sqrt{x^{2}+1}}\right)^{\sin x-1}\left[\frac{2x^{\bcancel{2}}}{\bcancel{x}\sqrt{x^{2}+1}}-\frac{x^{3}}{(x^{2}+1)^{3/2}}\right] \end{aligned}}\]