By definition the derivative of f(x) is:
lim_(h->0) (f(x+h)-f(x))/h
For f(x) = cotx:
d/dxcotx = lim_(h->0) (cot(x+h)-cot(x))/h
Now use the trigonometric identity:
cot(x+h) = cos(x+h)/sin(x+h) = ( cosxcosh-sinxsinh)/(cosxsinh+sinxcosh) = ( (cosxcosh)/(sinxsinh)-1)/((cosxsinh+sinxcosh)/(sinxsinh)) = (cotxcoth -1) / (cotx+cot h)
and we have:
d/dxcotx = lim_(h->0) ((cotxcoth -1) / (cotx+cot h)-cot(x))/h
d/dxcotx = lim_(h->0) (cotxcoth -1 -cot(x)(cotx+cot h))/(h(cotx+cot h))
d/dxcotx = lim_(h->0) (cancel(cotxcoth) -1 -cot^2x-cancel(cotxcot h))/(h(cotx+cot h))
d/dxcotx = lim_(h->0)- ( 1 +cot^2x)/(h(cotx+cot h))
d/dxcotx = - ( 1 +cot^2x) lim_(h->0) 1/(h(cotx+cot h))
evaluate the limit by expading the denominator:
lim_(h->0) 1/(h(cotx+cot h)) = lim_(h->0) 1/(h(cosx/sinx+cos h/sinh))
lim_(h->0) 1/(h(cotx+cot h)) = lim_(h->0) 1/(hcosx/sinx+(cos h*(h/sinh))
And as lim_(h->0) sinh/h = 1:
lim_(h->0) 1/(h(cotx+cot h)) = lim_(h->0) 1/(0+(1*1)) = 1
so:
d/dxcotx = - ( 1 +cot^2x)
and as:
1+cot^2x = 1+cos^2x/sin^2x = (sin^2x+cos^2x)/sin^2x = 1/sin^2x
we can conclude:
d/dxcotx = -1/sin^2x