There should only be two terms when you use the product rule - not three. I suspect you mean which is the correct.

Spoiler:

edit: I put the original second question in a spoiler since the OP edited it out

For your (new) second equation you can take the derivatives separately.

If you don't know the derivative of -csc(x) then you can write it as and use the chain rule.