Answer:
A general solution is
and a particualr case is mgh, it is just to distance around the radius Earth.
Step-by-step explanation:
We can use a general equation of the potential energy to understand the particular and general case:
The potential energy is defined as
, we know that the gravitational force is
, so we could find the potential energy taking the integral of F.
(1)
We can find the particular case, just finding the gravitational potential energy difference:
. Here Uf is the potential evaluated in r+Δh and Ui is the potential evaluated in r.
Using (1) we can calculate ΔU.

Simplifying and combining terms we have a simplified expression.
(2)
Let's call
. It is the acceleration due to gravity on the Earth's surface, if r is the radius of Earth and M is the mass of the Earth and we can write (2) as ΔU=mgh, but if we have distance grader than r we should use (2), otherwise, we could get incorrect values of potential energy.
I hope i hleps you!