# Differentiate $5^{x \cos x}$

How do I differentiate $5^{x \cos x}$? From my book, it should be implicit differentiation, but how do I start?

If I let $u = x \cos x$, then I get

$$\begin{eqnarray} \frac{dY}{dX} &=& u \cdot 5^{u - 1} \cdot \frac{du}{dX} \\ &=& x \cdot \cos x \cdot 5^{x \cos x-1} \cdot (\cos x-x \sin x) \end{eqnarray}$$

I don't suppose I did it right... The correct answer is

$$\ln5 \cdot 5^{x \cos x}\cdot (\cos x-x \sin x) .$$

-
We have $5=e^{\ln 5}$. So our function is $e^{(\ln 5)(x\cos x)}$. Now use the Chain Rule. Or else let $y=5^{x\ln x}$. Then $\ln y=(x\ln x)(\ln 5)$. Differentiate both sides with respect to $x$, using implicit differentiation for the left-hand side. –  André Nicolas Oct 17 '11 at 6:34
What happens if you take the logarithm? –  Mark Bennet Oct 17 '11 at 6:35
Ah ... 1 thing I dont get is how is $5=e^{ln5}$. Also how did you convert $xcosx \rightarrow x ln x$ –  Jiew Meng Oct 17 '11 at 6:38
@jiewmang: The logarithm is the inverse of the exponential function, so $\exp\ln x=\ln\exp x=x$. I think André made an error when he spoke of $x\ln x$, I think he meant $x\cos x$. –  anon Oct 17 '11 at 6:43
Oh I think I am getting you, the part about inverse ... but what bothers me is I could explain the 2nd part, $ln(e^x)=xlog_e e=x$, but I can't derive x from $e^{lnx}$. Apart from "understanding" $\ln{x}$ and $e^x$ are inverse –  Jiew Meng Oct 17 '11 at 7:13
show 1 more comment

Your error is that the derivative of $5^u$ (with respect to $u$) is not $u5^{u-1}$; this isn't $u$ to a power but rather a base to the power of $u$. The usual route is with André's advice: write the function as an exponential, so $5^{x\cos x}=(e^{\ln5})^{x\cos x}=\exp(\ln5\cdot x\cos x)$. Here we use the fact that the natural logarithm and exponential functions are inverse functions of each other, so $\exp\ln a=\ln\exp a=a$.
I wonder why no one mentioned the rule:$\frac{d}{dx}a^{x}=a^x.\ln a$ for $a>0$. –  Tapu Oct 17 '11 at 10:57
@Swapan: Because the rule is derived first by making $a^x$ into $\exp(x \ln a)$ and then applying the chain rule, as here. When learning theory one shouldn't use rules before one knows why they work... –  anon Oct 17 '11 at 11:00
@J.M. and anon: My point was just a mention...may be then how it works or in reverse order. Once, simplified (and probably knowing how it works), I always found it is useful to use the ready-made rule;, e.g., to use Binomial Theorem to expand $(a+b)^8$ than multiplying 8 times or in this case using the original definition of derivative as limits :) –  Tapu Oct 17 '11 at 11:45