$$y = (\cos x)^{(\sin x)^x}$$

I'm not sure at all how to solve this problem. I know that the derivative of $a^x$ is $a^{x}ln(a)$. I know the derivative of $\cos(x)$ is $-\sin(x)$ and that the derivative of $\sin(x)$ is $\cos(x)$.

I assume that I start with $(\sin x)^x$. Will the derivative of that part be

$(\sin x)^{x}*\ln(\sin(x))*\cos(x)$

Does this rule work with the chain rule? Should I differentiate the $\ln(\sin(x))$ once more? I don't think so, but I'm quite confused, so a clarification would be nice.

This is the first problem which has so many "layers" and I'm not sure how to put the rest of the equation into the chain rule.

Thank you for the help.

  • $\begingroup$ To get more than one character in an exponent or subscript, enclose them in braces: (\cos x)^{(\sin x)^x} renders to $(\cos x)^{(\sin x)^x}$ $\endgroup$ – Paul Sinclair Oct 14 '15 at 3:33
  • $\begingroup$ I find that keeping track of where I am in the chain rule is more difficult with a stack of exponents, and so I would write out functions $f,g,h(x)$, solve the chain rule in this (slightly) more abstract case. Then you can separately differentiate each to get the needed $f',g',h'(x)$ to write the final expression. $\endgroup$ – user208649 Oct 14 '15 at 3:37
  • $\begingroup$ @CuddlyCuttlefish I think that would be the best solution and it's what I was trying to achieve (I am not familiar with the methods used by Bill Cook or Paramanand Singh). Could you be so kind and provide an answer using this method? $\endgroup$ – Daniel Waleniak Oct 14 '15 at 3:42
  • $\begingroup$ I posted what I would do - note that it is equivalent because they all require logarithmic differentiation. I prefer it because nearly all of the arithmetic difficulty is delayed until simplification, but that seems (to me) like less of a tradeoff because all of the methods require some simplification to neaten the answers. $\endgroup$ – user208649 Oct 15 '15 at 19:11

You need a combination of chain rule as well as logarithmic differentiation. Let the function be denoted by $y = f(x)$ so that $$y = (\cos x)^{(\sin x)^{x}}$$ and on taking logs we get $$\log y = (\sin x)^{x}\log\cos x$$ Further taking logs gives us $$\log\log y = x\log\sin x + \log\log\cos x$$ and then we differentiate using chain rule to get $$\frac{1}{\log y}\cdot\frac{1}{y}\cdot\frac{dy}{dx} = \log \sin x + x\cot x + \frac{1}{\log \cos x}\cdot\frac{-\sin x}{\cos x}$$ and finally we get \begin{align} \frac{dy}{dx} &= y\log y\left(\log\sin x + x\cot x - \frac{\tan x}{\log\cos x}\right)\notag\\ &= (\cos x)^{(\sin x)^{x}}(\sin x)^{x}\log \cos x\left(\log\sin x + x\cot x - \frac{\tan x}{\log\cos x}\right)\notag\\ \end{align}

Update: Note that the method of logarithmic differentiation is symbolic and does not take care of fine details. It does produce the correct answer, but there is a subtle mistake in above argument.

First of all note that the function $y = f(x) = (\cos x)^{(\sin x)^{x}}$ is defined only when both $\sin x$ and $\cos x$ are positive which means that $x$ lies in the first quadrant (excluding end points of the quadrant). Even if we assume that the value of $x$ is in first quadrant then $\log \cos x$ is defined but already negative and hence taking a second log is not justified so that we can't have an expression like $\log\log\cos x$. The way out is to differentiate $\log y = (\sin x)^{x}\log \cos x$ using product rule taking $$u = (\sin x)^{x}, v = \log\cos x, \log y = uv$$ In order to proceed further we need find $\dfrac{du}{dx}$ and for that we take logs to get $\log u = x\log \sin x$ and on differentiating we get $$\frac{1}{u}\cdot\frac{du}{dx} = x\cot x + \log \sin x$$ or $$u' = \frac{du}{dx} = (\sin x)^{x}(x\cot x + \log \sin x)$$ We then have $$\frac{1}{y}\cdot\frac{dy}{dx} = uv' + u'v = (\sin x)^{x}(-\tan x) + (\sin x)^{x}(x\cot x + \log \sin x)\log\cos x$$ or $$\frac{dy}{dx} = y(\sin x)^{x}\log\cos x\left(x\cot x + \log \sin x - \frac{\tan x}{\log\cos x}\right)$$ and putting value of $y$ we get the same answer as before.

  • $\begingroup$ I've never seen this method, but thank you for the clear explanation. I will try to understand it. $\endgroup$ – Daniel Waleniak Oct 14 '15 at 3:46
  • $\begingroup$ You left out "implicit differentiation" from the list of techniques applied here. $\endgroup$ – Paul Sinclair Oct 14 '15 at 3:58
  • $\begingroup$ @PaulSinclair: where have I used implicit differentiation? $\endgroup$ – Paramanand Singh Oct 14 '15 at 4:01
  • $\begingroup$ @DanielWaleniak: The method of logarithmic differentiation is pretty standard one available in introductory calculus textbooks. It should be used if you get an expression of type $\{f(x)\}^{g(x)}$ where both the base and exponent are variables. If either of base or exponent is constant then you know the simple rules $(x^{a})' = ax^{a - 1}, (a^{x})' = a^{x}\log a$. $\endgroup$ – Paramanand Singh Oct 14 '15 at 4:05
  • $\begingroup$ ${d\over dx} \log \log y = {1 \over \log y}\cdot{1 \over y}\cdot {dy \over dx}$ is implicit differentiation. Not a major omission, but I thought it worth noting that the technique had been used. $\endgroup$ – Paul Sinclair Oct 14 '15 at 4:05

