(sinx+cosx-1)(sinx-cosx+1)/sin2x
=[sinx+(cosx-1)][sinx-(cosx-1)]/sin2x
=[(sinx)^2-(cosx-1)^2]/sin2x
=[(sinx)^2-(cosx)^2-1+2cosx]/sin2x
={(sinx)^2-(cosx)^2-[(sinx)^2+(cosx)^2]+2cosx}/sin2x
=[2cosx-2(cosx)^2]/sin2x
=2cosx(1-cosx)/2sinxcosx
=(1-cosx)/sinx
=tanx/2