You can put this solution on YOUR website! lets rationalize by multiplying the denominator and numerator by 1-cosx
(1-cosx)^2 / (1-cos^2x)
1-2cosx+cos^2x / sin^2x
1/sin^2x -2cosx/sin^2x + cos^2x/sin^2x
cosec^2x -2cosx/sin^2x + cot^2x
(cosecx-cotx)^2(proven)
[ by using a^2 - 2ab + b^2 = (a-b)^2 ]