The derivative of $(\sin(x) - 1)^{\cos(x) + 1} + (\sin(x) + 1 )^{1 - \cos(x)}$? What is the derivative of $ f(x) = (\sin(x) - 1)^{\cos(x) + 1} + (\sin(x) + 1 )^{1 - \cos(x)}$
I don't know how to approach this one. I tried to apply the natural logarithm to both functions on the right side, then derive it and I get the same result as Wolfram Alpha but I have several problems with that. First of all when I apply it to $(\sin(x) - 1)^{\cos(x) + 1}$ I get :
$$ (\cos(x) + 1)\cdot\ln(\sin(x) - 1) $$
which does not make any sense since $\sin(x) - 1 \in [-2, 0] $
and the problem with $\sin(x) + 1$ is the number zero since $\sin(x) + 1 \in [0, 2] $ and I can't take the logarithm of non-positive numbers.  
The second thing that bothers me is that when I enter the function $g(x) = (\sin(x) - 1)^{\cos(x) + 1}$ into Wolfram Alpha, it tells me that the domain and range of this function are empty sets but isn't for example:
$$ g(\frac{\pi}{2}) = (\sin(\frac{\pi}{2}) - 1)^{\cos\frac{\pi}{2} + 1} = (1-1)^{0+1} = 0^1 = 0$$
a valid thing to do in the real numbers?
EDIT:
This is homework for my Mathematical Analysis class (first year of college). We work only with the set of real numbers. We defined the domain of the logarithm function to be:   $\mathscr{D}_{log} = \langle 0 , +\infty \rangle \subseteq \mathbb{R}$
 A: In the context of real analysis, the domain of $f$ is the set $\{\pi/2+\pi n: n\in\mathbb Z\}$. The definition of derivative at point $x$ requires $f$ to be defined on some open interval containing $x$. Since $f$ fails this requirement, it fails to have a derivative. Answer: "does not exist" / "not defined",  whichever form you prefer. 
Another popular example of this kind is "find the derivative of $\ln \ln \sin x$". 
A: For $(sin(x)-1)^{cos(x)+1}$ we have,
$$(sin(x)-1)^{cos(x)+1}=e^{log((sin(x)-1)^{cos(x)+1})}=e^{(cos(x)+1)log(sin(x)-1)}=e^{cos(x)log(sin(x)-1)}(sin(x)-1)=(e^{log(sin(x)-1)})^{cos(x)}(sin(x)-1)...$$
A: Hint:
Can you show that
$$
i=\frac{\ln(-1)}{\pi}
$$
the proof (consider the famous Euler equation....) might help explain what happens when you take $\ln\left(\sin x-1\right)$ for certain $x$.
A: Try
$$(sin(x)-1)^{cos(x)+1}=e^{log((sin(x)-1)^{cos(x)+1})}=e^{(cos(x)+1)log(sin(x)-1)}=e^{t}$$
where $t=(cos(x)+1)log(sin(x)-1)$
and the you can use the normal chain rule and product rule. This should also work for the other part ($sin(x)+1$ etc)
