Energy is one of the fundamental conserved physical quantities found in nature. Potential energy is the energy resulting from an object's position when it is acted on by a conservative force. Kinetic energy is the energy of motion. The sum of the potential and kinetic energy of an object is its mechanical energy. Energy is a scalar rather than a vector quantity.
When an object moves in a nonconservative force field and then moves back to the original position, the object will not have the same energy it started with. For a nonconservative force the energy lost depends on the path the object takes between the two positions. All frictional forces are nonconservative forces.
When objects, however, move in conservative forces and then return to their original position, they have the same energy they started with. In addition the energy difference between two positions in a conservative force field is independent of the path an object takes between these positions.
Gravitational forces, electromagnetic forces, and the restoring force for an ideal spring are all common examples of conservative forces.
All conservative forces have an associated potential energy.
In any conservative force field, the difference in an object's potential energy between two positions is the negative of the work required to move the object between the two points.
Near the surface of the Earth the difference in gravitational potential energy between two points is given by the formula:
PE = mgh
Where m is the mass of the object, g is the acceleration due to gravity, and h is the vertical distance between the two points. The horizontal distance between the two points does not matter. The zero point for the potential energy can be chosen at any level that is convenient for the problem.
For locations that are not near the surface of the Earth, or other planet, the more general form for the gravitational potential energy is given by the equation:
PE = -GMm/r
Here the potential energy is taken to be zero at a distance of infinity. G is the universal gravitational constant, M and m are the masses of the two objects in question, and r is the distance between the centers of the two objects.
The electrical potential energy for a configuration of two charges is given by a similar equation:
PE = kQq/r
Where Q and q are the two charges and r is the distance between their centers. The Coulomb's law electrical constant, k, is often expressed as 1/(4 pi epsilon subzero).
For a stretched spring having a Hooke's law spring constant, k, (absolutely no connection to the electrical constant, k, above) and displaced a distance x from its equilibrium position, the spring potential energy is given by:
PE = (1/2) kx^2 (x^2 indicates x squared)
Potential energy, like kinetic energy and work, is in units of kilograms meters squared per second squared, which physicists call a joule. To get a rough feel for how much energy a joule is, think of it as the amount of energy required to lift an apple from the floor to a table. Another way to get a feel for a joule is to realize that a watt is a joule per second, so a 100 watt light bulb uses 100 joules of energy every second. A joule is not a large amount of energy.
Any conservative force will give rise to an associated potential energy. These are the most common studied in physics classes.
Knight, R.D., Physics for Scientists and Engineers with Modern Physics, Pearson, 2004.