# Physics with Calculus/Mechanics/Energy and Conservation of Energy/Potential energy

Potential energy is the energy stored in an object due to its position. There are several types of potential energy.

## Gravitational

Gravitational potential energy, involves the line integral of the force between two objects (${\displaystyle m_{1}}$ and ${\displaystyle m_{2}}$). By Newton's universal law of gravity, the force is

${\displaystyle \mathbf {F} _{g}=-{\frac {Gm_{1}m_{2}}{r^{2}}}\;{\hat {r}}}$

We integrate to get potential energy:

${\displaystyle U_{g}(r)=-\int _{\infty }^{r}\mathbf {F} _{g}\,dr'=\int _{\infty }^{r}{\frac {Gm_{1}m_{2}}{r^{2}}}\,dr=-{\frac {Gm_{1}m_{2}}{r}}}$

Here, we have taken the reference point (where the potential energy equals zero) to be at ${\displaystyle r=\infty }$. Sometimes, when dealing with small distances where the difference in acceleration due to gravity will be negligeable we simplify the energy equation by assuming that ${\displaystyle r=R+y}$, where ${\displaystyle R}$ is the Earth's radius and ${\displaystyle y< is the height above the Earth's surface. Taking ${\displaystyle m_{2}}$ to be the mass of the planet:

${\displaystyle F_{g}={\frac {Gm_{1}m_{2}}{R^{2}}}}$

${\displaystyle g={\frac {Gm_{2}}{R^{2}}}}$.

Note that the vector ${\displaystyle g}$ points in the ${\displaystyle -{\hat {r}}}$ direction. Inserting this into the integral for ${\displaystyle U_{g}}$:

${\displaystyle U_{g}=-\int _{0}^{y}(-m_{1}g{\hat {r}})dr'=m_{1}gy}$,

where now, the reference point is on the surface of the Earth.

## Elastic

Elastic potential energy is the energy stored in a compressed or elongated object (a spring, for example). The amount of energy stored in the object depends on spring constant (${\displaystyle k}$) and the displacement from the rest position (${\displaystyle x}$). It should be noted that the amount of energy is the same regardless whether the object is compressed or elongated. Given the force:

${\displaystyle \mathbf {F} _{s}=-k\mathbf {x} }$

We integrate to get energy:

${\displaystyle U_{s}=-\int \mathbf {F} _{s}\,dx=\int -k\mathbf {x} \,dx={\frac {1}{2}}k\mathbf {x} ^{2}}$