We must use the product rule, which states that for any three functions #a#, #b# and #f#, such that #f(x) = a(x)*b(x)#, then
#f'(x) = a'(x)*b(x) + a(x)*b'(x)#.
In our case, #a(x) = x# and #b(x) = 1/sinx#. Substitute them into the original identity ;
#f'(x) = color(red)(1)*1/sinx + x*color(red)((-cos x/sin^2 x))#
Where the parts in #color(red)("red")# are #a'(x)# and #b'(x)#, respectively.
#f'(x) = 1/sin x * color(blue)(sin x/sin x) - x(cos x/sin^2 x)#
We can factor out the #1/sin^2 x#, and finally, we get :
#f'(x) = 1/sin^2 x (sin x - x cos x)#.