Gravitational Potential Energy
Potential energy is an energy of position. It comes from interacting objects. Here we take our first look at it by analyzing gravity. The earth and another object, say a book, make a system of two objects that interact via gravitational forces. If you now exert a force on the system by moving the book up, you have changed the energy of the system. The work you did on the book is stored in the book-earth system, waiting to be released when you drop the book. You can calculate this energy, by calculating the negative work the gravitational force of the earth did on the book when you moved it.
The Gravitational Potential Function
You can define a potential energy function for the gravitational force, which is the anti-derivative of the gravitational force. There is an unknown integration constant with an anti-derivative, but you can find that by choosing the location where the potential energy is zero. Once you have the potential energy function, you can calculate potential energy differences without having to calculate the work of the gravitational force.
General Potential Energy Functions in One Dimension
Besides gravity, when can we create potential energy functions from forces? In one dimension, the force has to be time-independent and has to be described by a function of position. It has to be defined in such a way that an indefinite integral can be defined. We haven't seen anything like that except gravity so far, but we can make some to play with.