using the formula
#x=rcostheta#
and
#y=rsintheta#
substitute
#(rsintheta)^2=((rcostheta-1)^2)/(rsintheta)-3(rcostheta)^2rsintheta#
expand brackets and simplify
#r^2sin^2theta=(r^2cos^2theta-2rcostheta+1)/(rsintheta)-3r^2cos^2thetarsintheta*(rsintheta)/(rsintheta)#
#r^2sin^2theta=(r^2cos^2theta-2rcostheta+1)/(rsintheta)-(3r^2cos^2thetarsin^2theta)/(rsintheta)#
#r^2sin^2theta=(r^2cos^2theta-2rcostheta+1-3r^2cos^2thetarsin^2theta)/(rsintheta)#
simplify
#r^2sin^2theta=(r^2cos^2theta-2rcostheta+1-3r^3cos^2thetasin^2theta)/(rsintheta)#
factorise
#r^2sin^2theta=(r(rcos^2theta-2costheta-3r^2cos^2thetasin^2theta)+1)/(rsintheta)#
#r^2sin^2theta=(cancel(r)(rcos^2theta-2costheta-3r^2cos^2thetasin^2theta))/(cancel(r)sintheta)+(1)/(rsintheta)#
multiply by #1/sin^2theta#
#1/cancel(sin^2theta)*r^2cancel(sin^2theta)=1/sin^2theta((rcos^2theta-2costheta-3r^2cos^2thetasin^2theta)/(sintheta)+(1)/(rsintheta))#
expand the brackets
#r^2=(rcos^2theta-2costheta-3r^2cos^2thetasin^2theta)/(sin^3theta)+(1)/(rsin^3theta)#
factorise
#r^2=1/sin^3theta(rcos^2theta-2costheta-3r^2cos^2thetasin^2theta+1/r)#
convert #sin^2theta# to #1-cos^2theta#
#r^2=1/sin^3theta(rcos^2theta-2costheta-3r^2cos^2theta(1-cos^2theta)+1/r)#
expand the #-3r^2cos^2theta(1-cos^2theta)# brackets
#r^2=1/sin^3theta(rcos^2theta-2costheta-3r^2cos^2theta+3r^2cos^4theta+1/r)#
factorise the terms with #rcos^2theta# in it out
#r^2=1/sin^3theta(rcos^2theta(1-3r+3rcos^2theta)-2costheta+1/r)#
factorise
#r^2=1/sin^3theta(costheta(rcostheta(1+3r(-1+cos^2theta)-2))+1/r)#