There are typically two approaches to determining the Equation of Motion (EOM) for a dynamic system. The first is to apply Newton’s 2nd Law of Motion, which gives the differential equation most directly.
$$ \Sigma\vec F=m\vec a=m\ddot x=f(\dot x, x,...) $$
The second, when no energy losses are present (such as friction or viscous dampers), is to apply a work energy method, constructing an expression which indicates that the kinetic energy in the system changes only as work is done on the system.
$$ \dot W=\dot U_k\Rarr dW=dU_k\Rarr(\Sigma\vec F)\cdot d\vec r=d(\frac{m\dot x^2}{2}) $$
Equivalently, you can consider potential energies, and construct an expression indicating that the energy in the system is unchanging.
$$ 0=\dot U\Rarr0=dU_g+d U_k+dU_s $$
Both of these methods will render the same solution, a differential equation that we then need to solve. Vertical spring-mass systems without dampers will render differential equations in the form below.
**Insert diagram of vertical spring-mass systems
<aside> <img src="/icons/cellular_yellow.svg" alt="/icons/cellular_yellow.svg" width="40px" /> Differential equation for a spring-mass system
$$ m\ddot y+ky=mg $$
Where m is the equivalent mass of the system, k is the equivalent stiffness of the system, g is the acceleration due to gravity, and y is the displacement of the spring-mass system from its unstretched spring position.
</aside>
Recall that an ODE has a homogenous solution and particular solution.
The homogenous solution is also known as the free vibration response of the system because that response is what the system would undergo if no external forces were applied. It is also called the transient response because that response tends to decay with time.
The particular solution is also known as the forced vibration response response of the system because that response is what the system would undergo if an external force were applied. It is also called the steady-state response because that response what the system experiences after a long period of time (i.e., the transient response can be neglected).
$$ y_h=e^{\lambda t}\Rarr m\lambda^2+k=0\Rarr\lambda=\pm\sqrt{-\frac km}=i\omega_n $$
We take the natural frequency, $\omega_n$, to be the magnitude of the imaginary $\lambda$
$$ \omega_n=\sqrt{\frac km} $$
$$ y_h=C_1e^{\lambda_1t}+C_2e^{\lambda_2t}= C_1e^{i\omega_nt}+C_2e^{-i\omega_nt} $$
$$ y_h=C_1(\cos(\omega_nt)+i\sin(\omega_nt))+C_2(\cos(\omega_nt)-i\sin(\omega_nt)) $$