How to use implicit differentiation with trig