dy/dx = cosx * (sinx/|sinx|)
If sinx = -a, where a > 0
dy/dx = cosx * (-a/|-a|)
= cosx * (-a/a)
= -cosx
Oh, I forgot, there are actually three possibilities:
sinx > 0 -> dy/dx = cosx
sinx < 0 -> dy/dx = -cosx
sinx = 0 -> function not differentiable at that point.