differentiation from first principles trigonometry