Note
g=Gr2m1m2=G(R0+z)2m1m2=GR02m1m2(R0+zR0)2=g0(R0+zR0)2
Alright let's do geopotential
ϕ⟹(R0+z)2ϕ⟹ϕR02+2ϕzR0+ϕz2⟹ϕz2+(2ϕR0−g0R02)z+ϕR02=0=zg(z)=zg0(R0+zR0)2=zg0R02=zg0R02
and applying the quadratic formula we get
z=2a−b±b2−4ac=2ϕ(g0R02−2ϕR0)+(2ϕR0−g0R02)2−4ϕ2R02=2ϕ(g0R02−2ϕR0)+R02(2ϕ−g0R0)2−4ϕ2R02=2ϕ(g0R02−2ϕR0)+R0(2ϕ−g0R0)2−4ϕ2
verify: