Consider a mass on a spring. The forces acting on the mass are gravity
with a force $mg$, where $m$ is the mass and $g$ is the acceleration of
gravity $(9.8\text{m}/sec^2)$, the restoring force of the spring with a
force $-kl$, where $k$ is the spring constant, $l$ is how much the
spring is stretched and the negative sign denotes the force is pulling
toward $l=0$, and the damping of the spring (friction) acting with a
force $-cv$, where $c$ is the damping constant, $v$ is the velocity and
the negative sign denotes that the force acts in opposition to the
motion. Now we choose our coordinates for the problem to have $x=0$ at
the equilibrium length of the spring $s$, where $mg=ks$. Note that with
this choice, $l=x+s$. We also choose $x>0$ to be when the spring is
stretched farther down from equilibrium (this is why we use $mg$ for
gravity and not $-mg$). So the total force on the spring is
$$ \begin{align}
mg - kl - cv &= mg - k(s+x) - cv \\
&= mg - ks - kx - cv \\
&= -kx -cv
\end{align} $$
But by Newton's second law of motion, $\text{force} = ma $ where $m$ is mass
and $a$ is acceleration. So
$$ ma = -kx - cv $$
Now if we remember that velocity is the derivative of position with respect to
time and acceleration is the second derivative of position with respect to
time, we have our final equation for free motion of a spring-mass system
$$ m\frac{d^2x}{dt^2}+c\frac{dx}{dt}+kx=0$$
where $m$ is mass, $c$ is the damping constant, $k$ is the spring constant,
$x$ is position and $t$ is time.
We now solve this equation in general and see what we can deduce about the
behavior of such a system. First we assume there is no damping $(c=0)$. Then
the general solution is
$$ \begin{align}
x(t) &= a \cos(\omega t) + b \sin(\omega t) \\
&= A \cos(\omega(t+\phi))
\end{align} $$
depending on which way you want to write the formula. Here
$\omega$ is $\sqrt{k/m}$. This is simple
harmonic motion with amplitude $A$, circular frequency $\omega$ and phase
shift $\phi$.
Next, suppose $c>0$. Here there are three different possibilities, depending
on
whether the discriminant $c^2 - 4km$ is positive, negative or zero. We look
for a
solution in the form $e^{rt}$ and obtain
$$(mr^2+cr+k)e^{rt} = 0 $$
from which we find
$$r=\frac{-c\pm\sqrt{c^2-4km}}{2m}$$
Now if the discriminant is positive, this equation has two distinct real
roots,
call them $r_1$ and $r_2$. The general solution is then
$c_1e^{r_1t}+c_2e^{r_2t}$.
We note that $r_1$ and $r_2$
will both be negative, so the solution will decay to 0 monotonically. In
this case the system is
said to be overdamped.
If the discriminant is negative,
then the roots will
be complex conjugates. The real part of the roots will be $-c/2m$ which is
negative so the solution will still decay to 0, but now it will oscillate
while doing so, since the imaginary part of the roots will give rise to a
factor of $\cos(\omega(t+p))$ in the solution. In
this case the system is
said to be underdamped
Finally, it
is possible for the discriminant to be zero. Here we have a double root at
$-c/2m$ and the general solution will be
$c_1e^{(c/2m)t}+c_2te^{(c/2m)t}$
This solution will converge monotonically to 0. In
this case the system is
said to be critically damped. Note that there is no obvious distinction
between the graph of an overdamped and a critically damped spring.
You can experiment with different coefficients below. (I've had some
trouble with this live diagram in Internet Explorer. It works fine in
Firefox, Chrome, and Safari)
$$mx''+cx'+kx=0$$