It is
cot²(x) + 1 = csc²(x)
hence for x=theta/2
cot(theta/2)=sqrt(csc^2(theta/2)-1)
But
csc(theta/2)=1/(sin(theta/2))=1/(sin(theta)/[2*cos(theta/2)])=
2*cos(theta/2)/(sin(theta))
But cos(2theta)=2cos^2theta-1=>
cos^2theta=1/2*(1+cos(2theta))
Hence cos(theta/2)=1/sqrt2*(1+costheta)=1/sqrt2*[1+sqrt(1-sintheta)]=>
cos(theta/2)=1/sqrt2*[1+sqrt(1-1/(csctheta))]
And
csc(theta/2)=2*cos(theta/2)/(sin(theta))=>
csc(theta/2)=2*[1/sqrt2*[1+sqrt(1-1/(csctheta))]]*csctheta=>
csc(theta/2)=sqrt2*csctheta*[1+sqrt(1-1/(csctheta))]
Finally
cot(theta/2)=sqrt([sqrt2*csctheta*(1+sqrt(1-1/(csctheta)))]^2-1)