\(\frac{2}{sinx}-\frac{sinx}{1+cosx}=\frac{2\left(1+cosx\right)-sin^2x}{sinx\left(1+cosx\right)}=\frac{2+2cosx-sin^2x}{sinx\left(1+cosx\right)}\)
\(=\frac{\left(1-sin^2x\right)+2cosx+1}{sinx\left(1+cosx\right)}=\frac{cos^2x+2cosx+1}{sinx\left(1+cosx\right)}=\frac{\left(cosx+1\right)^2}{sinx\left(1+cosx\right)}=\frac{1+cosx}{sinx}\)