Potential Energy and Conservation of Energy

Objects may contain the potential to do work, even if they aren't
moving. We call this potential energy. It comes in
several varieties:

gravitational potential energy:

GPE = mgH

spring potential energy:

2
SPE = (1/2) k * x

One can define the mechanical energy of a system:
the sum over all bodies of

E = KE + PE(of all varieties)

Under some circumstances, the mechanical energy of a system
is conserved, so that

E(final) = E(initial)

However, if friction is present, then the mechanical energy is
not conserved: friction does negative work on moving objects,
which decreases their kinetic energy without adding any
potential energy to make up for the loss.
In this case, one can still write conservation of energy as