how to differentiate implicit function