# 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 ($m_1$ and $m_2$). By Newton's universal law of gravity, the force is

$\mathbf{F}_g = -\frac{Gm_1 m_2}{r^2}\;\hat r$

We integrate to get potential energy:

$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 $r=\infty$. Sometimes, when dealing with small distances where the difference in acceleration due to gravity will be negligable we simplify the energy equation by assuming that $r = R +y$, where $R$ is the Earth's radius and $y< is the height above the Earth's surface. Taking $m_2$ to be the mass of the planet:

$F_g = \frac{Gm_1 m_2}{R^2}$

$g = \frac{Gm_2}{R^2}$.

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

$U_g = -\int_0^y (-m_1g\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 ($k$) and the displacement from the rest position ($x$). It should be noted that the amount of energy is the same regardless whether the object is compressed or elongated. Given the force:

$\mathbf{F}_s = -k\mathbf{x}$

We integrate to get energy:

$U_s = -\int \mathbf{F}_s\,dx = \int -k\mathbf{x}\,dx = \frac{1}{2}k\mathbf{x}^2$