I find it very easy to make mistakes when using the chain rule with exponent towers or just large functions in general. Instead, let's define the following functions and their derivatives: $$f(x) = \ln(x) \Rightarrow f'(x) = \frac{1}{x}$$ $$g(x) = \cos(x)\Rightarrow g'(x) = -\sin(x)$$ $$h(x) = \sin(x)\Rightarrow h'(x) = \cos(x)$$

Then we know that $$f(f(y)) = xf(h(x)) + f(f(g(x))$$

Apply the chain rule and product rule to differentiate both sides: $$f'(f(y))f'(y)y' = [xf'(h(x))h'(x) + f(h(x))] + [f'(f(g(x))f'(g(x))g'(x)]$$ $$y' = \frac{xf'(h(x))h'(x) + f(h(x)) + f'(f(g(x))f'(g(x))g'(x)}{f'(f(y))f'(y)}$$

Replace with the functions $$y' = \frac{x\frac{1}{\sin(x)}\cos(x) + \ln(\sin(x)) + \frac{1}{\ln(\cos(x))}\frac{1}{\cos(x)}(-\sin(x))}{\frac{1}{(\sin(x))^x\ln(\cos(x))}\frac{1}{(\cos(x))^{(\sin(x))^x}}}$$

This is equivalent to the accepted answer (change the divided trig functions to $\tan$ or $\cot$ and flip the bottom over).

I find this much easier because you compute $3$ simple derivatives, the natural logarithm, sine, and cosine. The only trick was using the logarithm to make it possible to express the function in simple form; but any time you have $(something)^x$, you should expect to do something equivalent to logarithmic differentiation.

After that, just apply the product rule and the chain rule to differentiate each side, and then divide by some terms from the LHS to isolate $y'$. For me at least, I'm much less likely to make arithmetic errors by pushing around letters than I am with actual values.

Then you can just replace each of the $f,g,h$ and $f',g',h'$ in the expression and simplify if necessary.


Generally you want to use exponentials and logs to unravel complicated powers.

$y = \cos(x)^{(\sin(x))^x} = e^{\ln\left(\cos(x)^{(\sin(x))^x}\right)}=e^{(\sin(x)^x\ln(\cos(x))} = e^{e^{\ln((\sin(x))^x)}\ln(\cos(x))} = e^{e^{x\ln(\sin(x))}\ln(\cos(x))}$

Now differentiating is a little more straight forward -- I guess...

$y' = e^{e^{x\ln(\sin(x))}\ln(\cos(x))} \cdot \dfrac{d}{dx}\left[e^{x\ln(\sin(x))}\ln(\cos(x))\right]$ $= e^{e^{x\ln(\sin(x))}\ln(\cos(x))} \cdot \left( \dfrac{d}{dx}\left[e^{x\ln(\sin(x))}\right]\ln(\cos(x))+e^{x\ln(\sin(x))}\dfrac{-\sin(x)}{\cos(x)}\right)$ $= e^{e^{x\ln(\sin(x))}\ln(\cos(x))} \cdot \left( e^{x\ln(\sin(x))}\left(\ln(\sin(x))+x\dfrac{\cos(x)}{\sin(x)}\right)\ln(\cos(x))+e^{x\ln(\sin(x))}\dfrac{-\sin(x)}{\cos(x)}\right)$

At this point, you could start collapsing exponentials and logs back down (if you needed to simplify).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.