Consider a body of mass 'm' projected vertically upwards from the surface of the earth with velocity ve. In other to escape from the gravitational pull of the earth ,the body should be given kinetic energy which is equal to the potential energy of the body.
Gravitational potential energy = -GMm / R
Kinetic energy =1/2 mve2
----> 1/2 mve2 = GMm / R
----> 1/2 ve2 = GM / R
----> Ve2 = 2GM / R
But g = GM / R2
----> GM = gR2
Substituting the value;
----> ve2 = 2/R (gR2) = 2gR
----> ve2 = √2gR.