(sinx)^2+(cosx)^2=1 is the fundamental identity. Divide through by (sinx)^2: 1+(ctnx)^2=1/(sinx)^2 so sinx(1+ctn^2x)=sinx/(sinx)^2=1/sinx=cscx.
ctn^2x/(1+ctn^2x): multiply top and bottom by tan^2x: 1/(tan^2x+1)=1/sec^2x=cos^2x.
sinA/tanA-tanA/secA: sinAcosA/sinA-sinA/1=cosA-sinA.
secYcosY-cos^2Y=1-cos^2Y=sin^2Y