T=theta so that it will not look so messy.
g(T)=TcscT
To find the first derivative, you must use the product rule. Product rule is derivative of the first times the second, plus the first times the derivative of the second, which will give you:
g'(T)=0xcscT + Tx-cscTcotT, which simplifies: g'(T)= -cscTxcotT
Now, take the derivative of that to get the second derivatice. In order to do that, you have to do the product rule again.
g"(T)=(cscTcotT)cotT + -cscT(-csc^2T) {that's csc squared} which simplifies:
g"(T)= cscTcot^2(T) + csc^3 (T)