Let's start with the original:
#(cotx-tanx)/cosxsinx=csc^2x-sec^2x#
#(sinx/cosx)cotx-(sinx/cosx)tanx=csc^2x-sec^2x#
#(sinx/cosx)(cosx/sinx)-(sinx/cosx)(sinx/cosx)=csc^2x-sec^2x#
#1-(sin^2x/cos^2x)=csc^2x-sec^2x#
#1-tan^2x=csc^2x-sec^2x#
#color(red)("recall the identity" tan^2x=sec^2x-1#
#1-(sec^2x-1)=csc^2x-sec^2x#
#1-sec^2x+1=csc^2x-sec^2x#
#2-sec^2x!=csc^2x-sec^2x#
So as written the identity doesn't work. I suspect that what was meant was for the left hand #sinx# term to be in the denominator. Let's try that:
#(cotx-tanx)/(cosxsinx)=csc^2x-sec^2x#
#cotx/(cosxsinx)-tanx/(cosxsinx)=csc^2x-sec^2x#
#(cosx/sinx)/(cosxsinx)-(sinx/cosx)/(cosxsinx)=csc^2x-sec^2x#
#cosx/(sinxcosxsinx)-sinx/(cosxcosxsinx)=csc^2x-sec^2x#
#cancelcosx/(sinxcancelcosxsinx)-cancelsinx/(cosxcosxcancelsinx)=csc^2x-sec^2x#
#1/(sin^2x)-1/(cos^2x)=csc^2x-sec^2x#
#csc^2x-sec^2x=csc^2x-sec^2x#