$(\cos x)^{\sin x}$ derivative if $\cos x$ is negative I am trying to find the derivative of $(\cos x)^{\sin x}$. I used the transformation to $e^{\sin x \ln (\cos x)}$, but what if $\cos x$ is negative....? What to do? The $\ln$ won't be appropriate
 A: You can't take the derivative of $(\cos x)^{\sin x}$ if $\cos x$ is negative. The function is not even well defined for values of $x$ where $\cos x$ is negative. In these zones, the function starts behaving like $f(x)=x^x$ (look the behaviour of this function up). Also, look up the graoh of $(\cos x)^{\sin x}$ on Desmos- it may really help.
A: What if we allow complex values?
Of course $f(x) = (\cos x)^{\sin x}$ has derivative $$f'(x) = (\cos x)^{(\sin x)+1}\log(\cos x) - (\cos x)^{(\sin x) - 1}\sin^2 x.$$  As we often see with exponents in complex numbers, this is a "multivalued function".  Maple graphs this using "principal value" for these multivalued functions:
Graph of the real part

has a vertical asymptote at $x=3\pi/2$.
Graph of the imaginary part.

has a jump at $x=3\pi/2$ where it changes from one branch to another.
A: $$y=(\cos x)^{\sin x} \tag 1 $$
Due to negative base, logarithm  would be complex. For $(a,b) $ positive in general
$$ \log_{( -b\;)}a= \frac{\log a }{\log b + (2k-1) \pi};\tag 2 $$
Next take log for (1) and differentiate w.r.t $x$
$$\frac{y'}{y}= \cos x \cdot \log (\cos x) -\frac{\sin^2 x}{\cos x}$$
$$y'= \log (\cos x) \cdot\cos x ^{ (\sin x +1)} -{\sin^2 x}\cdot {\cos x }^{ (\sin x -1)} \tag 3 $$
would be also complex, can be evaluated by applying (2).
