Differentiate trigonometric functions