Gravitational energy. Gravitational energy or gravitational potential energy is the potential energy a massive object has due to its position in a gravitational field. Mathematically, it is the minimum mechanical work that has to be done against the gravitational force to bring a mass from a chosen reference point (often an "infinite distance" from the mass generating the field) to some other point in the field, which is equal to the change in the kinetic energies of the objects as they fall towards each other. Gravitational potential energy increases when two objects are brought further apart and is converted to kinetic energy as they are allowed to fall towards each other.

Formulation
For two pairwise interacting point particles, the gravitational potential energy  is the work that an outside agent must do in order to quasi-statically bring the masses together (which is therefore, exactly opposite the work done by the gravitational field on the masses): 

where  is the displacement vector of the mass,  is gravitational force acting on it and  denotes scalar product.

Newtonian mechanics 

In classical mechanics, two or more masses always have a gravitational potential. Conservation of energy requires that this gravitational field energy is always negative, so that it is zero when the objects are infinitely far apart. The gravitational potential energy is the potential energy an object has because it is within a gravitational field.

The magnitude & direction of gravitational force experienced by a point mass , due to the presence of another point mass  at a distance , is given by Newton's law of gravitation.
Taking origin to be at the position of ,To get the total work done by the gravitational force in bringing point mass  from infinity to final distance  (for example, the radius of Earth) from point mass , the force is integrated with respect to displacement:
Gravitational potential energy being the minimum (quasi-static) work that needs to be done against gravitational force in this procedure,

Simplified version for Earth's surface 
In the common situation where a much smaller mass  is moving near the surface of a much larger object with mass , the gravitational field is nearly constant and so the expression for gravitational energy can be considerably simplified.  The change in potential energy moving from the surface (a distance  from the center) to a height  above the surface is

If  is small, as it must be close to the surface where  is constant, then this expression can be simplified using the binomial approximation

to

As the gravitational field is , this reduces to

Taking  at the surface (instead of at infinity), the familiar expression for gravitational potential energy emerges:

General relativity 

In general relativity gravitational energy is extremely complex, and there is no single agreed upon definition of the concept. It is sometimes modelled via the Landau–Lifshitz pseudotensor that allows retention for the energy–momentum conservation laws of classical mechanics. Addition of the matter stress–energy tensor to the Landau–Lifshitz pseudotensor results in a combined matter plus gravitational energy pseudotensor that has a vanishing 4-divergence in all frames—ensuring the conservation law. Some people object to this derivation on the grounds that pseudotensors are inappropriate in general relativity, but the divergence of the combined matter plus gravitational energy pseudotensor is a tensor.

See also 
 Gravitational binding energy
 Gravitational potential
 Gravitational potential energy storage
 Positive energy theorem

References 

Forms of energy
Gravity
Conservation laws
Tensors in general relativity
Potentials