fun stuff...
First let ((1+cosx)/(1-cosx)) = u
f(x) = ln(u)
f'(x) = (1/u)(du/dx) = (1-cosx)/(1+cosx) * (d((1+cosx)/(1-cosx))/dx)
=(1-cosx)/(1+cosx)*((1-cosx)d(1+cosx) - (1+cosx)d(1-cosx))/((1+cosx)(1-cosx)^2)
=((1-cosx)(-sinx) + (1+cosx)(-sinx))/((1+cosx)(1-cosx))
=((cosx-1)sinx - (1+cosx)sinx)/((1+cosx)(1-cosx)
= (cosx*sinx-sinx-sinx-cosx*sinx)/((1+cosx)(1-cosx))
=(-2sinx)/(1-cos^2(x))
=-2sinx/sin^2(x)
=-2/sinx = -2cosec(x)
It's kind of messy,I can send you a word version if you want.